path
stringlengths 5
304
| repo_name
stringlengths 6
79
| content
stringlengths 27
1.05M
|
|---|---|---|
src/elements/content.js
|
bokuweb/re-bulma
|
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import styles from '../../build/styles';
export default class Content extends Component {
static propTypes = {
children: PropTypes.any,
className: PropTypes.string,
};
static defaultProps = {
className: '',
};
createClassName() {
return [
styles.content,
this.props.className,
].join(' ').trim();
}
render() {
return (
<div {...this.props} className={this.createClassName()}>
{this.props.children}
</div>
);
}
}
|
src/svg-icons/notification/sync-disabled.js
|
mtsandeep/material-ui
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let NotificationSyncDisabled = (props) => (
<SvgIcon {...props}>
<path d="M10 6.35V4.26c-.8.21-1.55.54-2.23.96l1.46 1.46c.25-.12.5-.24.77-.33zm-7.14-.94l2.36 2.36C4.45 8.99 4 10.44 4 12c0 2.21.91 4.2 2.36 5.64L4 20h6v-6l-2.24 2.24C6.68 15.15 6 13.66 6 12c0-1 .25-1.94.68-2.77l8.08 8.08c-.25.13-.5.25-.77.34v2.09c.8-.21 1.55-.54 2.23-.96l2.36 2.36 1.27-1.27L4.14 4.14 2.86 5.41zM20 4h-6v6l2.24-2.24C17.32 8.85 18 10.34 18 12c0 1-.25 1.94-.68 2.77l1.46 1.46C19.55 15.01 20 13.56 20 12c0-2.21-.91-4.2-2.36-5.64L20 4z"/>
</SvgIcon>
);
NotificationSyncDisabled = pure(NotificationSyncDisabled);
NotificationSyncDisabled.displayName = 'NotificationSyncDisabled';
NotificationSyncDisabled.muiName = 'SvgIcon';
export default NotificationSyncDisabled;
|
examples/huge-apps/routes/Course/routes/Announcements/routes/Announcement/components/Announcement.js
|
apoco/react-router
|
import React from 'react';
class Announcement extends React.Component {
//static loadProps (params, cb) {
//cb(null, {
//announcement: COURSES[params.courseId].announcements[params.announcementId]
//});
//}
render () {
//var { title, body } = this.props.announcement;
var { courseId, announcementId } = this.props.params;
var { title, body } = COURSES[courseId].announcements[announcementId];
return (
<div>
<h4>{title}</h4>
<p>{body}</p>
</div>
);
}
}
export default Announcement;
|
ajax/libs/yui/3.17.1-rc-1/datatable-core/datatable-core.js
|
WebReflection/cdnjs
|
YUI.add('datatable-core', function (Y, NAME) {
/**
The core implementation of the `DataTable` and `DataTable.Base` Widgets.
@module datatable
@submodule datatable-core
@since 3.5.0
**/
var INVALID = Y.Attribute.INVALID_VALUE,
Lang = Y.Lang,
isFunction = Lang.isFunction,
isObject = Lang.isObject,
isArray = Lang.isArray,
isString = Lang.isString,
isNumber = Lang.isNumber,
toArray = Y.Array,
keys = Y.Object.keys,
Table;
/**
_API docs for this extension are included in the DataTable class._
Class extension providing the core API and structure for the DataTable Widget.
Use this class extension with Widget or another Base-based superclass to create
the basic DataTable model API and composing class structure.
@class DataTable.Core
@for DataTable
@since 3.5.0
**/
Table = Y.namespace('DataTable').Core = function () {};
Table.ATTRS = {
/**
Columns to include in the rendered table.
If omitted, the attributes on the configured `recordType` or the first item
in the `data` collection will be used as a source.
This attribute takes an array of strings or objects (mixing the two is
fine). Each string or object is considered a column to be rendered.
Strings are converted to objects, so `columns: ['first', 'last']` becomes
`columns: [{ key: 'first' }, { key: 'last' }]`.
DataTable.Core only concerns itself with a few properties of columns.
These properties are:
* `key` - Used to identify the record field/attribute containing content for
this column. Also used to create a default Model if no `recordType` or
`data` are provided during construction. If `name` is not specified, this
is assigned to the `_id` property (with added incrementer if the key is
used by multiple columns).
* `children` - Traversed to initialize nested column objects
* `name` - Used in place of, or in addition to, the `key`. Useful for
columns that aren't bound to a field/attribute in the record data. This
is assigned to the `_id` property.
* `id` - For backward compatibility. Implementers can specify the id of
the header cell. This should be avoided, if possible, to avoid the
potential for creating DOM elements with duplicate IDs.
* `field` - For backward compatibility. Implementers should use `name`.
* `_id` - Assigned unique-within-this-instance id for a column. By order
of preference, assumes the value of `name`, `key`, `id`, or `_yuid`.
This is used by the rendering views as well as feature module
as a means to identify a specific column without ambiguity (such as
multiple columns using the same `key`.
* `_yuid` - Guid stamp assigned to the column object.
* `_parent` - Assigned to all child columns, referencing their parent
column.
@attribute columns
@type {Object[]|String[]}
@default (from `recordType` ATTRS or first item in the `data`)
@since 3.5.0
**/
columns: {
// TODO: change to setter to clone input array/objects
validator: isArray,
setter: '_setColumns',
getter: '_getColumns'
},
/**
Model subclass to use as the `model` for the ModelList stored in the `data`
attribute.
If not provided, it will try really hard to figure out what to use. The
following attempts will be made to set a default value:
1. If the `data` attribute is set with a ModelList instance and its `model`
property is set, that will be used.
2. If the `data` attribute is set with a ModelList instance, and its
`model` property is unset, but it is populated, the `ATTRS` of the
`constructor of the first item will be used.
3. If the `data` attribute is set with a non-empty array, a Model subclass
will be generated using the keys of the first item as its `ATTRS` (see
the `_createRecordClass` method).
4. If the `columns` attribute is set, a Model subclass will be generated
using the columns defined with a `key`. This is least desirable because
columns can be duplicated or nested in a way that's not parsable.
5. If neither `data` nor `columns` is set or populated, a change event
subscriber will listen for the first to be changed and try all over
again.
@attribute recordType
@type {Function}
@default (see description)
@since 3.5.0
**/
recordType: {
getter: '_getRecordType',
setter: '_setRecordType'
},
/**
The collection of data records to display. This attribute is a pass
through to a `data` property, which is a ModelList instance.
If this attribute is passed a ModelList or subclass, it will be assigned to
the property directly. If an array of objects is passed, a new ModelList
will be created using the configured `recordType` as its `model` property
and seeded with the array.
Retrieving this attribute will return the ModelList stored in the `data`
property.
@attribute data
@type {ModelList|Object[]}
@default `new ModelList()`
@since 3.5.0
**/
data: {
valueFn: '_initData',
setter : '_setData',
lazyAdd: false
},
/**
Content for the `<table summary="ATTRIBUTE VALUE HERE">`. Values assigned
to this attribute will be HTML escaped for security.
@attribute summary
@type {String}
@default '' (empty string)
@since 3.5.0
**/
//summary: {},
/**
HTML content of an optional `<caption>` element to appear above the table.
Leave this config unset or set to a falsy value to remove the caption.
@attribute caption
@type HTML
@default '' (empty string)
@since 3.5.0
**/
//caption: {},
/**
Deprecated as of 3.5.0. Passes through to the `data` attribute.
WARNING: `get('recordset')` will NOT return a Recordset instance as of
3.5.0. This is a break in backward compatibility.
@attribute recordset
@type {Object[]|Recordset}
@deprecated Use the `data` attribute
@since 3.5.0
**/
recordset: {
setter: '_setRecordset',
getter: '_getRecordset',
lazyAdd: false
},
/**
Deprecated as of 3.5.0. Passes through to the `columns` attribute.
WARNING: `get('columnset')` will NOT return a Columnset instance as of
3.5.0. This is a break in backward compatibility.
@attribute columnset
@type {Object[]}
@deprecated Use the `columns` attribute
@since 3.5.0
**/
columnset: {
setter: '_setColumnset',
getter: '_getColumnset',
lazyAdd: false
}
};
Y.mix(Table.prototype, {
// -- Instance properties -------------------------------------------------
/**
The ModelList that manages the table's data.
@property data
@type {ModelList}
@default undefined (initially unset)
@since 3.5.0
**/
//data: null,
// -- Public methods ------------------------------------------------------
/**
Gets the column configuration object for the given key, name, or index. For
nested columns, `name` can be an array of indexes, each identifying the index
of that column in the respective parent's "children" array.
If you pass a column object, it will be returned.
For columns with keys, you can also fetch the column with
`instance.get('columns.foo')`.
@method getColumn
@param {String|Number|Number[]} name Key, "name", index, or index array to
identify the column
@return {Object} the column configuration object
@since 3.5.0
**/
getColumn: function (name) {
var col, columns, i, len, cols;
if (isObject(name) && !isArray(name)) {
if (name && name._node) {
col = this.body.getColumn(name);
} else {
col = name;
}
} else {
col = this.get('columns.' + name);
}
if (col) {
return col;
}
columns = this.get('columns');
if (isNumber(name) || isArray(name)) {
name = toArray(name);
cols = columns;
for (i = 0, len = name.length - 1; cols && i < len; ++i) {
cols = cols[name[i]] && cols[name[i]].children;
}
return (cols && cols[name[i]]) || null;
}
return null;
},
/**
Returns the Model associated to the record `id`, `clientId`, or index (not
row index). If none of those yield a Model from the `data` ModelList, the
arguments will be passed to the `view` instance's `getRecord` method
if it has one.
If no Model can be found, `null` is returned.
@method getRecord
@param {Number|String|Node} seed Record `id`, `clientId`, index, Node, or
identifier for a row or child element
@return {Model}
@since 3.5.0
**/
getRecord: function (seed) {
var record = this.data.getById(seed) || this.data.getByClientId(seed);
if (!record) {
if (isNumber(seed)) {
record = this.data.item(seed);
}
// TODO: this should be split out to base somehow
if (!record && this.view && this.view.getRecord) {
record = this.view.getRecord.apply(this.view, arguments);
}
}
return record || null;
},
// -- Protected and private properties and methods ------------------------
/**
This tells `Y.Base` that it should create ad-hoc attributes for config
properties passed to DataTable's constructor. This is useful for setting
configurations on the DataTable that are intended for the rendering View(s).
@property _allowAdHocAttrs
@type Boolean
@default true
@protected
@since 3.6.0
**/
_allowAdHocAttrs: true,
/**
A map of column key to column configuration objects parsed from the
`columns` attribute.
@property _columnMap
@type {Object}
@default undefined (initially unset)
@protected
@since 3.5.0
**/
//_columnMap: null,
/**
The Node instance of the table containing the data rows. This is set when
the table is rendered. It may also be set by progressive enhancement,
though this extension does not provide the logic to parse from source.
@property _tableNode
@type {Node}
@default undefined (initially unset)
@protected
@since 3.5.0
**/
//_tableNode: null,
/**
Updates the `_columnMap` property in response to changes in the `columns`
attribute.
@method _afterColumnsChange
@param {EventFacade} e The `columnsChange` event object
@protected
@since 3.5.0
**/
_afterColumnsChange: function (e) {
this._setColumnMap(e.newVal);
},
/**
Updates the `modelList` attributes of the rendered views in response to the
`data` attribute being assigned a new ModelList.
@method _afterDataChange
@param {EventFacade} e the `dataChange` event
@protected
@since 3.5.0
**/
_afterDataChange: function (e) {
var modelList = e.newVal;
this.data = e.newVal;
if (!this.get('columns') && modelList.size()) {
// TODO: this will cause a re-render twice because the Views are
// subscribed to columnsChange
this._initColumns();
}
},
/**
Assigns to the new recordType as the model for the data ModelList
@method _afterRecordTypeChange
@param {EventFacade} e recordTypeChange event
@protected
@since 3.6.0
**/
_afterRecordTypeChange: function (e) {
var data = this.data.toJSON();
this.data.model = e.newVal;
this.data.reset(data);
if (!this.get('columns') && data) {
if (data.length) {
this._initColumns();
} else {
this.set('columns', keys(e.newVal.ATTRS));
}
}
},
/**
Creates a Model subclass from an array of attribute names or an object of
attribute definitions. This is used to generate a class suitable to
represent the data passed to the `data` attribute if no `recordType` is
set.
@method _createRecordClass
@param {String[]|Object} attrs Names assigned to the Model subclass's
`ATTRS` or its entire `ATTRS` definition object
@return {Model}
@protected
@since 3.5.0
**/
_createRecordClass: function (attrs) {
var ATTRS, i, len;
if (isArray(attrs)) {
ATTRS = {};
for (i = 0, len = attrs.length; i < len; ++i) {
ATTRS[attrs[i]] = {};
}
} else if (isObject(attrs)) {
ATTRS = attrs;
}
return Y.Base.create('record', Y.Model, [], null, { ATTRS: ATTRS });
},
/**
Tears down the instance.
@method destructor
@protected
@since 3.6.0
**/
destructor: function () {
new Y.EventHandle(Y.Object.values(this._eventHandles)).detach();
},
/**
The getter for the `columns` attribute. Returns the array of column
configuration objects if `instance.get('columns')` is called, or the
specific column object if `instance.get('columns.columnKey')` is called.
@method _getColumns
@param {Object[]} columns The full array of column objects
@param {String} name The attribute name requested
(e.g. 'columns' or 'columns.foo');
@protected
@since 3.5.0
**/
_getColumns: function (columns, name) {
// Workaround for an attribute oddity (ticket #2529254)
// getter is expected to return an object if get('columns.foo') is called.
// Note 'columns.' is 8 characters
return name.length > 8 ? this._columnMap : columns;
},
/**
Relays the `get()` request for the deprecated `columnset` attribute to the
`columns` attribute.
THIS BREAKS BACKWARD COMPATIBILITY. 3.4.1 and prior implementations will
expect a Columnset instance returned from `get('columnset')`.
@method _getColumnset
@param {Object} ignored The current value stored in the `columnset` state
@param {String} name The attribute name requested
(e.g. 'columnset' or 'columnset.foo');
@deprecated This will be removed with the `columnset` attribute in a future
version.
@protected
@since 3.5.0
**/
_getColumnset: function (_, name) {
return this.get(name.replace(/^columnset/, 'columns'));
},
/**
Returns the Model class of the instance's `data` attribute ModelList. If
not set, returns the explicitly configured value.
@method _getRecordType
@param {Model} val The currently configured value
@return {Model}
**/
_getRecordType: function (val) {
// Prefer the value stored in the attribute because the attribute
// change event defaultFn sets e.newVal = this.get('recordType')
// before notifying the after() subs. But if this getter returns
// this.data.model, then after() subs would get e.newVal === previous
// model before _afterRecordTypeChange can set
// this.data.model = e.newVal
return val || (this.data && this.data.model);
},
/**
Initializes the `_columnMap` property from the configured `columns`
attribute. If `columns` is not set, but there are records in the `data`
ModelList, use
`ATTRS` of that class.
@method _initColumns
@protected
@since 3.5.0
**/
_initColumns: function () {
var columns = this.get('columns') || [],
item;
// Default column definition from the configured recordType
if (!columns.length && this.data.size()) {
// TODO: merge superclass attributes up to Model?
item = this.data.item(0);
if (item.toJSON) {
item = item.toJSON();
}
this.set('columns', keys(item));
}
this._setColumnMap(columns);
},
/**
Sets up the change event subscriptions to maintain internal state.
@method _initCoreEvents
@protected
@since 3.6.0
**/
_initCoreEvents: function () {
this._eventHandles.coreAttrChanges = this.after({
columnsChange : Y.bind('_afterColumnsChange', this),
recordTypeChange: Y.bind('_afterRecordTypeChange', this),
dataChange : Y.bind('_afterDataChange', this)
});
},
/**
Defaults the `data` attribute to an empty ModelList if not set during
construction. Uses the configured `recordType` for the ModelList's `model`
proeprty if set.
@method _initData
@protected
@return {ModelList}
@since 3.6.0
**/
_initData: function () {
var recordType = this.get('recordType'),
// TODO: LazyModelList if recordType doesn't have complex ATTRS
modelList = new Y.ModelList();
if (recordType) {
modelList.model = recordType;
}
return modelList;
},
/**
Initializes the instance's `data` property from the value of the `data`
attribute. If the attribute value is a ModelList, it is assigned directly
to `this.data`. If it is an array, a ModelList is created, its `model`
property is set to the configured `recordType` class, and it is seeded with
the array data. This ModelList is then assigned to `this.data`.
@method _initDataProperty
@param {Array|ModelList|ArrayList} data Collection of data to populate the
DataTable
@protected
@since 3.6.0
**/
_initDataProperty: function (data) {
var recordType;
if (!this.data) {
recordType = this.get('recordType');
if (data && data.each && data.toJSON) {
this.data = data;
if (recordType) {
this.data.model = recordType;
}
} else {
// TODO: customize the ModelList or read the ModelList class
// from a configuration option?
this.data = new Y.ModelList();
if (recordType) {
this.data.model = recordType;
}
}
// TODO: Replace this with an event relay for specific events.
// Using bubbling causes subscription conflicts with the models'
// aggregated change event and 'change' events from DOM elements
// inside the table (via Widget UI event).
this.data.addTarget(this);
}
},
/**
Initializes the columns, `recordType` and data ModelList.
@method initializer
@param {Object} config Configuration object passed to constructor
@protected
@since 3.5.0
**/
initializer: function (config) {
var data = config.data,
columns = config.columns,
recordType;
// Referencing config.data to allow _setData to be more stringent
// about its behavior
this._initDataProperty(data);
// Default columns from recordType ATTRS if recordType is supplied at
// construction. If no recordType is supplied, but the data is
// supplied as a non-empty array, use the keys of the first item
// as the columns.
if (!columns) {
recordType = (config.recordType || config.data === this.data) &&
this.get('recordType');
if (recordType) {
columns = keys(recordType.ATTRS);
} else if (isArray(data) && data.length) {
columns = keys(data[0]);
}
if (columns) {
this.set('columns', columns);
}
}
this._initColumns();
this._eventHandles = {};
this._initCoreEvents();
},
/**
Iterates the array of column configurations to capture all columns with a
`key` property. An map is built with column keys as the property name and
the corresponding column object as the associated value. This map is then
assigned to the instance's `_columnMap` property.
@method _setColumnMap
@param {Object[]|String[]} columns The array of column config objects
@protected
@since 3.6.0
**/
_setColumnMap: function (columns) {
var map = {};
function process(cols) {
var i, len, col, key;
for (i = 0, len = cols.length; i < len; ++i) {
col = cols[i];
key = col.key;
// First in wins for multiple columns with the same key
// because the first call to genId (in _setColumns) will
// return the same key, which will then be overwritten by the
// subsequent same-keyed column. So table.getColumn(key) would
// return the last same-keyed column.
if (key && !map[key]) {
map[key] = col;
}
//TODO: named columns can conflict with keyed columns
map[col._id] = col;
if (col.children) {
process(col.children);
}
}
}
process(columns);
this._columnMap = map;
},
/**
Translates string columns into objects with that string as the value of its
`key` property.
All columns are assigned a `_yuid` stamp and `_id` property corresponding
to the column's configured `name` or `key` property with any spaces
replaced with dashes. If the same `name` or `key` appears in multiple
columns, subsequent appearances will have their `_id` appended with an
incrementing number (e.g. if column "foo" is included in the `columns`
attribute twice, the first will get `_id` of "foo", and the second an `_id`
of "foo1"). Columns that are children of other columns will have the
`_parent` property added, assigned the column object to which they belong.
@method _setColumns
@param {null|Object[]|String[]} val Array of config objects or strings
@return {null|Object[]}
@protected
**/
_setColumns: function (val) {
var keys = {},
known = [],
knownCopies = [],
arrayIndex = Y.Array.indexOf;
function copyObj(o) {
var copy = {},
key, val, i;
known.push(o);
knownCopies.push(copy);
for (key in o) {
if (o.hasOwnProperty(key)) {
val = o[key];
if (isArray(val)) {
copy[key] = val.slice();
} else if (isObject(val, true)) {
i = arrayIndex(known, val);
copy[key] = i === -1 ? copyObj(val) : knownCopies[i];
} else {
copy[key] = o[key];
}
}
}
return copy;
}
function genId(name) {
// Sanitize the name for use in generated CSS classes.
// TODO: is there more to do for other uses of _id?
name = name.replace(/\s+/, '-');
if (keys[name]) {
name += (keys[name]++);
} else {
keys[name] = 1;
}
return name;
}
function process(cols, parent) {
var columns = [],
i, len, col, yuid;
for (i = 0, len = cols.length; i < len; ++i) {
columns[i] = // chained assignment
col = isString(cols[i]) ? { key: cols[i] } : copyObj(cols[i]);
yuid = Y.stamp(col);
// For backward compatibility
if (!col.id) {
// Implementers can shoot themselves in the foot by setting
// this config property to a non-unique value
col.id = yuid;
}
if (col.field) {
// Field is now known as "name" to avoid confusion with data
// fields or schema.resultFields
col.name = col.field;
}
if (parent) {
col._parent = parent;
} else {
delete col._parent;
}
// Unique id based on the column's configured name or key,
// falling back to the yuid. Duplicates will have a counter
// added to the end.
col._id = genId(col.name || col.key || col.id);
if (isArray(col.children)) {
col.children = process(col.children, col);
}
}
return columns;
}
return val && process(val);
},
/**
Relays attribute assignments of the deprecated `columnset` attribute to the
`columns` attribute. If a Columnset is object is passed, its basic object
structure is mined.
@method _setColumnset
@param {Array|Columnset} val The columnset value to relay
@deprecated This will be removed with the deprecated `columnset` attribute
in a later version.
@protected
@since 3.5.0
**/
_setColumnset: function (val) {
this.set('columns', val);
return isArray(val) ? val : INVALID;
},
/**
Accepts an object with `each` and `getAttrs` (preferably a ModelList or
subclass) or an array of data objects. If an array is passes, it will
create a ModelList to wrap the data. In doing so, it will set the created
ModelList's `model` property to the class in the `recordType` attribute,
which will be defaulted if not yet set.
If the `data` property is already set with a ModelList, passing an array as
the value will call the ModelList's `reset()` method with that array rather
than replacing the stored ModelList wholesale.
Any non-ModelList-ish and non-array value is invalid.
@method _setData
@protected
@since 3.5.0
**/
_setData: function (val) {
if (val === null) {
val = [];
}
if (isArray(val)) {
this._initDataProperty();
// silent to prevent subscribers to both reset and dataChange
// from reacting to the change twice.
// TODO: would it be better to return INVALID to silence the
// dataChange event, or even allow both events?
this.data.reset(val, { silent: true });
// Return the instance ModelList to avoid storing unprocessed
// data in the state and their vivified Model representations in
// the instance's data property. Decreases memory consumption.
val = this.data;
} else if (!val || !val.each || !val.toJSON) {
// ModelList/ArrayList duck typing
val = INVALID;
}
return val;
},
/**
Relays the value assigned to the deprecated `recordset` attribute to the
`data` attribute. If a Recordset instance is passed, the raw object data
will be culled from it.
@method _setRecordset
@param {Object[]|Recordset} val The recordset value to relay
@deprecated This will be removed with the deprecated `recordset` attribute
in a later version.
@protected
@since 3.5.0
**/
_setRecordset: function (val) {
var data;
if (val && Y.Recordset && val instanceof Y.Recordset) {
data = [];
val.each(function (record) {
data.push(record.get('data'));
});
val = data;
}
this.set('data', val);
return val;
},
/**
Accepts a Base subclass (preferably a Model subclass). Alternately, it will
generate a custom Model subclass from an array of attribute names or an
object defining attributes and their respective configurations (it is
assigned as the `ATTRS` of the new class).
Any other value is invalid.
@method _setRecordType
@param {Function|String[]|Object} val The Model subclass, array of
attribute names, or the `ATTRS` definition for a custom model
subclass
@return {Function} A Base/Model subclass
@protected
@since 3.5.0
**/
_setRecordType: function (val) {
var modelClass;
// Duck type based on known/likely consumed APIs
if (isFunction(val) && val.prototype.toJSON && val.prototype.setAttrs) {
modelClass = val;
} else if (isObject(val)) {
modelClass = this._createRecordClass(val);
}
return modelClass || INVALID;
}
});
/**
_This is a documentation entry only_
Columns are described by object literals with a set of properties.
There is not an actual `DataTable.Column` class.
However, for the purpose of documenting it, this pseudo-class is declared here.
DataTables accept an array of column definitions in their [columns](DataTable.html#attr_columns)
attribute. Each entry in this array is a column definition which may contain
any combination of the properties listed below.
There are no mandatory properties though a column will usually have a
[key](#property_key) property to reference the data it is supposed to show.
The [columns](DataTable.html#attr_columns) attribute can accept a plain string
in lieu of an object literal, which is the equivalent of an object with the
[key](#property_key) property set to that string.
@class DataTable.Column
*/
/**
Binds the column values to the named property in the [data](DataTable.html#attr_data).
Optional if [formatter](#property_formatter), [nodeFormatter](#property_nodeFormatter),
or [cellTemplate](#property_cellTemplate) is used to populate the content.
It should not be set if [children](#property_children) is set.
The value is used for the [\_id](#property__id) property unless the [name](#property_name)
property is also set.
{ key: 'username' }
The above column definition can be reduced to this:
'username'
@property key
@type String
*/
/**
An identifier that can be used to locate a column via
[getColumn](DataTable.html#method_getColumn)
or style columns with class `yui3-datatable-col-NAME` after dropping characters
that are not valid for CSS class names.
It defaults to the [key](#property_key).
The value is used for the [\_id](#property__id) property.
{ name: 'fullname', formatter: ... }
@property name
@type String
*/
/**
An alias for [name](#property_name) for backward compatibility.
{ field: 'fullname', formatter: ... }
@property field
@type String
*/
/**
Overrides the default unique id assigned `<th id="HERE">`.
__Use this with caution__, since it can result in
duplicate ids in the DOM.
{
name: 'checkAll',
id: 'check-all',
label: ...
formatter: ...
}
@property id
@type String
*/
/**
HTML to populate the header `<th>` for the column.
It defaults to the value of the [key](#property_key) property or the text
`Column n` where _n_ is an ordinal number.
{ key: 'MfgvaPrtNum', label: 'Part Number' }
@property label
@type {String}
*/
/**
Used to create stacked headers.
Child columns may also contain `children`. There is no limit
to the depth of nesting.
Columns configured with `children` are for display only and
<strong>should not</strong> be configured with a [key](#property_key).
Configurations relating to the display of data, such as
[formatter](#property_formatter), [nodeFormatter](#property_nodeFormatter),
[emptyCellValue](#property_emptyCellValue), etc. are ignored.
{ label: 'Name', children: [
{ key: 'firstName', label: 'First`},
{ key: 'lastName', label: 'Last`}
]}
@property children
@type Array
*/
/**
Assigns the value `<th abbr="HERE">`.
{
key : 'forecast',
label: '1yr Target Forecast',
abbr : 'Forecast'
}
@property abbr
@type String
*/
/**
Assigns the value `<th title="HERE">`.
{
key : 'forecast',
label: '1yr Target Forecast',
title: 'Target Forecast for the Next 12 Months'
}
@property title
@type String
*/
/**
Overrides the default [CELL_TEMPLATE](DataTable.HeaderView.html#property_CELL_TEMPLATE)
used by `Y.DataTable.HeaderView` to render the header cell
for this column. This is necessary when more control is
needed over the markup for the header itself, rather than
its content.
Use the [label](#property_label) configuration if you don't need to
customize the `<th>` iteself.
Implementers are strongly encouraged to preserve at least
the `{id}` and `{_id}` placeholders in the custom value.
{
headerTemplate:
'<th id="{id}" ' +
'title="Unread" ' +
'class="{className}" ' +
'{_id}>●</th>'
}
@property headerTemplate
@type HTML
*/
/**
Overrides the default [CELL_TEMPLATE](DataTable.BodyView.html#property_CELL_TEMPLATE)
used by `Y.DataTable.BodyView` to render the data cells
for this column. This is necessary when more control is
needed over the markup for the `<td>` itself, rather than
its content.
{
key: 'id',
cellTemplate:
'<td class="{className}">' +
'<input type="checkbox" ' +
'id="{content}">' +
'</td>'
}
@property cellTemplate
@type String
*/
/**
String or function used to translate the raw record data for each cell in a
given column into a format better suited to display.
If it is a string, it will initially be assumed to be the name of one of the
formatting functions in
[Y.DataTable.BodyView.Formatters](DataTable.BodyView.Formatters.html).
If one such formatting function exists, it will be used.
If no such named formatter is found, it will be assumed to be a template
string and will be expanded. The placeholders can contain the key to any
field in the record or the placeholder `{value}` which represents the value
of the current field.
If the value is a function, it will be assumed to be a formatting function.
A formatting function receives a single argument, an object with the following properties:
* __value__ The raw value from the record Model to populate this cell.
Equivalent to `o.record.get(o.column.key)` or `o.data[o.column.key]`.
* __data__ The Model data for this row in simple object format.
* __record__ The Model for this row.
* __column__ The column configuration object.
* __className__ A string of class names to add `<td class="HERE">` in addition to
the column class and any classes in the column's className configuration.
* __rowIndex__ The index of the current Model in the ModelList.
Typically correlates to the row index as well.
* __rowClass__ A string of css classes to add `<tr class="HERE"><td....`
This is useful to avoid the need for nodeFormatters to add classes to the containing row.
The formatter function may return a string value that will be used for the cell
contents or it may change the value of the `value`, `className` or `rowClass`
properties which well then be used to format the cell. If the value for the cell
is returned in the `value` property of the input argument, no value should be returned.
{
key: 'name',
formatter: 'link', // named formatter
linkFrom: 'website' // extra column property for link formatter
},
{
key: 'cost',
formatter: '${value}' // formatter template string
//formatter: '${cost}' // same result but less portable
},
{
name: 'Name', // column does not have associated field value
// thus, it uses name instead of key
formatter: '{firstName} {lastName}' // template references other fields
},
{
key: 'price',
formatter: function (o) { // function both returns a string to show
if (o.value > 3) { // and a className to apply to the cell
o.className += 'expensive';
}
return '$' + o.value.toFixed(2);
}
},
@property formatter
@type String || Function
*/
/**
Used to customize the content of the data cells for this column.
`nodeFormatter` is significantly slower than [formatter](#property_formatter)
and should be avoided if possible. Unlike [formatter](#property_formatter),
`nodeFormatter` has access to the `<td>` element and its ancestors.
The function provided is expected to fill in the `<td>` element itself.
__Node formatters should return `false`__ except in certain conditions as described
in the users guide.
The function receives a single object
argument with the following properties:
* __td__ The `<td>` Node for this cell.
* __cell__ If the cell `<td> contains an element with class `yui3-datatable-liner,
this will refer to that Node. Otherwise, it is equivalent to `td` (default behavior).
* __value__ The raw value from the record Model to populate this cell.
Equivalent to `o.record.get(o.column.key)` or `o.data[o.column.key]`.
* __data__ The Model data for this row in simple object format.
* __record__ The Model for this row.
* __column__ The column configuration object.
* __rowIndex__ The index of the current Model in the ModelList.
_Typically_ correlates to the row index as well.
@example
nodeFormatter: function (o) {
if (o.value < o.data.quota) {
o.td.setAttribute('rowspan', 2);
o.td.setAttribute('data-term-id', this.record.get('id'));
o.td.ancestor().insert(
'<tr><td colspan"3">' +
'<button class="term">terminate</button>' +
'</td></tr>',
'after');
}
o.cell.setHTML(o.value);
return false;
}
@property nodeFormatter
@type Function
*/
/**
Provides the default value to populate the cell if the data
for that cell is `undefined`, `null`, or an empty string.
{
key: 'price',
emptyCellValue: '???'
}
@property emptyCellValue
@type {String} depending on the setting of allowHTML
*/
/**
Skips the security step of HTML escaping the value for cells
in this column.
This is also necessary if [emptyCellValue](#property_emptyCellValue)
is set with an HTML string.
`nodeFormatter`s ignore this configuration. If using a
`nodeFormatter`, it is recommended to use
[Y.Escape.html()](Escape.html#method_html)
on any user supplied content that is to be displayed.
{
key: 'preview',
allowHTML: true
}
@property allowHTML
@type Boolean
*/
/**
A string of CSS classes that will be added to the `<td>`'s
`class` attribute.
Note, all cells will automatically have a class in the
form of "yui3-datatable-col-XXX" added to the `<td>`, where
XXX is the column's configured `name`, `key`, or `id` (in
that order of preference) sanitized from invalid characters.
{
key: 'symbol',
className: 'no-hide'
}
@property className
@type String
*/
/**
(__read-only__) The unique identifier assigned
to each column. This is used for the `id` if not set, and
the `_id` if none of [name](#property_name),
[field](#property_field), [key](#property_key), or [id](#property_id) are
set.
@property _yuid
@type String
@protected
*/
/**
(__read-only__) A unique-to-this-instance name
used extensively in the rendering process. It is also used
to create the column's classname, as the input name
`table.getColumn(HERE)`, and in the column header's
`<th data-yui3-col-id="HERE">`.
The value is populated by the first of [name](#property_name),
[field](#property_field), [key](#property_key), [id](#property_id),
or [_yuid](#property__yuid) to have a value. If that value
has already been used (such as when multiple columns have
the same `key`), an incrementer is added to the end. For
example, two columns with `key: "id"` will have `_id`s of
"id" and "id2". `table.getColumn("id")` will return the
first column, and `table.getColumn("id2")` will return the
second.
@property _id
@type String
@protected
*/
/**
(__read-only__) Used by
`Y.DataTable.HeaderView` when building stacked column
headers.
@property _colspan
@type Integer
@protected
*/
/**
(__read-only__) Used by
`Y.DataTable.HeaderView` when building stacked column
headers.
@property _rowspan
@type Integer
@protected
*/
/**
(__read-only__) Assigned to all columns in a
column's `children` collection. References the parent
column object.
@property _parent
@type DataTable.Column
@protected
*/
/**
(__read-only__) Array of the `id`s of the
column and all parent columns. Used by
`Y.DataTable.BodyView` to populate `<td headers="THIS">`
when a cell references more than one header.
@property _headers
@type Array
@protected
*/
}, '@VERSION@', {"requires": ["escape", "model-list", "node-event-delegate"]});
|
app/javascript/mastodon/features/ui/components/bundle_column_error.js
|
Chronister/mastodon
|
import React from 'react';
import PropTypes from 'prop-types';
import { defineMessages, injectIntl } from 'react-intl';
import Column from './column';
import ColumnHeader from './column_header';
import ColumnBackButtonSlim from '../../../components/column_back_button_slim';
import IconButton from '../../../components/icon_button';
const messages = defineMessages({
title: { id: 'bundle_column_error.title', defaultMessage: 'Network error' },
body: { id: 'bundle_column_error.body', defaultMessage: 'Something went wrong while loading this component.' },
retry: { id: 'bundle_column_error.retry', defaultMessage: 'Try again' },
});
class BundleColumnError extends React.PureComponent {
static propTypes = {
onRetry: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
}
handleRetry = () => {
this.props.onRetry();
}
render () {
const { intl: { formatMessage } } = this.props;
return (
<Column>
<ColumnHeader icon='exclamation-circle' type={formatMessage(messages.title)} />
<ColumnBackButtonSlim />
<div className='error-column'>
<IconButton title={formatMessage(messages.retry)} icon='refresh' onClick={this.handleRetry} size={64} />
{formatMessage(messages.body)}
</div>
</Column>
);
}
}
export default injectIntl(BundleColumnError);
|
src/main/js/admin/modules/Analyze.js
|
chaokunyang/amanda
|
import React, { Component } from 'react';
const Analyze = () => (
<div>
分析
</div>
);
export default Analyze;
|
src/js/app-constants.js
|
SeerUK/react-fundamentals
|
/**
* This file is part of the react-fundamentals package.
*
* 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.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
export const NOTES_INITIALISE = "NOTES_INITIALISE";
export const NOTES_UNINITIALISE = "NOTES_UNINITIALISE";
export const NOTES_EVENT_SYNCING = "NOTES_EVENT_SYNCING";
export const NOTES_EVENT_SYNCED = "NOTES_EVENT_SYNCED";
export const NOTES_PROCESS_NOTE_ADDING = "NOTES_PROCESS_NOTE_ADDING";
export const NOTES_PROCESS_NOTE_REMOVING = "NOTES_PROCESS_NOTE_REMOVING";
export const NOTES_PROCESS_NOTE_ADDED = "NOTES_PROCESS_NOTE_ADDED";
export const NOTES_PROCESS_NOTE_REMOVED = "NOTES_PROCESS_NOTE_REMOVED";
export const PROFILE_EVENT_LOADING = "PROFILE_EVENT_LOADING";
export const PROFILE_EVENT_LOADED = "PROFILE_EVENT_LOADED";
export const PROFILE_EVENT_UNLOAD = "PROFILE_EVENT_UNLOAD";
export const SEARCH_GITHUB_EVENT_SEARCH = "SEARCH_GITHUB_EVENT_SEARCH";
|
packages/forms/src/UIForm/fields/File/displayMode/TextMode.component.js
|
Talend/ui
|
import PropTypes from 'prop-types';
import React from 'react';
import { TextMode as FieldTemplate } from '../../FieldTemplate';
import { getFileName } from '../File.component';
export default function FileTextMode(props) {
const { id, schema, value } = props;
const { title, labelProps } = schema;
return (
<FieldTemplate id={id} label={title} labelProps={labelProps}>
{getFileName(value, schema)}
</FieldTemplate>
);
}
if (process.env.NODE_ENV !== 'production') {
FileTextMode.propTypes = {
id: PropTypes.string,
schema: PropTypes.shape({
title: PropTypes.string,
labelProps: PropTypes.object,
type: PropTypes.string,
}),
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
};
}
FileTextMode.defaultProps = {
schema: {},
value: '',
};
|
app/js/components/App.react.js
|
Kielan/kielan-com
|
/**
*
* App.react.js
*
* This component is the skeleton around the actual pages, and should only
* contain code that should be seen on all pages. (e.g. navigation bar)
*/
import React, { Component } from 'react';
import { connect } from 'react-redux';
import Logo from '../../img/logo.png';
import Topnav from './shared/Topnav.react';
class App extends Component {
render() {
return (
<div className="wrapper">
<Topnav />
{ this.props.children }
</div>
);
}
}
// REDUX STUFF
// Which props do we want to inject, given the global state?
function select(state) {
return {
data: state
};
}
// Wrap the component to inject dispatch and state into it
export default connect(select)(App);
|
ajax/libs/jquery/1.8.3/jquery.js
|
dakshshah96/cdnjs
|
/*!
* jQuery JavaScript Library v1.8.3
* http://jquery.com/
*
* Includes Sizzle.js
* http://sizzlejs.com/
*
* Copyright 2012 jQuery Foundation and other contributors
* Released under the MIT license
* http://jquery.org/license
*
* Date: Tue Nov 13 2012 08:20:33 GMT-0500 (Eastern Standard Time)
*/
(function( window, undefined ) {
var
// A central reference to the root jQuery(document)
rootjQuery,
// The deferred used on DOM ready
readyList,
// Use the correct document accordingly with window argument (sandbox)
document = window.document,
location = window.location,
navigator = window.navigator,
// Map over jQuery in case of overwrite
_jQuery = window.jQuery,
// Map over the $ in case of overwrite
_$ = window.$,
// Save a reference to some core methods
core_push = Array.prototype.push,
core_slice = Array.prototype.slice,
core_indexOf = Array.prototype.indexOf,
core_toString = Object.prototype.toString,
core_hasOwn = Object.prototype.hasOwnProperty,
core_trim = String.prototype.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 detecting and trimming whitespace
core_rnotwhite = /\S/,
core_rspace = /\s+/,
// 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)
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*\.|)\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 and self cleanup method
DOMContentLoaded = function() {
if ( document.addEventListener ) {
document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
jQuery.ready();
} else if ( document.readyState === "complete" ) {
// we're here because readyState === "complete" in oldIE
// which is good enough for us to call the dom ready!
document.detachEvent( "onreadystatechange", DOMContentLoaded );
jQuery.ready();
}
},
// [[Class]] -> type pairs
class2type = {};
jQuery.fn = jQuery.prototype = {
constructor: jQuery,
init: function( selector, context, rootjQuery ) {
var match, elem, ret, doc;
// Handle $(""), $(null), $(undefined), $(false)
if ( !selector ) {
return this;
}
// Handle $(DOMElement)
if ( selector.nodeType ) {
this.context = this[0] = selector;
this.length = 1;
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;
doc = ( context && context.nodeType ? context.ownerDocument || context : document );
// scripts is true for back-compat
selector = jQuery.parseHTML( match[1], doc, true );
if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
this.attr.call( selector, context, true );
}
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.8.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 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, name, selector ) {
// 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;
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 ) {
// Add the callback
jQuery.ready.promise().done( fn );
return this;
},
eq: function( i ) {
i = +i;
return i === -1 ?
this.slice( i ) :
this.slice( i, i + 1 );
},
first: function() {
return this.eq( 0 );
},
last: function() {
return this.eq( -1 );
},
slice: function() {
return this.pushStack( core_slice.apply( this, arguments ),
"slice", core_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: 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 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 ) {
// 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, 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").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 ) {
return obj == null ?
String( obj ) :
class2type[ core_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 &&
!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
// scripts (optional): If true, will include scripts passed in the html string
parseHTML: function( data, context, scripts ) {
var parsed;
if ( !data || typeof data !== "string" ) {
return null;
}
if ( typeof context === "boolean" ) {
scripts = context;
context = 0;
}
context = context || document;
// Single tag
if ( (parsed = rsingleTag.exec( data )) ) {
return [ context.createElement( parsed[1] ) ];
}
parsed = jQuery.buildFragment( [ data ], context, scripts ? null : [] );
return jQuery.merge( [],
(parsed.cacheable ? jQuery.clone( parsed.fragment ) : parsed.fragment).childNodes );
},
parseJSON: function( data ) {
if ( !data || typeof data !== "string") {
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;
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 && core_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.toLowerCase() === name.toLowerCase();
},
// args is for internal usage only
each: function( obj, callback, args ) {
var name,
i = 0,
length = obj.length,
isObj = length === undefined || jQuery.isFunction( obj );
if ( args ) {
if ( isObj ) {
for ( name in obj ) {
if ( callback.apply( obj[ name ], args ) === false ) {
break;
}
}
} else {
for ( ; i < length; ) {
if ( callback.apply( obj[ i++ ], args ) === false ) {
break;
}
}
}
// A special, fast, case for the most common use of each
} else {
if ( isObj ) {
for ( name in obj ) {
if ( callback.call( obj[ name ], name, obj[ name ] ) === false ) {
break;
}
}
} else {
for ( ; i < length; ) {
if ( callback.call( obj[ i ], i, obj[ i++ ] ) === 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 type,
ret = results || [];
if ( arr != null ) {
// The window, strings (and functions) also have 'length'
// Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
type = jQuery.type( arr );
if ( arr.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( arr ) ) {
core_push.call( ret, arr );
} else {
jQuery.merge( 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, 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 ) {
var tmp, args, proxy;
if ( typeof context === "string" ) {
tmp = fn[ context ];
context = fn;
fn = tmp;
}
// Quick check to determine if target is callable, in the spec
// this throws a TypeError, but we will just return undefined.
if ( !jQuery.isFunction( fn ) ) {
return undefined;
}
// Simulated bind
args = core_slice.call( arguments, 2 );
proxy = function() {
return fn.apply( context, 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, pass ) {
var exec,
bulk = key == null,
i = 0,
length = elems.length;
// Sets many values
if ( key && typeof key === "object" ) {
for ( i in key ) {
jQuery.access( elems, fn, i, key[i], 1, emptyGet, value );
}
chainable = 1;
// Sets one value
} else if ( value !== undefined ) {
// Optionally, function values get executed if exec is true
exec = pass === undefined && jQuery.isFunction( value );
if ( bulk ) {
// Bulk operations only iterate when executing function values
if ( exec ) {
exec = fn;
fn = function( elem, key, value ) {
return exec.call( jQuery( elem ), value );
};
// Otherwise they run against the entire set
} else {
fn.call( elems, value );
fn = null;
}
}
if ( fn ) {
for (; i < length; i++ ) {
fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
}
}
chainable = 1;
}
return chainable ?
elems :
// Gets
bulk ?
fn.call( elems ) :
length ? fn( elems[0], key ) : emptyGet;
},
now: function() {
return ( new Date() ).getTime();
}
});
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, 1 );
// Standards-based browsers support DOMContentLoaded
} else 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 {
// 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 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 );
}
// 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".split(" "), function(i, name) {
class2type[ "[object " + name + "]" ] = name.toLowerCase();
});
// 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.split( core_rspace ), 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 // Last fire value (for non-forgettable lists)
memory,
// Flag to know if list was already fired
fired,
// Flag to know if list is currently firing
firing,
// First callback to fire (used internally by add and fireWith)
firingStart,
// End of the loop when firing
firingLength,
// Index of currently firing callback (modified by remove if needed)
firingIndex,
// 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;
},
// Control if a given callback is in the list
has: function( fn ) {
return jQuery.inArray( fn, list ) > -1;
},
// 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 = fns[ i ];
// deferred[ done | fail | progress ] for forwarding actions to newDefer
deferred[ tuple[1] ]( jQuery.isFunction( fn ) ?
function() {
var returned = 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 === deferred ? newDefer : this, [ returned ] );
}
} :
newDefer[ action ]
);
});
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 ] = list.fire
deferred[ tuple[0] ] = list.fire;
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,
select,
opt,
input,
fragment,
eventName,
i,
isSupported,
clickFn,
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 = {
// 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,
// Make sure that if no value is specified for a checkbox
// that it defaults to "on".
// (WebKit defaults to "" instead)
checkOn: ( input.value === "on" ),
// Make sure that a selected-by-default option has a working selected property.
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
optSelected: opt.selected,
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
getSetAttribute: div.className !== "t",
// Tests for enctype support on a form (#6743)
enctype: !!document.createElement("form").enctype,
// Makes sure cloning an html5 element does not cause problems
// Where outerHTML is undefined, this still works
html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
// jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode
boxModel: ( document.compatMode === "CSS1Compat" ),
// Will be defined later
submitBubbles: true,
changeBubbles: true,
focusinBubbles: false,
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;
// 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", clickFn = function() {
// Cloning a node shouldn't copy over any
// bound event handlers (IE does this)
support.noCloneEvent = false;
});
div.cloneNode( true ).fireEvent("onclick");
div.detachEvent( "onclick", clickFn );
}
// Check if a radio maintains its value
// after being appended to the DOM
input = document.createElement("input");
input.value = "t";
input.setAttribute( "type", "radio" );
support.radioValue = input.value === "t";
input.setAttribute( "checked", "checked" );
// #11217 - WebKit loses check when the name is after the checked attribute
input.setAttribute( "name", "t" );
div.appendChild( input );
fragment = document.createDocumentFragment();
fragment.appendChild( div.lastChild );
// WebKit doesn't clone checked state correctly in fragments
support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
// Check if a disconnected checkbox will retain its checked
// value of true after appended to the DOM (IE6/7)
support.appendChecked = input.checked;
fragment.removeChild( input );
fragment.appendChild( div );
// Technique from Juriy Zaytsev
// http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
// We only care about the case where non-standard event systems
// are used, namely in IE. Short-circuiting here helps us to
// avoid an eval call (in setAttribute) which can cause CSP
// to go haywire. See: https://developer.mozilla.org/en/Security/CSP
if ( div.attachEvent ) {
for ( i in {
submit: true,
change: true,
focusin: true
}) {
eventName = "on" + i;
isSupported = ( eventName in div );
if ( !isSupported ) {
div.setAttribute( eventName, "return;" );
isSupported = ( typeof div[ eventName ] === "function" );
}
support[ i + "Bubbles" ] = isSupported;
}
}
// Run tests that need a body at doc ready
jQuery(function() {
var container, div, tds, marginDiv,
divReset = "padding:0;margin:0;border:0;display:block;overflow:hidden;",
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 = "visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px";
body.insertBefore( container, body.firstChild );
// Construct the test element
div = document.createElement("div");
container.appendChild( div );
// Check if table cells still have offsetWidth/Height when they are set
// to display:none and there are still other visible table cells in a
// table row; if so, offsetWidth/Height are not reliable for use when
// determining if an element has been hidden directly using
// display:none (it is still safe to use offsets if a parent element is
// hidden; don safety goggles and see bug #4512 for more information).
// (only IE 8 fails this test)
div.innerHTML = "<table><tr><td></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";
// Check if empty table cells still have offsetWidth/Height
// (IE <= 8 fail this test)
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 );
// NOTE: To any future maintainer, we've 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. For more
// info see bug #3333
// Fails in WebKit before Feb 2011 nightlies
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
marginDiv = document.createElement("div");
marginDiv.style.cssText = div.style.cssText = divReset;
marginDiv.style.marginRight = marginDiv.style.width = "0";
div.style.width = "1px";
div.appendChild( marginDiv );
support.reliableMarginRight =
!parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
}
if ( typeof div.style.zoom !== "undefined" ) {
// Check if natively block-level elements act like inline-block
// elements when setting their display to 'inline' and giving
// them layout
// (IE < 8 does this)
div.innerHTML = "";
div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
// Check if elements with layout shrink-wrap their children
// (IE 6 does this)
div.style.display = "block";
div.style.overflow = "visible";
div.innerHTML = "<div></div>";
div.firstChild.style.width = "5px";
support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
container.style.zoom = 1;
}
// Null elements to avoid leaks in IE
body.removeChild( container );
container = div = tds = marginDiv = null;
});
// Null elements to avoid leaks in IE
fragment.removeChild( div );
all = a = select = opt = input = fragment = div = null;
return support;
})();
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
rmultiDash = /([A-Z])/g;
jQuery.extend({
cache: {},
deletedIds: [],
// Remove at next major release (1.9/2.0)
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[ 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 = jQuery.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;
},
removeData: function( elem, name, pvt /* Internal Use Only */ ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
var thisCache, i, l,
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(" ");
}
}
}
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;
}
},
// 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 ) {
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 parts, part, attr, name, l,
elem = this[0],
i = 0,
data = null;
// Gets all values
if ( key === undefined ) {
if ( this.length ) {
data = jQuery.data( elem );
if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
attr = elem.attributes;
for ( l = attr.length; i < l; i++ ) {
name = attr[i].name;
if ( !name.indexOf( "data-" ) ) {
name = jQuery.camelCase( name.substring(5) );
dataAttr( elem, name, data[ name ] );
}
}
jQuery._data( elem, "parsedAttrs", true );
}
}
return data;
}
// Sets multiple values
if ( typeof key === "object" ) {
return this.each(function() {
jQuery.data( this, key );
});
}
parts = key.split( ".", 2 );
parts[1] = parts[1] ? "." + parts[1] : "";
part = parts[1] + "!";
return jQuery.access( this, function( value ) {
if ( value === undefined ) {
data = this.triggerHandler( "getData" + part, [ parts[0] ] );
// Try to fetch any internally stored data first
if ( data === undefined && elem ) {
data = jQuery.data( elem, key );
data = dataAttr( elem, key, data );
}
return data === undefined && parts[1] ?
this.data( parts[0] ) :
data;
}
parts[1] = value;
this.each(function() {
var self = jQuery( this );
self.triggerHandler( "setData" + part, parts );
jQuery.data( this, key, value );
self.triggerHandler( "changeData" + part, parts );
});
}, null, value, arguments.length > 1, null, false );
},
removeData: function( key ) {
return this.each(function() {
jQuery.removeData( this, key );
});
}
});
function dataAttr( elem, key, data ) {
// If nothing was found internally, try to fetch any
// data from the HTML5 data-* attribute
if ( data === undefined && elem.nodeType === 1 ) {
var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
data = elem.getAttribute( name );
if ( typeof data === "string" ) {
try {
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
// Only convert to a number if it doesn't change the string
+data + "" === data ? +data :
rbrace.test( data ) ? jQuery.parseJSON( data ) :
data;
} catch( e ) {}
// Make sure we set the data so it isn't changed later
jQuery.data( elem, key, data );
} else {
data = undefined;
}
}
return data;
}
// checks a cache object for emptiness
function isEmptyDataObject( obj ) {
var name;
for ( name in obj ) {
// if the public data object is empty, the private is still empty
if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
continue;
}
if ( name !== "toJSON" ) {
return false;
}
}
return true;
}
jQuery.extend({
queue: function( elem, type, data ) {
var queue;
if ( elem ) {
type = ( type || "fx" ) + "queue";
queue = jQuery._data( elem, type );
// Speed up dequeue by getting out quickly if this is just a lookup
if ( data ) {
if ( !queue || jQuery.isArray(data) ) {
queue = jQuery._data( elem, type, jQuery.makeArray(data) );
} else {
queue.push( data );
}
}
return queue || [];
}
},
dequeue: function( elem, type ) {
type = type || "fx";
var queue = jQuery.queue( elem, type ),
startLength = queue.length,
fn = queue.shift(),
hooks = jQuery._queueHooks( elem, type ),
next = function() {
jQuery.dequeue( elem, type );
};
// If the fx queue is dequeued, always remove the progress sentinel
if ( fn === "inprogress" ) {
fn = queue.shift();
startLength--;
}
if ( fn ) {
// Add a progress sentinel to prevent the fx queue from being
// automatically dequeued
if ( type === "fx" ) {
queue.unshift( "inprogress" );
}
// clear up the last queue stop function
delete hooks.stop;
fn.call( elem, next, hooks );
}
if ( !startLength && hooks ) {
hooks.empty.fire();
}
},
// not intended for public consumption - generates a queueHooks object, or returns the current one
_queueHooks: function( elem, type ) {
var key = type + "queueHooks";
return jQuery._data( elem, key ) || jQuery._data( elem, key, {
empty: jQuery.Callbacks("once memory").add(function() {
jQuery.removeData( elem, type + "queue", true );
jQuery.removeData( elem, key, true );
})
});
}
});
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, fixSpecified,
rclass = /[\t\r\n]/g,
rreturn = /\r/g,
rtype = /^(?:button|input)$/i,
rfocusable = /^(?:button|input|object|select|textarea)$/i,
rclickable = /^a(?:rea|)$/i,
rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
getSetAttribute = jQuery.support.getSetAttribute;
jQuery.fn.extend({
attr: function( name, value ) {
return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
},
removeAttr: function( name ) {
return this.each(function() {
jQuery.removeAttr( this, name );
});
},
prop: function( name, value ) {
return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
},
removeProp: function( name ) {
name = jQuery.propFix[ name ] || name;
return this.each(function() {
// try/catch handles cases where IE balks (such as removing a property on window)
try {
this[ name ] = undefined;
delete this[ name ];
} catch( e ) {}
});
},
addClass: function( value ) {
var classNames, i, l, elem,
setClass, c, cl;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).addClass( value.call(this, j, this.className) );
});
}
if ( value && typeof value === "string" ) {
classNames = value.split( core_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 ] + " " ) < 0 ) {
setClass += classNames[ c ] + " ";
}
}
elem.className = jQuery.trim( setClass );
}
}
}
}
return this;
},
removeClass: function( value ) {
var removes, className, elem, c, cl, i, l;
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 ) {
removes = ( value || "" ).split( core_rspace );
for ( i = 0, l = this.length; i < l; i++ ) {
elem = this[ i ];
if ( elem.nodeType === 1 && elem.className ) {
className = (" " + elem.className + " ").replace( rclass, " " );
// loop over each item in the removal list
for ( c = 0, cl = removes.length; c < cl; c++ ) {
// Remove until there is nothing to remove,
while ( className.indexOf(" " + removes[ c ] + " ") >= 0 ) {
className = className.replace( " " + removes[ c ] + " " , " " );
}
}
elem.className = value ? jQuery.trim( 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( core_rspace );
while ( (className = classNames[ i++ ]) ) {
// check each className given, space separated list
state = isBool ? state : !self.hasClass( className );
self[ state ? "addClass" : "removeClass" ]( className );
}
} else if ( type === "undefined" || type === "boolean" ) {
if ( this.className ) {
// store className if set
jQuery._data( this, "__className__", this.className );
}
// toggle whole className
this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
}
});
},
hasClass: function( selector ) {
var className = " " + selector + " ",
i = 0,
l = this.length;
for ( ; i < l; i++ ) {
if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
return true;
}
}
return false;
},
val: function( value ) {
var hooks, ret, isFunction,
elem = this[0];
if ( !arguments.length ) {
if ( elem ) {
hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
return ret;
}
ret = elem.value;
return typeof ret === "string" ?
// handle most common string cases
ret.replace(rreturn, "") :
// handle cases where value is null/undef or number
ret == null ? "" : ret;
}
return;
}
isFunction = jQuery.isFunction( value );
return this.each(function( i ) {
var 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;
}
}
},
// Unused in 1.8, left in so attrFn-stabbers won't die; remove in 1.9
attrFn: {},
attr: function( elem, name, value, pass ) {
var ret, hooks, notxml,
nType = elem.nodeType;
// don't get/set attributes on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return;
}
if ( pass && jQuery.isFunction( jQuery.fn[ name ] ) ) {
return jQuery( elem )[ name ]( value );
}
// Fallback to prop when attributes are not supported
if ( typeof elem.getAttribute === "undefined" ) {
return jQuery.prop( elem, name, value );
}
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
// All attributes are lowercase
// Grab necessary hook if one is defined
if ( notxml ) {
name = name.toLowerCase();
hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
}
if ( value !== undefined ) {
if ( value === null ) {
jQuery.removeAttr( elem, name );
return;
} else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret;
} else {
elem.setAttribute( name, value + "" );
return value;
}
} else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {
return ret;
} else {
ret = elem.getAttribute( name );
// Non-existent attributes return null, we normalize to undefined
return ret === null ?
undefined :
ret;
}
},
removeAttr: function( elem, value ) {
var propName, attrNames, name, isBool,
i = 0;
if ( value && elem.nodeType === 1 ) {
attrNames = value.split( core_rspace );
for ( ; i < attrNames.length; i++ ) {
name = attrNames[ i ];
if ( name ) {
propName = jQuery.propFix[ name ] || name;
isBool = rboolean.test( name );
// See #9699 for explanation of this approach (setting first, then removal)
// Do not do this for boolean attributes (see #10870)
if ( !isBool ) {
jQuery.attr( elem, name, "" );
}
elem.removeAttribute( getSetAttribute ? name : propName );
// Set corresponding property to false for boolean attributes
if ( isBool && propName in elem ) {
elem[ propName ] = false;
}
}
}
}
},
attrHooks: {
type: {
set: function( elem, value ) {
// We can't allow the type property to be changed (since it causes problems in IE)
if ( rtype.test( elem.nodeName ) && elem.parentNode ) {
jQuery.error( "type property can't be changed" );
} else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
// Setting the type on a radio button after the value resets the value in IE6-9
// Reset value to it's default in case type is set after value
// This is for element creation
var val = elem.value;
elem.setAttribute( "type", value );
if ( val ) {
elem.value = val;
}
return value;
}
}
},
// Use the value property for back compat
// Use the nodeHook for button elements in IE6/7 (#1954)
value: {
get: function( elem, name ) {
if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
return nodeHook.get( elem, name );
}
return name in elem ?
elem.value :
null;
},
set: function( elem, value, name ) {
if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
return nodeHook.set( elem, value, name );
}
// Does not return so that setAttribute is also used
elem.value = value;
}
}
},
propFix: {
tabindex: "tabIndex",
readonly: "readOnly",
"for": "htmlFor",
"class": "className",
maxlength: "maxLength",
cellspacing: "cellSpacing",
cellpadding: "cellPadding",
rowspan: "rowSpan",
colspan: "colSpan",
usemap: "useMap",
frameborder: "frameBorder",
contenteditable: "contentEditable"
},
prop: function( elem, name, value ) {
var ret, hooks, notxml,
nType = elem.nodeType;
// don't get/set properties on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return;
}
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
if ( notxml ) {
// Fix name and attach hooks
name = jQuery.propFix[ name ] || name;
hooks = jQuery.propHooks[ name ];
}
if ( value !== undefined ) {
if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret;
} else {
return ( elem[ name ] = value );
}
} else {
if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
return ret;
} else {
return elem[ name ];
}
}
},
propHooks: {
tabIndex: {
get: function( elem ) {
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
var attributeNode = elem.getAttributeNode("tabindex");
return attributeNode && attributeNode.specified ?
parseInt( attributeNode.value, 10 ) :
rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
0 :
undefined;
}
}
}
});
// Hook for boolean attributes
boolHook = {
get: function( elem, name ) {
// Align boolean attributes with corresponding properties
// Fall back to attribute presence where some booleans are not supported
var attrNode,
property = jQuery.prop( elem, name );
return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
name.toLowerCase() :
undefined;
},
set: function( elem, value, name ) {
var propName;
if ( value === false ) {
// Remove boolean attributes when set to false
jQuery.removeAttr( elem, name );
} else {
// value is true since we know at this point it's type boolean and not false
// Set boolean attributes to the same name and set the DOM property
propName = jQuery.propFix[ name ] || name;
if ( propName in elem ) {
// Only set the IDL specifically if it already exists on the element
elem[ propName ] = true;
}
elem.setAttribute( name, name.toLowerCase() );
}
return name;
}
};
// IE6/7 do not support getting/setting some attributes with get/setAttribute
if ( !getSetAttribute ) {
fixSpecified = {
name: true,
id: true,
coords: true
};
// Use this for any attribute in IE6/7
// This fixes almost every IE6/7 issue
nodeHook = jQuery.valHooks.button = {
get: function( elem, name ) {
var ret;
ret = elem.getAttributeNode( name );
return ret && ( fixSpecified[ name ] ? ret.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 ) {
ret = document.createAttribute( name );
elem.setAttributeNode( ret );
}
return ( ret.value = 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;
}
}
});
});
// Set contenteditable to false on removals(#10429)
// Setting to empty string throws an error as an invalid value
jQuery.attrHooks.contenteditable = {
get: nodeHook.get,
set: function( elem, value, name ) {
if ( value === "" ) {
value = "false";
}
nodeHook.set( elem, value, name );
}
};
}
// Some attributes require a special call on IE
if ( !jQuery.support.hrefNormalized ) {
jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
get: function( elem ) {
var ret = elem.getAttribute( name, 2 );
return ret === null ? undefined : ret;
}
});
});
}
if ( !jQuery.support.style ) {
jQuery.attrHooks.style = {
get: function( elem ) {
// Return undefined in the case of empty string
// Normalize to lowercase since IE uppercases css property names
return elem.style.cssText.toLowerCase() || undefined;
},
set: function( elem, value ) {
return ( elem.style.cssText = value + "" );
}
};
}
// Safari mis-reports the default selected property of an option
// Accessing the parent's selectedIndex property fixes it
if ( !jQuery.support.optSelected ) {
jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
get: function( elem ) {
var parent = elem.parentNode;
if ( parent ) {
parent.selectedIndex;
// Make sure that it also works with optgroups, see #5701
if ( parent.parentNode ) {
parent.parentNode.selectedIndex;
}
}
return null;
}
});
}
// IE6/7 call enctype encoding
if ( !jQuery.support.enctype ) {
jQuery.propFix.enctype = "encoding";
}
// Radios and checkboxes getter/setter
if ( !jQuery.support.checkOn ) {
jQuery.each([ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = {
get: function( elem ) {
// Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
return elem.getAttribute("value") === null ? "on" : elem.value;
}
};
});
}
jQuery.each([ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
set: function( elem, value ) {
if ( jQuery.isArray( value ) ) {
return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
}
}
});
});
var rformElems = /^(?:textarea|input|select)$/i,
rtypenamespace = /^([^\.]*|)(?:\.(.+)|)$/,
rhoverHack = /(?:^|\s)hover(\.\S+|)\b/,
rkeyEvent = /^key/,
rmouseEvent = /^(?:mouse|contextmenu)|click/,
rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
hoverHack = function( events ) {
return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
};
/*
* Helper functions for managing events -- not part of the public interface.
* Props to Dean Edwards' addEvent library for many of the ideas.
*/
jQuery.event = {
add: function( elem, types, handler, data, selector ) {
var elemData, eventHandle, events,
t, tns, type, namespaces, handleObj,
handleObjIn, handlers, special;
// Don't attach events to noData or text/comment nodes (allow plain objects tho)
if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) {
return;
}
// Caller can pass in an object of custom data in lieu of the handler
if ( handler.handler ) {
handleObjIn = handler;
handler = handleObjIn.handler;
selector = handleObjIn.selector;
}
// Make sure that the handler has a unique ID, used to find/remove it later
if ( !handler.guid ) {
handler.guid = jQuery.guid++;
}
// Init the element's event structure and main handler, if this is the first
events = elemData.events;
if ( !events ) {
elemData.events = events = {};
}
eventHandle = elemData.handle;
if ( !eventHandle ) {
elemData.handle = eventHandle = function( e ) {
// Discard the second event of a jQuery.event.trigger() and
// when an event is called after a page has unloaded
return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
undefined;
};
// Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
eventHandle.elem = elem;
}
// Handle multiple events separated by a space
// jQuery(...).bind("mouseover mouseout", fn);
types = jQuery.trim( hoverHack(types) ).split( " " );
for ( t = 0; t < types.length; t++ ) {
tns = rtypenamespace.exec( types[t] ) || [];
type = tns[1];
namespaces = ( tns[2] || "" ).split( "." ).sort();
// If event changes its type, use the special event handlers for the changed type
special = jQuery.event.special[ type ] || {};
// If selector defined, determine special event api type, otherwise given type
type = ( selector ? special.delegateType : special.bindType ) || type;
// Update special based on newly reset type
special = jQuery.event.special[ type ] || {};
// handleObj is passed to all event handlers
handleObj = jQuery.extend({
type: type,
origType: tns[1],
data: data,
handler: handler,
guid: handler.guid,
selector: selector,
needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
namespace: namespaces.join(".")
}, handleObjIn );
// Init the event handler queue if we're the first
handlers = events[ type ];
if ( !handlers ) {
handlers = events[ type ] = [];
handlers.delegateCount = 0;
// Only use addEventListener/attachEvent if the special events handler returns false
if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
// Bind the global event handler to the element
if ( elem.addEventListener ) {
elem.addEventListener( type, eventHandle, false );
} else if ( elem.attachEvent ) {
elem.attachEvent( "on" + type, eventHandle );
}
}
}
if ( special.add ) {
special.add.call( elem, handleObj );
if ( !handleObj.handler.guid ) {
handleObj.handler.guid = handler.guid;
}
}
// Add to the element's handler list, delegates in front
if ( selector ) {
handlers.splice( handlers.delegateCount++, 0, handleObj );
} else {
handlers.push( handleObj );
}
// Keep track of which events have ever been used, for event optimization
jQuery.event.global[ type ] = true;
}
// Nullify elem to prevent memory leaks in IE
elem = null;
},
global: {},
// Detach an event or set of events from an element
remove: function( elem, types, handler, selector, mappedTypes ) {
var t, tns, type, origType, namespaces, origCount,
j, events, special, eventType, handleObj,
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 = jQuery.trim( hoverHack( types || "" ) ).split(" ");
for ( t = 0; t < types.length; t++ ) {
tns = rtypenamespace.exec( types[t] ) || [];
type = origType = tns[1];
namespaces = tns[2];
// Unbind all events (on this namespace, if provided) for the element
if ( !type ) {
for ( type in events ) {
jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
}
continue;
}
special = jQuery.event.special[ type ] || {};
type = ( selector? special.delegateType : special.bindType ) || type;
eventType = events[ type ] || [];
origCount = eventType.length;
namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
// Remove matching events
for ( j = 0; j < eventType.length; j++ ) {
handleObj = eventType[ j ];
if ( ( mappedTypes || origType === handleObj.origType ) &&
( !handler || handler.guid === handleObj.guid ) &&
( !namespaces || namespaces.test( handleObj.namespace ) ) &&
( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
eventType.splice( j--, 1 );
if ( handleObj.selector ) {
eventType.delegateCount--;
}
if ( special.remove ) {
special.remove.call( elem, handleObj );
}
}
}
// Remove generic event handler if we removed something and no more handlers exist
// (avoids potential for endless recursion during removal of special event handlers)
if ( eventType.length === 0 && origCount !== eventType.length ) {
if ( !special.teardown || special.teardown.call( elem, namespaces, 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", true );
}
},
// Events that are safe to short-circuit if no handlers are attached.
// Native DOM events should not be added, they may have inline handlers.
customEvent: {
"getData": true,
"setData": true,
"changeData": true
},
trigger: function( event, data, elem, onlyHandlers ) {
// Don't do events on text and comment nodes
if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) {
return;
}
// Event object or event type
var cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType,
type = event.type || event,
namespaces = [];
// focus/blur morphs to focusin/out; ensure we're not firing them right now
if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
return;
}
if ( type.indexOf( "!" ) >= 0 ) {
// Exclusive events trigger only for the exact event (no namespaces)
type = type.slice(0, -1);
exclusive = true;
}
if ( type.indexOf( "." ) >= 0 ) {
// Namespaced trigger; create a regexp to match event type in handle()
namespaces = type.split(".");
type = namespaces.shift();
namespaces.sort();
}
if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) {
// No jQuery handlers for this event type, and it can't have inline handlers
return;
}
// Caller can pass in an Event, Object, or just an event type string
event = typeof event === "object" ?
// jQuery.Event object
event[ jQuery.expando ] ? event :
// Object literal
new jQuery.Event( type, event ) :
// Just the event type (string)
new jQuery.Event( type );
event.type = type;
event.isTrigger = true;
event.exclusive = exclusive;
event.namespace = namespaces.join( "." );
event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
ontype = type.indexOf( ":" ) < 0 ? "on" + type : "";
// Handle a global trigger
if ( !elem ) {
// TODO: Stop taunting the data cache; remove global events and always attach to document
cache = jQuery.cache;
for ( i in cache ) {
if ( cache[ i ].events && cache[ i ].events[ type ] ) {
jQuery.event.trigger( event, data, cache[ i ].handle.elem, true );
}
}
return;
}
// Clean up the event in case it is being reused
event.result = undefined;
if ( !event.target ) {
event.target = elem;
}
// Clone any incoming data and prepend the event, creating the handler arg list
data = data != null ? jQuery.makeArray( data ) : [];
data.unshift( event );
// Allow special events to draw outside the lines
special = jQuery.event.special[ type ] || {};
if ( special.trigger && special.trigger.apply( elem, data ) === false ) {
return;
}
// Determine event propagation path in advance, per W3C events spec (#9951)
// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
eventPath = [[ elem, special.bindType || type ]];
if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
bubbleType = special.delegateType || type;
cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode;
for ( old = elem; cur; cur = cur.parentNode ) {
eventPath.push([ cur, bubbleType ]);
old = cur;
}
// Only add window if we got to document (e.g., not plain obj or detached DOM)
if ( old === (elem.ownerDocument || document) ) {
eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]);
}
}
// Fire handlers on the event path
for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) {
cur = eventPath[i][0];
event.type = eventPath[i][1];
handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
if ( handle ) {
handle.apply( cur, data );
}
// Note that this is a bare JS function and not a jQuery handler
handle = ontype && cur[ ontype ];
if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) {
event.preventDefault();
}
}
event.type = type;
// If nobody prevented the default action, do it now
if ( !onlyHandlers && !event.isDefaultPrevented() ) {
if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
!(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
// Call a native DOM method on the target with the same name name as the event.
// Can't use an .isFunction() check here because IE6/7 fails that test.
// Don't do default actions on window, that's where global variables be (#6170)
// IE<9 dies on focus/blur to hidden element (#1486)
if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) {
// Don't re-trigger an onFOO event when we call its FOO() method
old = elem[ ontype ];
if ( old ) {
elem[ ontype ] = null;
}
// Prevent re-triggering of the same event, since we already bubbled it above
jQuery.event.triggered = type;
elem[ type ]();
jQuery.event.triggered = undefined;
if ( old ) {
elem[ ontype ] = old;
}
}
}
}
return event.result;
},
dispatch: function( event ) {
// Make a writable jQuery.Event from the native event object
event = jQuery.event.fix( event || window.event );
var i, j, cur, ret, selMatch, matched, matches, handleObj, sel, related,
handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []),
delegateCount = handlers.delegateCount,
args = core_slice.call( arguments ),
run_all = !event.exclusive && !event.namespace,
special = jQuery.event.special[ event.type ] || {},
handlerQueue = [];
// Use the fix-ed jQuery.Event rather than the (read-only) native event
args[0] = event;
event.delegateTarget = this;
// Call the preDispatch hook for the mapped type, and let it bail if desired
if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
return;
}
// Determine handlers that should run if there are delegated events
// Avoid non-left-click bubbling in Firefox (#3861)
if ( delegateCount && !(event.button && event.type === "click") ) {
for ( cur = event.target; cur != this; cur = cur.parentNode || this ) {
// Don't process clicks (ONLY) on disabled elements (#6911, #8165, #11382, #11764)
if ( cur.disabled !== true || event.type !== "click" ) {
selMatch = {};
matches = [];
for ( i = 0; i < delegateCount; i++ ) {
handleObj = handlers[ i ];
sel = handleObj.selector;
if ( selMatch[ sel ] === undefined ) {
selMatch[ sel ] = handleObj.needsContext ?
jQuery( sel, this ).index( cur ) >= 0 :
jQuery.find( sel, this, null, [ cur ] ).length;
}
if ( selMatch[ sel ] ) {
matches.push( handleObj );
}
}
if ( matches.length ) {
handlerQueue.push({ elem: cur, matches: matches });
}
}
}
}
// Add the remaining (directly-bound) handlers
if ( handlers.length > delegateCount ) {
handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) });
}
// Run delegates first; they may want to stop propagation beneath us
for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) {
matched = handlerQueue[ i ];
event.currentTarget = matched.elem;
for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) {
handleObj = matched.matches[ j ];
// Triggered event must either 1) be non-exclusive and have no namespace, or
// 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) {
event.data = handleObj.data;
event.handleObj = handleObj;
ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
.apply( matched.elem, args );
if ( ret !== undefined ) {
event.result = ret;
if ( ret === false ) {
event.preventDefault();
event.stopPropagation();
}
}
}
}
}
// Call the postDispatch hook for the mapped type
if ( special.postDispatch ) {
special.postDispatch.call( this, event );
}
return event.result;
},
// Includes some event props shared by KeyEvent and MouseEvent
// *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 ***
props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
fixHooks: {},
keyHooks: {
props: "char charCode key keyCode".split(" "),
filter: function( event, original ) {
// Add which for key events
if ( event.which == null ) {
event.which = original.charCode != null ? original.charCode : original.keyCode;
}
return event;
}
},
mouseHooks: {
props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
filter: function( event, original ) {
var eventDoc, doc, body,
button = original.button,
fromElement = original.fromElement;
// Calculate pageX/Y if missing and clientX/Y available
if ( event.pageX == null && original.clientX != null ) {
eventDoc = event.target.ownerDocument || document;
doc = eventDoc.documentElement;
body = eventDoc.body;
event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
}
// Add relatedTarget, if necessary
if ( !event.relatedTarget && fromElement ) {
event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
}
// Add which for click: 1 === left; 2 === middle; 3 === right
// Note: button is not normalized, so don't use it
if ( !event.which && button !== undefined ) {
event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
}
return event;
}
},
fix: function( event ) {
if ( event[ jQuery.expando ] ) {
return event;
}
// Create a writable copy of the event object and normalize some properties
var i, prop,
originalEvent = event,
fixHook = jQuery.event.fixHooks[ event.type ] || {},
copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
event = jQuery.Event( originalEvent );
for ( i = copy.length; i; ) {
prop = copy[ --i ];
event[ prop ] = originalEvent[ prop ];
}
// Fix target property, if necessary (#1925, IE 6/7/8 & Safari2)
if ( !event.target ) {
event.target = originalEvent.srcElement || document;
}
// Target should not be a text node (#504, Safari)
if ( event.target.nodeType === 3 ) {
event.target = event.target.parentNode;
}
// For mouse/key events, metaKey==false if it's undefined (#3368, #11328; IE6/7/8)
event.metaKey = !!event.metaKey;
return fixHook.filter? fixHook.filter( event, originalEvent ) : event;
},
special: {
load: {
// Prevent triggered image.load events from bubbling to window.load
noBubble: true
},
focus: {
delegateType: "focusin"
},
blur: {
delegateType: "focusout"
},
beforeunload: {
setup: function( data, namespaces, eventHandle ) {
// We only want to do this special case on windows
if ( jQuery.isWindow( this ) ) {
this.onbeforeunload = eventHandle;
}
},
teardown: function( namespaces, eventHandle ) {
if ( this.onbeforeunload === eventHandle ) {
this.onbeforeunload = null;
}
}
}
},
simulate: function( type, elem, event, bubble ) {
// Piggyback on a donor event to simulate a different one.
// Fake originalEvent to avoid donor's stopPropagation, but if the
// simulated event prevents default then we do the same on the donor.
var e = jQuery.extend(
new jQuery.Event(),
event,
{ type: type,
isSimulated: true,
originalEvent: {}
}
);
if ( bubble ) {
jQuery.event.trigger( e, null, elem );
} else {
jQuery.event.dispatch.call( elem, e );
}
if ( e.isDefaultPrevented() ) {
event.preventDefault();
}
}
};
// Some plugins are using, but it's undocumented/deprecated and will be removed.
// The 1.7 special event interface should provide all the hooks needed now.
jQuery.event.handle = jQuery.event.dispatch;
jQuery.removeEvent = document.removeEventListener ?
function( elem, type, handle ) {
if ( elem.removeEventListener ) {
elem.removeEventListener( type, handle, false );
}
} :
function( elem, type, handle ) {
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 ] === "undefined" ) {
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;
};
function returnFalse() {
return false;
}
function returnTrue() {
return true;
}
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
jQuery.Event.prototype = {
preventDefault: function() {
this.isDefaultPrevented = returnTrue;
var e = this.originalEvent;
if ( !e ) {
return;
}
// if preventDefault exists run it on the original event
if ( e.preventDefault ) {
e.preventDefault();
// otherwise set the returnValue property of the original event to false (IE)
} else {
e.returnValue = false;
}
},
stopPropagation: function() {
this.isPropagationStopped = returnTrue;
var e = this.originalEvent;
if ( !e ) {
return;
}
// if stopPropagation exists run it on the original event
if ( e.stopPropagation ) {
e.stopPropagation();
}
// otherwise set the cancelBubble property of the original event to true (IE)
e.cancelBubble = true;
},
stopImmediatePropagation: function() {
this.isImmediatePropagationStopped = returnTrue;
this.stopPropagation();
},
isDefaultPrevented: returnFalse,
isPropagationStopped: returnFalse,
isImmediatePropagationStopped: returnFalse
};
// Create mouseenter/leave events using mouseover/out and event-time checks
jQuery.each({
mouseenter: "mouseover",
mouseleave: "mouseout"
}, function( orig, fix ) {
jQuery.event.special[ orig ] = {
delegateType: fix,
bindType: fix,
handle: function( event ) {
var ret,
target = this,
related = event.relatedTarget,
handleObj = event.handleObj,
selector = handleObj.selector;
// 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, "_submit_attached" ) ) {
jQuery.event.add( form, "submit._submit", function( event ) {
event._submit_bubble = true;
});
jQuery._data( form, "_submit_attached", true );
}
});
// return undefined since we don't need an event listener
},
postDispatch: function( event ) {
// If form was submitted by the user, bubble the event up the tree
if ( event._submit_bubble ) {
delete event._submit_bubble;
if ( this.parentNode && !event.isTrigger ) {
jQuery.event.simulate( "submit", this.parentNode, event, true );
}
}
},
teardown: function() {
// Only need this for delegated form submit events
if ( jQuery.nodeName( this, "form" ) ) {
return false;
}
// Remove delegated handlers; cleanData eventually reaps submit handlers attached above
jQuery.event.remove( this, "._submit" );
}
};
}
// IE change delegation and checkbox/radio fix
if ( !jQuery.support.changeBubbles ) {
jQuery.event.special.change = {
setup: function() {
if ( rformElems.test( this.nodeName ) ) {
// IE doesn't fire change on a check/radio until blur; trigger it on click
// after a propertychange. Eat the blur-change in special.change.handle.
// This still fires onchange a second time for check/radio after blur.
if ( this.type === "checkbox" || this.type === "radio" ) {
jQuery.event.add( this, "propertychange._change", function( event ) {
if ( event.originalEvent.propertyName === "checked" ) {
this._just_changed = true;
}
});
jQuery.event.add( this, "click._change", function( event ) {
if ( this._just_changed && !event.isTrigger ) {
this._just_changed = false;
}
// 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, "_change_attached" ) ) {
jQuery.event.add( elem, "change._change", function( event ) {
if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
jQuery.event.simulate( "change", this.parentNode, event, true );
}
});
jQuery._data( elem, "_change_attached", true );
}
});
},
handle: function( event ) {
var elem = event.target;
// Swallow native change events from checkbox/radio, we already triggered them above
if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
return event.handleObj.handler.apply( this, arguments );
}
},
teardown: function() {
jQuery.event.remove( this, "._change" );
return !rformElems.test( this.nodeName );
}
};
}
// Create "bubbling" focus and blur events
if ( !jQuery.support.focusinBubbles ) {
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
// Attach a single capturing handler while someone wants focusin/focusout
var attaches = 0,
handler = function( event ) {
jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
};
jQuery.event.special[ fix ] = {
setup: function() {
if ( attaches++ === 0 ) {
document.addEventListener( orig, handler, true );
}
},
teardown: function() {
if ( --attaches === 0 ) {
document.removeEventListener( orig, handler, true );
}
}
};
});
}
jQuery.fn.extend({
on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
var origFn, type;
// Types can be a map of types/handlers
if ( typeof types === "object" ) {
// ( types-Object, selector, data )
if ( typeof selector !== "string" ) { // && selector != null
// ( types-Object, data )
data = data || selector;
selector = undefined;
}
for ( type in types ) {
this.on( type, selector, data, types[ type ], one );
}
return this;
}
if ( data == null && fn == null ) {
// ( types, fn )
fn = selector;
data = selector = undefined;
} else if ( fn == null ) {
if ( typeof selector === "string" ) {
// ( types, selector, fn )
fn = data;
data = undefined;
} else {
// ( types, data, fn )
fn = data;
data = selector;
selector = undefined;
}
}
if ( fn === false ) {
fn = returnFalse;
} else if ( !fn ) {
return this;
}
if ( one === 1 ) {
origFn = fn;
fn = function( event ) {
// Can use an empty set, since event contains the info
jQuery().off( event );
return origFn.apply( this, arguments );
};
// Use same guid so caller can remove using origFn
fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
}
return this.each( function() {
jQuery.event.add( this, types, fn, data, selector );
});
},
one: function( types, selector, data, fn ) {
return this.on( types, selector, data, fn, 1 );
},
off: function( types, selector, fn ) {
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 );
},
live: function( types, data, fn ) {
jQuery( this.context ).on( types, this.selector, data, fn );
return this;
},
die: function( types, fn ) {
jQuery( this.context ).off( types, this.selector || "**", fn );
return this;
},
delegate: function( selector, types, data, fn ) {
return this.on( types, selector, data, fn );
},
undelegate: function( selector, types, fn ) {
// ( namespace ) or ( selector, types [, fn] )
return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
},
trigger: function( type, data ) {
return this.each(function() {
jQuery.event.trigger( type, data, this );
});
},
triggerHandler: function( type, data ) {
if ( this[0] ) {
return jQuery.event.trigger( type, data, this[0], true );
}
},
toggle: function( fn ) {
// Save reference to arguments for access in closure
var args = arguments,
guid = fn.guid || jQuery.guid++,
i = 0,
toggler = function( event ) {
// Figure out which function to execute
var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
// Make sure that clicks stop
event.preventDefault();
// and execute the function
return args[ lastToggle ].apply( this, arguments ) || false;
};
// link all the functions, so any of them can unbind this click handler
toggler.guid = guid;
while ( i < args.length ) {
args[ i++ ].guid = guid;
}
return this.click( toggler );
},
hover: function( fnOver, fnOut ) {
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
}
});
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
"change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
// Handle event binding
jQuery.fn[ name ] = function( data, fn ) {
if ( fn == null ) {
fn = data;
data = null;
}
return arguments.length > 0 ?
this.on( name, null, data, fn ) :
this.trigger( name );
};
if ( rkeyEvent.test( name ) ) {
jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks;
}
if ( rmouseEvent.test( name ) ) {
jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks;
}
});
/*!
* Sizzle CSS Selector Engine
* Copyright 2012 jQuery Foundation and other contributors
* Released under the MIT license
* http://sizzlejs.com/
*/
(function( window, undefined ) {
var cachedruns,
assertGetIdNotName,
Expr,
getText,
isXML,
contains,
compile,
sortOrder,
hasDuplicate,
outermostContext,
baseHasDuplicate = true,
strundefined = "undefined",
expando = ( "sizcache" + Math.random() ).replace( ".", "" ),
Token = String,
document = window.document,
docElem = document.documentElement,
dirruns = 0,
done = 0,
pop = [].pop,
push = [].push,
slice = [].slice,
// Use a stripped-down indexOf if a native one is unavailable
indexOf = [].indexOf || function( elem ) {
var i = 0,
len = this.length;
for ( ; i < len; i++ ) {
if ( this[i] === elem ) {
return i;
}
}
return -1;
},
// Augment a function for special use by Sizzle
markFunction = function( fn, value ) {
fn[ expando ] = value == null || value;
return fn;
},
createCache = function() {
var cache = {},
keys = [];
return markFunction(function( key, value ) {
// Only keep the most recent entries
if ( keys.push( key ) > Expr.cacheLength ) {
delete cache[ keys.shift() ];
}
// Retrieve with (key + " ") to avoid collision with native Object.prototype properties (see Issue #157)
return (cache[ key + " " ] = value);
}, cache );
},
classCache = createCache(),
tokenCache = createCache(),
compilerCache = createCache(),
// Regex
// 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 not in parens/brackets,
// then attribute selectors and non-pseudos (denoted by :),
// then anything else
// These preferences are here to reduce the number of selectors
// needing tokenize in the PSEUDO preFilter
pseudos = ":(" + characterEncoding + ")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:" + attributes + ")|[^:]|\\\\.)*|.*))\\)|)",
// For matchExpr.POS and matchExpr.needsContext
pos = ":(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace +
"*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)",
// 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 ),
// Easily-parseable/retrievable ID or TAG or CLASS selectors
rquickExpr = /^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,
rnot = /^:not/,
rsibling = /[\x20\t\r\n\f]*[+~]/,
rendsWithNot = /:not\($/,
rheader = /h\d/i,
rinputs = /input|select|textarea|button/i,
rbackslash = /\\(?!\\)/g,
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 ),
"POS": new RegExp( pos, "i" ),
"CHILD": new RegExp( "^:(only|nth|first|last)-child(?:\\(" + whitespace +
"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
"*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
// For use in libraries implementing .is()
"needsContext": new RegExp( "^" + whitespace + "*[>+~]|" + pos, "i" )
},
// Support
// Used for testing something on an element
assert = function( fn ) {
var div = document.createElement("div");
try {
return fn( div );
} catch (e) {
return false;
} finally {
// release memory in IE
div = null;
}
},
// Check if getElementsByTagName("*") returns only elements
assertTagNameNoComments = assert(function( div ) {
div.appendChild( document.createComment("") );
return !div.getElementsByTagName("*").length;
}),
// Check if getAttribute returns normalized href attributes
assertHrefNotNormalized = assert(function( div ) {
div.innerHTML = "<a href='#'></a>";
return div.firstChild && typeof div.firstChild.getAttribute !== strundefined &&
div.firstChild.getAttribute("href") === "#";
}),
// Check if attributes should be retrieved by attribute nodes
assertAttributes = 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
assertUsableClassName = 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
assertUsableName = 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 = document.getElementsByName &&
// buggy browsers will return fewer than the correct 2
document.getElementsByName( expando ).length === 2 +
// buggy browsers will return more than the correct 0
document.getElementsByName( expando + 0 ).length;
assertGetIdNotName = !document.getElementById( expando );
// Cleanup
docElem.removeChild( div );
return pass;
});
// If slice is not available, provide a backup
try {
slice.call( docElem.childNodes, 0 )[0].nodeType;
} catch ( e ) {
slice = function( i ) {
var elem,
results = [];
for ( ; (elem = this[i]); i++ ) {
results.push( elem );
}
return results;
};
}
function Sizzle( selector, context, results, seed ) {
results = results || [];
context = context || document;
var match, elem, xml, m,
nodeType = context.nodeType;
if ( !selector || typeof selector !== "string" ) {
return results;
}
if ( nodeType !== 1 && nodeType !== 9 ) {
return [];
}
xml = isXML( context );
if ( !xml && !seed ) {
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]) && assertUsableClassName && context.getElementsByClassName ) {
push.apply( results, slice.call(context.getElementsByClassName( m ), 0) );
return results;
}
}
}
// All others
return select( selector.replace( rtrim, "$1" ), context, results, seed, xml );
}
Sizzle.matches = function( expr, elements ) {
return Sizzle( expr, null, null, elements );
};
Sizzle.matchesSelector = function( elem, expr ) {
return Sizzle( expr, null, null, [ elem ] ).length > 0;
};
// 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 ( 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
} else {
// If no nodeType, this is expected to be an array
for ( ; (node = elem[i]); i++ ) {
// Do not traverse comment nodes
ret += getText( node );
}
}
return ret;
};
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;
};
// Element contains another
contains = Sizzle.contains = docElem.contains ?
function( a, b ) {
var adown = a.nodeType === 9 ? a.documentElement : a,
bup = b && b.parentNode;
return a === bup || !!( bup && bup.nodeType === 1 && adown.contains && adown.contains(bup) );
} :
docElem.compareDocumentPosition ?
function( a, b ) {
return b && !!( a.compareDocumentPosition( b ) & 16 );
} :
function( a, b ) {
while ( (b = b.parentNode) ) {
if ( b === a ) {
return true;
}
}
return false;
};
Sizzle.attr = function( elem, name ) {
var val,
xml = isXML( elem );
if ( !xml ) {
name = name.toLowerCase();
}
if ( (val = Expr.attrHandle[ name ]) ) {
return val( elem );
}
if ( xml || assertAttributes ) {
return elem.getAttribute( name );
}
val = elem.getAttributeNode( name );
return val ?
typeof elem[ name ] === "boolean" ?
elem[ name ] ? name : null :
val.specified ? val.value : null :
null;
};
Expr = Sizzle.selectors = {
// Can be adjusted by the user
cacheLength: 50,
createPseudo: markFunction,
match: matchExpr,
// IE6/7 return a modified href
attrHandle: assertHrefNotNormalized ?
{} :
{
"href": function( elem ) {
return elem.getAttribute( "href", 2 );
},
"type": function( elem ) {
return elem.getAttribute("type");
}
},
find: {
"ID": assertGetIdNotName ?
function( id, context, xml ) {
if ( typeof context.getElementById !== strundefined && !xml ) {
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] : [];
}
} :
function( id, context, xml ) {
if ( typeof context.getElementById !== strundefined && !xml ) {
var m = context.getElementById( id );
return m ?
m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ?
[m] :
undefined :
[];
}
},
"TAG": assertTagNameNoComments ?
function( tag, context ) {
if ( typeof context.getElementsByTagName !== strundefined ) {
return context.getElementsByTagName( tag );
}
} :
function( tag, context ) {
var results = context.getElementsByTagName( tag );
// Filter out possible comments
if ( tag === "*" ) {
var elem,
tmp = [],
i = 0;
for ( ; (elem = results[i]); i++ ) {
if ( elem.nodeType === 1 ) {
tmp.push( elem );
}
}
return tmp;
}
return results;
},
"NAME": assertUsableName && function( tag, context ) {
if ( typeof context.getElementsByName !== strundefined ) {
return context.getElementsByName( name );
}
},
"CLASS": assertUsableClassName && function( className, context, xml ) {
if ( typeof context.getElementsByClassName !== strundefined && !xml ) {
return context.getElementsByClassName( className );
}
}
},
relative: {
">": { dir: "parentNode", first: true },
" ": { dir: "parentNode" },
"+": { dir: "previousSibling", first: true },
"~": { dir: "previousSibling" }
},
preFilter: {
"ATTR": function( match ) {
match[1] = match[1].replace( rbackslash, "" );
// Move the given value to match[3] whether quoted or unquoted
match[3] = ( match[4] || match[5] || "" ).replace( rbackslash, "" );
if ( match[2] === "~=" ) {
match[3] = " " + match[3] + " ";
}
return match.slice( 0, 4 );
},
"CHILD": function( match ) {
/* matches from matchExpr["CHILD"]
1 type (only|nth|...)
2 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
3 xn-component of xn+y argument ([+-]?\d*n|)
4 sign of xn-component
5 x of xn-component
6 sign of y-component
7 y of y-component
*/
match[1] = match[1].toLowerCase();
if ( match[1] === "nth" ) {
// nth-child requires argument
if ( !match[2] ) {
Sizzle.error( match[0] );
}
// numeric x and y parameters for Expr.filter.CHILD
// remember that false/true cast respectively to 0/1
match[3] = +( match[3] ? match[4] + (match[5] || 1) : 2 * ( match[2] === "even" || match[2] === "odd" ) );
match[4] = +( ( match[6] + match[7] ) || match[2] === "odd" );
// other types prohibit arguments
} else if ( match[2] ) {
Sizzle.error( match[0] );
}
return match;
},
"PSEUDO": function( match ) {
var unquoted, excess;
if ( matchExpr["CHILD"].test( match[0] ) ) {
return null;
}
if ( match[3] ) {
match[2] = match[3];
} else if ( (unquoted = match[4]) ) {
// Only check arguments that contain a pseudo
if ( 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
unquoted = unquoted.slice( 0, excess );
match[0] = match[0].slice( 0, excess );
}
match[2] = unquoted;
}
// Return only captures needed by the pseudo filter method (type and argument)
return match.slice( 0, 3 );
}
},
filter: {
"ID": assertGetIdNotName ?
function( id ) {
id = id.replace( rbackslash, "" );
return function( elem ) {
return elem.getAttribute("id") === id;
};
} :
function( id ) {
id = id.replace( rbackslash, "" );
return function( elem ) {
var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
return node && node.value === id;
};
},
"TAG": function( nodeName ) {
if ( nodeName === "*" ) {
return function() { return true; };
}
nodeName = nodeName.replace( rbackslash, "" ).toLowerCase();
return function( elem ) {
return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
};
},
"CLASS": function( className ) {
var pattern = classCache[ expando ][ 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, context ) {
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.substr( result.length - check.length ) === check :
operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
operator === "|=" ? result === check || result.substr( 0, check.length + 1 ) === check + "-" :
false;
};
},
"CHILD": function( type, argument, first, last ) {
if ( type === "nth" ) {
return function( elem ) {
var node, diff,
parent = elem.parentNode;
if ( first === 1 && last === 0 ) {
return true;
}
if ( parent ) {
diff = 0;
for ( node = parent.firstChild; node; node = node.nextSibling ) {
if ( node.nodeType === 1 ) {
diff++;
if ( elem === node ) {
break;
}
}
}
}
// Incorporate the offset (or cast to NaN), then check against cycle size
diff -= last;
return diff === first || ( diff % first === 0 && diff / first >= 0 );
};
}
return function( elem ) {
var node = elem;
switch ( type ) {
case "only":
case "first":
while ( (node = node.previousSibling) ) {
if ( node.nodeType === 1 ) {
return false;
}
}
if ( type === "first" ) {
return true;
}
node = elem;
/* falls through */
case "last":
while ( (node = node.nextSibling) ) {
if ( node.nodeType === 1 ) {
return false;
}
}
return true;
}
};
},
"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: {
"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;
};
}),
"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;
},
"parent": function( elem ) {
return !Expr.pseudos["empty"]( elem );
},
"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 "?")
var nodeType;
elem = elem.firstChild;
while ( elem ) {
if ( elem.nodeName > "@" || (nodeType = elem.nodeType) === 3 || nodeType === 4 ) {
return false;
}
elem = elem.nextSibling;
}
return true;
},
"header": function( elem ) {
return rheader.test( elem.nodeName );
},
"text": function( elem ) {
var type, 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" &&
(type = elem.type) === "text" &&
( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === type );
},
// Input types
"radio": createInputPseudo("radio"),
"checkbox": createInputPseudo("checkbox"),
"file": createInputPseudo("file"),
"password": createInputPseudo("password"),
"image": createInputPseudo("image"),
"submit": createButtonPseudo("submit"),
"reset": createButtonPseudo("reset"),
"button": function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === "button" || name === "button";
},
"input": function( elem ) {
return rinputs.test( elem.nodeName );
},
"focus": function( elem ) {
var doc = elem.ownerDocument;
return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
},
"active": function( elem ) {
return elem === elem.ownerDocument.activeElement;
},
// Positional types
"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 ) {
for ( var i = 0; i < length; i += 2 ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"odd": createPositionalPseudo(function( matchIndexes, length ) {
for ( var i = 1; i < length; i += 2 ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
for ( var i = argument < 0 ? argument + length : argument; --i >= 0; ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
for ( var i = argument < 0 ? argument + length : argument; ++i < length; ) {
matchIndexes.push( i );
}
return matchIndexes;
})
}
};
function siblingCheck( a, b, ret ) {
if ( a === b ) {
return ret;
}
var cur = a.nextSibling;
while ( cur ) {
if ( cur === b ) {
return -1;
}
cur = cur.nextSibling;
}
return 1;
}
sortOrder = docElem.compareDocumentPosition ?
function( a, b ) {
if ( a === b ) {
hasDuplicate = true;
return 0;
}
return ( !a.compareDocumentPosition || !b.compareDocumentPosition ?
a.compareDocumentPosition :
a.compareDocumentPosition(b) & 4
) ? -1 : 1;
} :
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 );
};
// Always assume the presence of duplicates if sort doesn't
// pass them to our comparison function (as in Google Chrome).
[0, 0].sort( sortOrder );
baseHasDuplicate = !hasDuplicate;
// Document sorting and removing duplicates
Sizzle.uniqueSort = function( results ) {
var elem,
duplicates = [],
i = 1,
j = 0;
hasDuplicate = baseHasDuplicate;
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;
};
Sizzle.error = function( msg ) {
throw new Error( "Syntax error, unrecognized expression: " + msg );
};
function tokenize( selector, parseOnly ) {
var matched, match, tokens, type,
soFar, groups, preFilters,
cached = tokenCache[ expando ][ 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 )) ) {
tokens.push( matched = new Token( match.shift() ) );
soFar = soFar.slice( matched.length );
// Cast descendant combinators to space
matched.type = match[0].replace( rtrim, " " );
}
// Filters
for ( type in Expr.filter ) {
if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
(match = preFilters[ type ]( match ))) ) {
tokens.push( matched = new Token( match.shift() ) );
soFar = soFar.slice( matched.length );
matched.type = type;
matched.matches = match;
}
}
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 addCombinator( matcher, combinator, base ) {
var dir = combinator.dir,
checkNonElements = base && combinator.dir === "parentNode",
doneName = done++;
return combinator.first ?
// Check against closest ancestor/preceding element
function( elem, context, xml ) {
while ( (elem = elem[ dir ]) ) {
if ( checkNonElements || elem.nodeType === 1 ) {
return matcher( elem, context, xml );
}
}
} :
// Check against all ancestor/preceding elements
function( elem, context, xml ) {
// We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
if ( !xml ) {
var cache,
dirkey = dirruns + " " + doneName + " ",
cachedkey = dirkey + cachedruns;
while ( (elem = elem[ dir ]) ) {
if ( checkNonElements || elem.nodeType === 1 ) {
if ( (cache = elem[ expando ]) === cachedkey ) {
return elem.sizset;
} else if ( typeof cache === "string" && cache.indexOf(dirkey) === 0 ) {
if ( elem.sizset ) {
return elem;
}
} else {
elem[ expando ] = cachedkey;
if ( matcher( elem, context, xml ) ) {
elem.sizset = true;
return elem;
}
elem.sizset = false;
}
}
}
} else {
while ( (elem = elem[ dir ]) ) {
if ( checkNonElements || elem.nodeType === 1 ) {
if ( matcher( elem, context, xml ) ) {
return elem;
}
}
}
}
};
}
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 && tokens.slice( 0, i - 1 ).join("").replace( rtrim, "$1" ),
matcher,
i < j && matcherFromTokens( tokens.slice( i, j ) ),
j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
j < len && tokens.join("")
);
}
matchers.push( matcher );
}
}
return elementMatcher( matchers );
}
function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
var 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 ),
// Nested matchers should use non-integer dirruns
dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.E);
if ( outermost ) {
outermostContext = context !== document && context;
cachedruns = superMatcher.el;
}
// Add elements passing elementMatchers directly to results
for ( ; (elem = elems[i]) != null; i++ ) {
if ( byElement && elem ) {
for ( j = 0; (matcher = elementMatchers[j]); j++ ) {
if ( matcher( elem, context, xml ) ) {
results.push( elem );
break;
}
}
if ( outermost ) {
dirruns = dirrunsUnique;
cachedruns = ++superMatcher.el;
}
}
// 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 ) {
for ( j = 0; (matcher = setMatchers[j]); 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;
};
superMatcher.el = 0;
return bySet ?
markFunction( superMatcher ) :
superMatcher;
}
compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
var i,
setMatchers = [],
elementMatchers = [],
cached = compilerCache[ expando ][ 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, xml ) {
var i, tokens, token, type, find,
match = tokenize( selector ),
j = match.length;
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 && !xml &&
Expr.relative[ tokens[1].type ] ) {
context = Expr.find["ID"]( token.matches[0].replace( rbackslash, "" ), context, xml )[0];
if ( !context ) {
return results;
}
selector = selector.slice( tokens.shift().length );
}
// Fetch a seed set for right-to-left matching
for ( i = matchExpr["POS"].test( selector ) ? -1 : tokens.length - 1; i >= 0; 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( rbackslash, "" ),
rsibling.test( tokens[0].type ) && context.parentNode || context,
xml
)) ) {
// If seed is empty or no tokens remain, we can return early
tokens.splice( i, 1 );
selector = seed.length && tokens.join("");
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,
xml,
results,
rsibling.test( selector )
);
return results;
}
if ( document.querySelectorAll ) {
(function() {
var disconnectedMatch,
oldSelect = select,
rescape = /'|\\/g,
rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,
// 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" ],
// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
// A support test would require too much code (would include document ready)
// just skip matchesSelector for :active
rbuggyMatches = [ ":active" ],
matches = docElem.matchesSelector ||
docElem.mozMatchesSelector ||
docElem.webkitMatchesSelector ||
docElem.oMatchesSelector ||
docElem.msMatchesSelector;
// 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 (do not put tests after this one)
if ( !div.querySelectorAll(":checked").length ) {
rbuggyQSA.push(":checked");
}
});
assert(function( div ) {
// Opera 10-12/IE9 - ^= $= *= and empty values
// Should not select anything
div.innerHTML = "<p test=''></p>";
if ( div.querySelectorAll("[test^='']").length ) {
rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" );
}
// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
// IE8 throws error here (do not put tests after this one)
div.innerHTML = "<input type='hidden'/>";
if ( !div.querySelectorAll(":enabled").length ) {
rbuggyQSA.push(":enabled", ":disabled");
}
});
// rbuggyQSA always contains :focus, so no need for a length check
rbuggyQSA = /* rbuggyQSA.length && */ new RegExp( rbuggyQSA.join("|") );
select = function( selector, context, results, seed, xml ) {
// Only use querySelectorAll when not filtering,
// when this is not xml,
// and when no QSA bugs apply
if ( !seed && !xml && !rbuggyQSA.test( selector ) ) {
var groups, i,
old = true,
nid = expando,
newContext = context,
newSelector = context.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 ( context.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 + groups[i].join("");
}
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");
}
}
}
}
return oldSelect( selector, context, results, seed, xml );
};
if ( matches ) {
assert(function( div ) {
// Check to see if it's possible to do matchesSelector
// on a disconnected node (IE 9)
disconnectedMatch = matches.call( div, "div" );
// This should fail with an exception
// Gecko does not error, returns false instead
try {
matches.call( div, "[test!='']:sizzle" );
rbuggyMatches.push( "!=", pseudos );
} catch ( e ) {}
});
// rbuggyMatches always contains :active and :focus, so no need for a length check
rbuggyMatches = /* rbuggyMatches.length && */ new RegExp( rbuggyMatches.join("|") );
Sizzle.matchesSelector = function( elem, expr ) {
// Make sure that attribute selectors are quoted
expr = expr.replace( rattributeQuotes, "='$1']" );
// rbuggyMatches always contains :active, so no need for an existence check
if ( !isXML( elem ) && !rbuggyMatches.test( expr ) && !rbuggyQSA.test( expr ) ) {
try {
var ret = matches.call( elem, 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
elem.document && elem.document.nodeType !== 11 ) {
return ret;
}
} catch(e) {}
}
return Sizzle( expr, null, null, [ elem ] ).length > 0;
};
}
})();
}
// Deprecated
Expr.pseudos["nth"] = Expr.pseudos["eq"];
// Back-compat
function setFilters() {}
Expr.filters = setFilters.prototype = Expr.pseudos;
Expr.setFilters = new setFilters();
// 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, l, length, n, r, ret,
self = this;
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;
}
}
});
}
ret = this.pushStack( "", "find", selector );
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 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), "not", selector);
},
filter: function( selector ) {
return this.pushStack( winnow(this, selector, true), "filter", selector );
},
is: function( selector ) {
return !!selector && (
typeof selector === "string" ?
// If this is a positional/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;
}
}
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 ) );
},
addBack: function( selector ) {
return this.add( selector == null ?
this.prevObject : this.prevObject.filter(selector)
);
}
});
jQuery.fn.andSelf = jQuery.fn.addBack;
// 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;
}
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, name, core_slice.call( arguments ).join(",") );
};
});
jQuery.extend({
filter: function( expr, elems, not ) {
if ( not ) {
expr = ":not(" + expr + ")";
}
return elems.length === 1 ?
jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
jQuery.find.matches(expr, elems);
},
dir: function( elem, dir, until ) {
var matched = [],
cur = elem[ dir ];
while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
if ( cur.nodeType === 1 ) {
matched.push( cur );
}
cur = cur[dir];
}
return matched;
},
sibling: function( n, elem ) {
var r = [];
for ( ; n; n = n.nextSibling ) {
if ( n.nodeType === 1 && n !== elem ) {
r.push( n );
}
}
return r;
}
});
// Implement the identical functionality for filter and not
function winnow( elements, qualifier, keep ) {
// Can't pass null or undefined to indexOf in Firefox 4
// Set to 0 to skip string check
qualifier = qualifier || 0;
if ( jQuery.isFunction( qualifier ) ) {
return jQuery.grep(elements, function( elem, i ) {
var retVal = !!qualifier.call( elem, i, elem );
return retVal === keep;
});
} else if ( qualifier.nodeType ) {
return jQuery.grep(elements, function( elem, i ) {
return ( elem === qualifier ) === keep;
});
} else if ( typeof qualifier === "string" ) {
var filtered = jQuery.grep(elements, function( elem ) {
return elem.nodeType === 1;
});
if ( isSimple.test( qualifier ) ) {
return jQuery.filter(qualifier, filtered, !keep);
} else {
qualifier = jQuery.filter( qualifier, filtered );
}
}
return jQuery.grep(elements, function( elem, i ) {
return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;
});
}
function createSafeFragment( document ) {
var list = nodeNames.split( "|" ),
safeFrag = document.createDocumentFragment();
if ( safeFrag.createElement ) {
while ( list.length ) {
safeFrag.createElement(
list.pop()
);
}
}
return safeFrag;
}
var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
"header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
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,
rnocache = /<(?:script|object|embed|option|style)/i,
rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
rcheckableType = /^(?:checkbox|radio)$/,
// checked="checked" or checked
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
rscriptType = /\/(java|ecma)script/i,
rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,
wrapMap = {
option: [ 1, "<select multiple='multiple'>", "</select>" ],
legend: [ 1, "<fieldset>", "</fieldset>" ],
thead: [ 1, "<table>", "</table>" ],
tr: [ 2, "<table><tbody>", "</tbody></table>" ],
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
area: [ 1, "<map>", "</map>" ],
_default: [ 0, "", "" ]
},
safeFragment = createSafeFragment( document ),
fragmentDiv = safeFragment.appendChild( document.createElement("div") );
wrapMap.optgroup = wrapMap.option;
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
wrapMap.th = wrapMap.td;
// 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.
if ( !jQuery.support.htmlSerialize ) {
wrapMap._default = [ 1, "X<div>", "</div>" ];
}
jQuery.fn.extend({
text: function( value ) {
return jQuery.access( this, function( value ) {
return value === undefined ?
jQuery.text( this ) :
this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
}, null, value, arguments.length );
},
wrapAll: function( html ) {
if ( jQuery.isFunction( html ) ) {
return this.each(function(i) {
jQuery(this).wrapAll( html.call(this, i) );
});
}
if ( this[0] ) {
// The elements to wrap the target around
var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
if ( this[0].parentNode ) {
wrap.insertBefore( this[0] );
}
wrap.map(function() {
var elem = this;
while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
elem = elem.firstChild;
}
return elem;
}).append( this );
}
return this;
},
wrapInner: function( html ) {
if ( jQuery.isFunction( html ) ) {
return this.each(function(i) {
jQuery(this).wrapInner( html.call(this, i) );
});
}
return this.each(function() {
var self = jQuery( this ),
contents = self.contents();
if ( contents.length ) {
contents.wrapAll( html );
} else {
self.append( html );
}
});
},
wrap: function( html ) {
var isFunction = jQuery.isFunction( html );
return this.each(function(i) {
jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
});
},
unwrap: function() {
return this.parent().each(function() {
if ( !jQuery.nodeName( this, "body" ) ) {
jQuery( this ).replaceWith( this.childNodes );
}
}).end();
},
append: function() {
return this.domManip(arguments, true, function( elem ) {
if ( this.nodeType === 1 || this.nodeType === 11 ) {
this.appendChild( elem );
}
});
},
prepend: function() {
return this.domManip(arguments, true, function( elem ) {
if ( this.nodeType === 1 || this.nodeType === 11 ) {
this.insertBefore( elem, this.firstChild );
}
});
},
before: function() {
if ( !isDisconnected( this[0] ) ) {
return this.domManip(arguments, false, function( elem ) {
this.parentNode.insertBefore( elem, this );
});
}
if ( arguments.length ) {
var set = jQuery.clean( arguments );
return this.pushStack( jQuery.merge( set, this ), "before", this.selector );
}
},
after: function() {
if ( !isDisconnected( this[0] ) ) {
return this.domManip(arguments, false, function( elem ) {
this.parentNode.insertBefore( elem, this.nextSibling );
});
}
if ( arguments.length ) {
var set = jQuery.clean( arguments );
return this.pushStack( jQuery.merge( this, set ), "after", this.selector );
}
},
// 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 ) {
if ( !keepData && elem.nodeType === 1 ) {
jQuery.cleanData( elem.getElementsByTagName("*") );
jQuery.cleanData( [ elem ] );
}
if ( elem.parentNode ) {
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( elem.getElementsByTagName("*") );
}
// Remove any remaining nodes
while ( elem.firstChild ) {
elem.removeChild( elem.firstChild );
}
}
return this;
},
clone: function( dataAndEvents, deepDataAndEvents ) {
dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
return this.map( function () {
return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
});
},
html: function( value ) {
return jQuery.access( this, function( value ) {
var elem = this[0] || {},
i = 0,
l = this.length;
if ( value === undefined ) {
return elem.nodeType === 1 ?
elem.innerHTML.replace( rinlinejQuery, "" ) :
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( elem.getElementsByTagName( "*" ) );
elem.innerHTML = value;
}
}
elem = 0;
// If using innerHTML throws an exception, use the fallback method
} catch(e) {}
}
if ( elem ) {
this.empty().append( value );
}
}, null, value, arguments.length );
},
replaceWith: function( value ) {
if ( !isDisconnected( this[0] ) ) {
// 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 );
}
});
}
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 ) {
// Flatten any nested arrays
args = [].concat.apply( [], args );
var results, first, fragment, iNoClone,
i = 0,
value = args[0],
scripts = [],
l = this.length;
// We can't cloneNode fragments that contain checked, in WebKit
if ( !jQuery.support.checkClone && l > 1 && typeof value === "string" && rchecked.test( value ) ) {
return this.each(function() {
jQuery(this).domManip( args, table, callback );
});
}
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] ) {
results = jQuery.buildFragment( args, this, scripts );
fragment = results.fragment;
first = fragment.firstChild;
if ( fragment.childNodes.length === 1 ) {
fragment = first;
}
if ( first ) {
table = table && jQuery.nodeName( first, "tr" );
// Use the original fragment for the last item instead of the first because it can end up
// being emptied incorrectly in certain situations (#8070).
// Fragments from the fragment cache must always be cloned and never used in place.
for ( iNoClone = results.cacheable || l - 1; i < l; i++ ) {
callback.call(
table && jQuery.nodeName( this[i], "table" ) ?
findOrAppend( this[i], "tbody" ) :
this[i],
i === iNoClone ?
fragment :
jQuery.clone( fragment, true, true )
);
}
}
// Fix #11809: Avoid leaking memory
fragment = first = null;
if ( scripts.length ) {
jQuery.each( scripts, function( i, elem ) {
if ( elem.src ) {
if ( jQuery.ajax ) {
jQuery.ajax({
url: elem.src,
type: "GET",
dataType: "script",
async: false,
global: false,
"throws": true
});
} else {
jQuery.error("no ajax");
}
} else {
jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "" ) );
}
if ( elem.parentNode ) {
elem.parentNode.removeChild( elem );
}
});
}
}
return this;
}
});
function findOrAppend( elem, tag ) {
return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) );
}
function cloneCopyEvent( src, dest ) {
if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
return;
}
var type, i, l,
oldData = jQuery._data( src ),
curData = jQuery._data( dest, oldData ),
events = oldData.events;
if ( events ) {
delete curData.handle;
curData.events = {};
for ( type in events ) {
for ( i = 0, l = events[ type ].length; i < l; i++ ) {
jQuery.event.add( dest, type, events[ type ][ i ] );
}
}
}
// make the cloned public data object a copy from the original
if ( curData.data ) {
curData.data = jQuery.extend( {}, curData.data );
}
}
function cloneFixAttributes( src, dest ) {
var nodeName;
// We do not need to do anything for non-Elements
if ( dest.nodeType !== 1 ) {
return;
}
// clearAttributes removes the attributes, which we don't want,
// but also removes the attachEvent events, which we *do* want
if ( dest.clearAttributes ) {
dest.clearAttributes();
}
// mergeAttributes, in contrast, only merges back on the
// original attributes, not the events
if ( dest.mergeAttributes ) {
dest.mergeAttributes( src );
}
nodeName = dest.nodeName.toLowerCase();
if ( nodeName === "object" ) {
// IE6-10 improperly clones children of object elements using classid.
// IE10 throws NoModificationAllowedError if parent is null, #12132.
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" && 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.selected = src.defaultSelected;
// IE6-8 fails to set the defaultValue to the correct value when
// cloning other types of input fields
} else if ( nodeName === "input" || nodeName === "textarea" ) {
dest.defaultValue = src.defaultValue;
// IE blanks contents when cloning scripts
} else if ( nodeName === "script" && dest.text !== src.text ) {
dest.text = src.text;
}
// Event data gets referenced instead of copied if the expando
// gets copied too
dest.removeAttribute( jQuery.expando );
}
jQuery.buildFragment = function( args, context, scripts ) {
var fragment, cacheable, cachehit,
first = args[ 0 ];
// Set context from what may come in as undefined or a jQuery collection or a node
// Updated to fix #12266 where accessing context[0] could throw an exception in IE9/10 &
// also doubles as fix for #8950 where plain objects caused createDocumentFragment exception
context = context || document;
context = !context.nodeType && context[0] || context;
context = context.ownerDocument || context;
// Only cache "small" (1/2 KB) HTML strings that are associated with the main document
// Cloning options loses the selected state, so don't cache them
// IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
// Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
// Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501
if ( args.length === 1 && typeof first === "string" && first.length < 512 && context === document &&
first.charAt(0) === "<" && !rnocache.test( first ) &&
(jQuery.support.checkClone || !rchecked.test( first )) &&
(jQuery.support.html5Clone || !rnoshimcache.test( first )) ) {
// Mark cacheable and look for a hit
cacheable = true;
fragment = jQuery.fragments[ first ];
cachehit = fragment !== undefined;
}
if ( !fragment ) {
fragment = context.createDocumentFragment();
jQuery.clean( args, context, fragment, scripts );
// Update the cache, but only store false
// unless this is a second parsing of the same content
if ( cacheable ) {
jQuery.fragments[ first ] = cachehit && fragment;
}
}
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 elems,
i = 0,
ret = [],
insert = jQuery( selector ),
l = insert.length,
parent = this.length === 1 && this[0].parentNode;
if ( (parent == null || parent && parent.nodeType === 11 && parent.childNodes.length === 1) && l === 1 ) {
insert[ original ]( this[0] );
return this;
} else {
for ( ; i < l; i++ ) {
elems = ( i > 0 ? this.clone(true) : this ).get();
jQuery( insert[i] )[ original ]( elems );
ret = ret.concat( elems );
}
return this.pushStack( ret, name, insert.selector );
}
};
});
function getAll( elem ) {
if ( typeof elem.getElementsByTagName !== "undefined" ) {
return elem.getElementsByTagName( "*" );
} else if ( typeof elem.querySelectorAll !== "undefined" ) {
return elem.querySelectorAll( "*" );
} else {
return [];
}
}
// Used in clean, fixes the defaultChecked property
function fixDefaultChecked( elem ) {
if ( rcheckableType.test( elem.type ) ) {
elem.defaultChecked = elem.checked;
}
}
jQuery.extend({
clone: function( elem, dataAndEvents, deepDataAndEvents ) {
var srcElements,
destElements,
i,
clone;
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) ) {
// 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 i, j, elem, tag, wrap, depth, div, hasBody, tbody, len, handleScript, jsTags,
safe = context === document && safeFragment,
ret = [];
// Ensure that context is a document
if ( !context || typeof context.createDocumentFragment === "undefined" ) {
context = document;
}
// Use the already-created safe fragment if context permits
for ( i = 0; (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 {
// Ensure a safe container in which to render the html
safe = safe || createSafeFragment( context );
div = context.createElement("div");
safe.appendChild( div );
// Fix "XHTML"-style tags in all browsers
elem = elem.replace(rxhtmlTag, "<$1></$2>");
// Go to html and back, then peel off extra wrappers
tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase();
wrap = wrapMap[ tag ] || wrapMap._default;
depth = wrap[0];
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>
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;
// Take out of fragment container (we need a fresh div each time)
div.parentNode.removeChild( div );
}
}
if ( elem.nodeType ) {
ret.push( elem );
} else {
jQuery.merge( ret, elem );
}
}
// Fix #11356: Clear elements from safeFragment
if ( div ) {
elem = div = safe = null;
}
// Reset defaultChecked for any radios and checkboxes
// about to be appended to the DOM in IE 6/7 (#8060)
if ( !jQuery.support.appendChecked ) {
for ( i = 0; (elem = ret[i]) != null; i++ ) {
if ( jQuery.nodeName( elem, "input" ) ) {
fixDefaultChecked( elem );
} else if ( typeof elem.getElementsByTagName !== "undefined" ) {
jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked );
}
}
}
// Append elements to a provided document fragment
if ( fragment ) {
// Special handling of each script element
handleScript = function( elem ) {
// Check if we consider it executable
if ( !elem.type || rscriptType.test( elem.type ) ) {
// Detach the script and store it in the scripts array (if provided) or the fragment
// Return truthy to indicate that it has been handled
return scripts ?
scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) :
fragment.appendChild( elem );
}
};
for ( i = 0; (elem = ret[i]) != null; i++ ) {
// Check if we're done after handling an executable script
if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) {
// Append to fragment and handle embedded scripts
fragment.appendChild( elem );
if ( typeof elem.getElementsByTagName !== "undefined" ) {
// handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration
jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript );
// Splice the scripts into ret after their former ancestor and advance our index beyond them
ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
i += jsTags.length;
}
}
}
}
return ret;
},
cleanData: function( elems, /* internal */ acceptData ) {
var data, id, elem, type,
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 ( elem.removeAttribute ) {
elem.removeAttribute( internalKey );
} else {
elem[ internalKey ] = null;
}
jQuery.deletedIds.push( id );
}
}
}
}
}
});
// Limit scope pollution from any deprecated API
(function() {
var matched, browser;
// Use of jQuery.browser is frowned upon.
// More details: http://api.jquery.com/jQuery.browser
// jQuery.uaMatch maintained for back-compat
jQuery.uaMatch = function( ua ) {
ua = ua.toLowerCase();
var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
/(msie) ([\w.]+)/.exec( ua ) ||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
[];
return {
browser: match[ 1 ] || "",
version: match[ 2 ] || "0"
};
};
matched = jQuery.uaMatch( navigator.userAgent );
browser = {};
if ( matched.browser ) {
browser[ matched.browser ] = true;
browser.version = matched.version;
}
// Chrome is Webkit, but Webkit is also Safari.
if ( browser.chrome ) {
browser.webkit = true;
} else if ( browser.webkit ) {
browser.safari = true;
}
jQuery.browser = browser;
jQuery.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;
};
})();
var curCSS, iframe, iframeDoc,
ralpha = /alpha\([^)]*\)/i,
ropacity = /opacity=([^)]*)/,
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" ],
eventsToggle = jQuery.fn.toggle;
// 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 ) {
elem = el || elem;
return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
}
function showHide( elements, show ) {
var elem, display,
values = [],
index = 0,
length = elements.length;
for ( ; index < length; index++ ) {
elem = elements[ index ];
if ( !elem.style ) {
continue;
}
values[ index ] = jQuery._data( elem, "olddisplay" );
if ( show ) {
// Reset the inline display of this element to learn if it is
// being hidden by cascaded rules or not
if ( !values[ index ] && elem.style.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 {
display = curCSS( elem, "display" );
if ( !values[ index ] && display !== "none" ) {
jQuery._data( elem, "olddisplay", 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 ) {
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, fn2 ) {
var bool = typeof state === "boolean";
if ( jQuery.isFunction( state ) && jQuery.isFunction( fn2 ) ) {
return eventsToggle.apply( this, arguments );
}
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: {
"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";
}
// 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, numeric, extra ) {
var val, num, 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 );
}
//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 ( numeric || extra !== undefined ) {
num = parseFloat( val );
return numeric || 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 ) {
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.call( elem );
// Revert the old values
for ( name in options ) {
elem.style[ name ] = old[ name ];
}
return ret;
}
});
// NOTE: To any future maintainer, we've window.getComputedStyle
// because jsdom on node.js will break without it.
if ( window.getComputedStyle ) {
curCSS = function( elem, name ) {
var ret, width, minWidth, maxWidth,
computed = window.getComputedStyle( elem, null ),
style = elem.style;
if ( computed ) {
// getPropertyValue is only needed for .css('filter') in IE9, see #12537
ret = computed.getPropertyValue( name ) || computed[ name ];
if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
ret = jQuery.style( elem, name );
}
// A tribute to the "awesome hack by Dean Edwards"
// 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 ) ) {
width = style.width;
minWidth = style.minWidth;
maxWidth = style.maxWidth;
style.minWidth = style.maxWidth = style.width = ret;
ret = computed.width;
style.width = width;
style.minWidth = minWidth;
style.maxWidth = maxWidth;
}
}
return ret;
};
} else if ( document.documentElement.currentStyle ) {
curCSS = function( elem, name ) {
var left, rsLeft,
ret = elem.currentStyle && elem.currentStyle[ name ],
style = elem.style;
// Avoid setting ret to empty string here
// so we don't default to auto
if ( ret == null && style && 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;
rsLeft = elem.runtimeStyle && elem.runtimeStyle.left;
// Put in the new values to get a computed value out
if ( rsLeft ) {
elem.runtimeStyle.left = elem.currentStyle.left;
}
style.left = name === "fontSize" ? "1em" : ret;
ret = style.pixelLeft + "px";
// Revert the changed values
style.left = left;
if ( rsLeft ) {
elem.runtimeStyle.left = rsLeft;
}
}
return ret === "" ? "auto" : ret;
};
}
function setPositiveNumber( elem, value, subtract ) {
var matches = rnumsplit.exec( value );
return matches ?
Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
value;
}
function augmentWidthOrHeight( elem, name, extra, isBorderBox ) {
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" ) {
// we use jQuery.css instead of curCSS here
// because of the reliableMarginRight CSS hook!
val += jQuery.css( elem, extra + cssExpand[ i ], true );
}
// From this point on we use curCSS for maximum performance (relevant in animations)
if ( isBorderBox ) {
// border-box includes padding, so remove it if we want content
if ( extra === "content" ) {
val -= parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0;
}
// at this point, extra isn't border nor margin, so remove border
if ( extra !== "margin" ) {
val -= parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;
}
} else {
// at this point, extra isn't content, so add padding
val += parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0;
// at this point, extra isn't content nor padding, so add border
if ( extra !== "padding" ) {
val += parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;
}
}
}
return val;
}
function getWidthOrHeight( elem, name, extra ) {
// Start with offset property, which is equivalent to the border-box value
var val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
valueIsBorderBox = true,
isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "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 );
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
)
) + "px";
}
// Try to determine the default display value of an element
function css_defaultDisplay( nodeName ) {
if ( elemdisplay[ nodeName ] ) {
return elemdisplay[ nodeName ];
}
var elem = jQuery( "<" + nodeName + ">" ).appendTo( document.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 === "" ) {
// Use the already-created iframe if possible
iframe = document.body.appendChild(
iframe || jQuery.extend( document.createElement("iframe"), {
frameBorder: 0,
width: 0,
height: 0
})
);
// 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("<!doctype html><html><body>");
iframeDoc.close();
}
elem = iframeDoc.body.appendChild( iframeDoc.createElement(nodeName) );
display = curCSS( elem, "display" );
document.body.removeChild( iframe );
}
// Store the correct default display
elemdisplay[ nodeName ] = display;
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
if ( elem.offsetWidth === 0 && rdisplayswap.test( curCSS( elem, "display" ) ) ) {
return jQuery.swap( elem, cssShow, function() {
return getWidthOrHeight( elem, name, extra );
});
} else {
return getWidthOrHeight( elem, name, extra );
}
}
},
set: function( elem, value, extra ) {
return setPositiveNumber( elem, value, extra ?
augmentWidthOrHeight(
elem,
name,
extra,
jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box"
) : 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 >= 1 && 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 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;
}
};
}
// 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 ) {
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
// Work around by temporarily setting element display to inline-block
return jQuery.swap( elem, { "display": "inline-block" }, function() {
if ( computed ) {
return curCSS( elem, "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 ) {
var ret = curCSS( elem, prop );
// if curCSS returns percentage, fallback to offset
return rnumnonpx.test( ret ) ? jQuery( elem ).position()[ prop ] + "px" : ret;
}
}
};
});
}
});
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.hidden = function( elem ) {
return ( elem.offsetWidth === 0 && elem.offsetHeight === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || curCSS( elem, "display" )) === "none");
};
jQuery.expr.filters.visible = function( elem ) {
return !jQuery.expr.filters.hidden( elem );
};
}
// These hooks are used by animate to expand properties
jQuery.each({
margin: "",
padding: "",
border: "Width"
}, function( prefix, suffix ) {
jQuery.cssHooks[ prefix + suffix ] = {
expand: function( value ) {
var i,
// assumes a single number if not a string
parts = typeof value === "string" ? value.split(" ") : [ value ],
expanded = {};
for ( i = 0; i < 4; i++ ) {
expanded[ prefix + cssExpand[ i ] + suffix ] =
parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
}
return expanded;
}
};
if ( !rmargin.test( prefix ) ) {
jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
}
});
var r20 = /%20/g,
rbracket = /\[\]$/,
rCRLF = /\r?\n/g,
rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
rselectTextarea = /^(?:select|textarea)/i;
jQuery.fn.extend({
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();
}
});
//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 {
// If array item is non-scalar (array or object), encode its
// numeric index to resolve deserialization ambiguity issues.
// Note that rack (as of 1.0.0) can't currently deserialize
// nested arrays properly, and attempting to do so may cause
// a server error. Possible fixes are to modify rack's
// deserialization algorithm or to provide an option or flag
// to force array serialization to be shallow.
buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
}
});
} else if ( !traditional && jQuery.type( obj ) === "object" ) {
// Serialize object item.
for ( name in obj ) {
buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
}
} else {
// Serialize scalar item.
add( prefix, obj );
}
}
var
// Document location
ajaxLocParts,
ajaxLocation,
rhash = /#.*$/,
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 = /^\/\//,
rquery = /\?/,
rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
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 = {},
// 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 = "*";
}
var dataType, list, placeBefore,
dataTypes = dataTypeExpression.toLowerCase().split( core_rspace ),
i = 0,
length = dataTypes.length;
if ( jQuery.isFunction( func ) ) {
// 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 selection,
list = structure[ dataType ],
i = 0,
length = list ? list.length : 0,
executeOnly = ( structure === prefilters );
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.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
if ( !this.length ) {
return this;
}
var selector, type, response,
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";
}
// Request the remote document
jQuery.ajax({
url: url,
// if "type" variable is undefined, then "GET" method will be used
type: type,
dataType: "html",
data: params,
complete: function( jqXHR, status ) {
if ( callback ) {
self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
}
}
}).done(function( responseText ) {
// Save response for use in complete callback
response = arguments;
// 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 );
});
return this;
};
// Attach a bunch of functions for handling common AJAX events
jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){
jQuery.fn[ o ] = function( f ){
return this.on( o, f );
};
});
jQuery.each( [ "get", "post" ], function( i, method ) {
jQuery[ method ] = function( url, data, callback, type ) {
// shift arguments if data argument was omitted
if ( jQuery.isFunction( data ) ) {
type = type || callback;
callback = data;
data = undefined;
}
return jQuery.ajax({
type: method,
url: url,
data: data,
success: callback,
dataType: type
});
};
});
jQuery.extend({
getScript: function( url, callback ) {
return jQuery.get( url, undefined, callback, "script" );
},
getJSON: function( url, data, callback ) {
return jQuery.get( url, data, callback, "json" );
},
// Creates a full fledged settings object into target
// with both ajaxSettings and settings fields.
// If target is omitted, writes into ajaxSettings.
ajaxSetup: function( target, settings ) {
if ( settings ) {
// Building a settings object
ajaxExtend( target, jQuery.ajaxSettings );
} else {
// Extending ajaxSettings
settings = target;
target = jQuery.ajaxSettings;
}
ajaxExtend( target, settings );
return target;
},
ajaxSettings: {
url: ajaxLocation,
isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
global: true,
type: "GET",
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
processData: true,
async: true,
/*
timeout: 0,
data: null,
dataType: null,
username: null,
password: null,
cache: null,
throws: false,
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 // ifModified key
ifModifiedKey,
// Response headers
responseHeadersString,
responseHeaders,
// transport
transport,
// timeout handle
timeoutTimer,
// Cross-domain detection vars
parts,
// To know if global events are to be dispatched
fireGlobals,
// Loop variable
i,
// Create the final options object
s = jQuery.ajaxSetup( {}, options ),
// Callbacks context
callbackContext = s.context || s,
// Context for global events
// It's the callbackContext if one was provided in the options
// and if it's a DOM node or a jQuery collection
globalEventContext = callbackContext !== s &&
( callbackContext.nodeType || callbackContext instanceof jQuery ) ?
jQuery( callbackContext ) : jQuery.event,
// Deferreds
deferred = jQuery.Deferred(),
completeDeferred = jQuery.Callbacks( "once memory" ),
// Status-dependent callbacks
statusCode = s.statusCode || {},
// Headers (they are sent all at once)
requestHeaders = {},
requestHeadersNames = {},
// The jqXHR state
state = 0,
// Default abort message
strAbort = "canceled",
// 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 || strAbort;
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 ) {
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[ ifModifiedKey ] = modified;
}
modified = jqXHR.getResponseHeader("Etag");
if ( modified ) {
jQuery.etag[ ifModifiedKey ] = modified;
}
}
// If not modified
if ( status === 304 ) {
statusText = "notmodified";
isSuccess = true;
// If we have data
} 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 ( !statusText || status ) {
statusText = "error";
if ( status < 0 ) {
status = 0;
}
}
}
// Set data for the fake xhr object
jqXHR.status = status;
jqXHR.statusText = ( nativeStatusText || statusText ) + "";
// Success/Error
if ( isSuccess ) {
deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
} else {
deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
}
// Status-dependent callbacks
jqXHR.statusCode( statusCode );
statusCode = undefined;
if ( fireGlobals ) {
globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ),
[ jqXHR, s, isSuccess ? success : error ] );
}
// Complete
completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
// Handle the global AJAX counter
if ( !( --jQuery.active ) ) {
jQuery.event.trigger( "ajaxStop" );
}
}
}
// Attach deferreds
deferred.promise( jqXHR );
jqXHR.success = jqXHR.done;
jqXHR.error = jqXHR.fail;
jqXHR.complete = completeDeferred.add;
// Status-dependent callbacks
jqXHR.statusCode = function( map ) {
if ( map ) {
var tmp;
if ( state < 2 ) {
for ( tmp in map ) {
statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ];
}
} else {
tmp = map[ jqXHR.status ];
jqXHR.always( 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( core_rspace );
// 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;
// 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 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;
}
}
}
return jqXHR;
},
// 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 ct, type, finalDataType, firstDataType,
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 conv, conv2, current, tmp,
// Work with a copy of dataTypes in case we need to modify it for conversion
dataTypes = s.dataTypes.slice(),
prev = dataTypes[ 0 ],
converters = {},
i = 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 };
}
var oldCallbacks = [],
rquestion = /\?/,
rjsonp = /(=)\?(?=&|$)|\?\?/,
nonce = jQuery.now();
// Default jsonp settings
jQuery.ajaxSetup({
jsonp: "callback",
jsonpCallback: function() {
var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
this[ callback ] = true;
return callback;
}
});
// Detect, normalize options and install callbacks for jsonp requests
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
var callbackName, overwritten, responseContainer,
data = s.data,
url = s.url,
hasCallback = s.jsonp !== false,
replaceInUrl = hasCallback && rjsonp.test( url ),
replaceInData = hasCallback && !replaceInUrl && typeof data === "string" &&
!( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") &&
rjsonp.test( data );
// Handle iff the expected data type is "jsonp" or we have a parameter to set
if ( s.dataTypes[ 0 ] === "jsonp" || replaceInUrl || replaceInData ) {
// Get callback name, remembering preexisting value associated with it
callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
s.jsonpCallback() :
s.jsonpCallback;
overwritten = window[ callbackName ];
// Insert callback into url or form data
if ( replaceInUrl ) {
s.url = url.replace( rjsonp, "$1" + callbackName );
} else if ( replaceInData ) {
s.data = data.replace( rjsonp, "$1" + callbackName );
} else if ( hasCallback ) {
s.url += ( rquestion.test( 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
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";
}
});
// 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 xhrCallbacks,
// #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;
// 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 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( _ ) {}
// 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 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 {
status = xhr.status;
responseHeaders = xhr.getAllResponseHeaders();
responses = {};
xml = xhr.responseXML;
// Construct response list
if ( xml && xml.documentElement /* #4958 */ ) {
responses.xml = xml;
}
// When requesting binary data, IE6-9 will throw an exception
// on any attempt to access responseText (#11426)
try {
responses.text = xhr.responseText;
} catch( e ) {
}
// 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, 0 );
} 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 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;
}, 0 );
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,
index = 0,
tweenerIndex = 0,
length = animationPrefilters.length,
deferred = jQuery.Deferred().always( function() {
// don't match elem in the :animated selector
delete tick.elem;
}),
tick = function() {
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, easing ) {
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;
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, {
anim: animation,
queue: animation.opts.queue,
elem: elem
})
);
// attach callbacks from options
return animation.progress( animation.opts.progress )
.done( animation.opts.done, animation.opts.complete )
.fail( animation.opts.fail )
.always( animation.opts.always );
}
function propFilter( props, specialEasing ) {
var index, name, easing, value, hooks;
// camelCase, specialEasing and expand cssHook pass
for ( index in props ) {
name = jQuery.camelCase( index );
easing = specialEasing[ name ];
value = props[ index ];
if ( jQuery.isArray( value ) ) {
easing = value[ 1 ];
value = props[ index ] = value[ 0 ];
}
if ( index !== name ) {
props[ name ] = value;
delete props[ index ];
}
hooks = jQuery.cssHooks[ name ];
if ( hooks && "expand" in hooks ) {
value = hooks.expand( value );
delete props[ name ];
// not quite $.extend, this wont overwrite keys already present.
// also - reusing 'index' from above because we have the correct "name"
for ( index in value ) {
if ( !( index in props ) ) {
props[ index ] = value[ index ];
specialEasing[ index ] = easing;
}
}
} else {
specialEasing[ name ] = easing;
}
}
}
jQuery.Animation = jQuery.extend( Animation, {
tweener: function( props, callback ) {
if ( jQuery.isFunction( props ) ) {
callback = props;
props = [ "*" ];
} else {
props = props.split(" ");
}
var prop,
index = 0,
length = props.length;
for ( ; index < length ; index++ ) {
prop = props[ index ];
tweeners[ prop ] = tweeners[ prop ] || [];
tweeners[ prop ].unshift( callback );
}
},
prefilter: function( callback, prepend ) {
if ( prepend ) {
animationPrefilters.unshift( callback );
} else {
animationPrefilters.push( callback );
}
}
});
function defaultPrefilter( elem, props, opts ) {
var index, prop, value, length, 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.done(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", true );
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 any value as a 4th 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, false, "" );
// 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" ||
// special check for .toggle( handler, handler, ... )
( !i && jQuery.isFunction( speed ) && jQuery.isFunction( easing ) ) ?
cssFn.apply( this, arguments ) :
this.animate( genFx( name, true ), speed, easing, callback );
};
});
jQuery.fn.extend({
fadeTo: function( speed, to, easing, callback ) {
// show any hidden elements after setting opacity to 0
return this.filter( isHidden ).css( "opacity", 0 ).show()
// animate to the value specified
.end().animate({ opacity: to }, speed, easing, callback );
},
animate: function( prop, speed, easing, callback ) {
var empty = jQuery.isEmptyObject( prop ),
optall = jQuery.speed( speed, easing, callback ),
doAnimation = function() {
// Operate on a copy of prop so per-property easing won't be lost
var anim = Animation( this, jQuery.extend( {}, prop ), optall );
// Empty animations resolve immediately
if ( empty ) {
anim.stop( true );
}
};
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 );
}
});
}
});
// 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 ) && !timerId ) {
timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
}
};
jQuery.fx.interval = 13;
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;
};
}
var rroot = /^(?:body|html)$/i;
jQuery.fn.offset = function( options ) {
if ( arguments.length ) {
return options === undefined ?
this :
this.each(function( i ) {
jQuery.offset.setOffset( this, options, i );
});
}
var docElem, body, win, clientTop, clientLeft, scrollTop, scrollLeft,
box = { top: 0, left: 0 },
elem = this[ 0 ],
doc = elem && elem.ownerDocument;
if ( !doc ) {
return;
}
if ( (body = doc.body) === elem ) {
return jQuery.offset.bodyOffset( elem );
}
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 !== "undefined" ) {
box = elem.getBoundingClientRect();
}
win = getWindow( doc );
clientTop = docElem.clientTop || body.clientTop || 0;
clientLeft = docElem.clientLeft || body.clientLeft || 0;
scrollTop = win.pageYOffset || docElem.scrollTop;
scrollLeft = win.pageXOffset || docElem.scrollLeft;
return {
top: box.top + scrollTop - clientTop,
left: box.left + scrollLeft - clientLeft
};
};
jQuery.offset = {
bodyOffset: function( body ) {
var top = body.offsetTop,
left = body.offsetLeft;
if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) {
top += parseFloat( jQuery.css(body, "marginTop") ) || 0;
left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
}
return { top: top, left: left };
},
setOffset: function( elem, options, i ) {
var position = jQuery.css( elem, "position" );
// set position first, in-case top/left are set even on static elem
if ( position === "static" ) {
elem.style.position = "relative";
}
var curElem = jQuery( elem ),
curOffset = curElem.offset(),
curCSSTop = jQuery.css( elem, "top" ),
curCSSLeft = jQuery.css( elem, "left" ),
calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
props = {}, curPosition = {}, curTop, curLeft;
// need to be able to calculate position if either top or left is auto and position is either absolute or fixed
if ( calculatePosition ) {
curPosition = curElem.position();
curTop = curPosition.top;
curLeft = curPosition.left;
} else {
curTop = parseFloat( curCSSTop ) || 0;
curLeft = parseFloat( curCSSLeft ) || 0;
}
if ( jQuery.isFunction( options ) ) {
options = options.call( elem, i, curOffset );
}
if ( options.top != null ) {
props.top = ( options.top - curOffset.top ) + curTop;
}
if ( options.left != null ) {
props.left = ( options.left - curOffset.left ) + curLeft;
}
if ( "using" in options ) {
options.using.call( elem, props );
} else {
curElem.css( props );
}
}
};
jQuery.fn.extend({
position: function() {
if ( !this[0] ) {
return;
}
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 || document.body;
});
}
});
// 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, value, extra ) :
// Set width or height on the element
jQuery.style( elem, type, value, extra );
}, type, chainable ? margin : undefined, chainable, null );
};
});
});
// Expose jQuery to the global object
window.jQuery = window.$ = jQuery;
// Expose jQuery as an AMD module, but only for AMD loaders that
// understand the issues with loading multiple versions of jQuery
// in a page that all might call define(). The loader will indicate
// they have special allowances for multiple jQuery versions by
// specifying define.amd.jQuery = true. Register as a named module,
// since jQuery can be concatenated with other files that may use define,
// but not use a proper concatenation script that understands anonymous
// AMD modules. A named AMD is safest and most robust way to register.
// Lowercase jquery is used because AMD module names are derived from
// file names, and jQuery is normally delivered in a lowercase file name.
// Do this after creating the global so that if an AMD module wants to call
// noConflict to hide this version of jQuery, it will work.
if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
define( "jquery", [], function () { return jQuery; } );
}
})( window );
|
packages/react-scripts/fixtures/kitchensink/src/features/syntax/Promises.js
|
christiantinauer/create-react-app
|
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { Component } from 'react';
import PropTypes from 'prop-types';
function load() {
return Promise.resolve([
{ id: 1, name: '1' },
{ id: 2, name: '2' },
{ id: 3, name: '3' },
{ id: 4, name: '4' },
]);
}
export default class extends Component {
static propTypes = {
onReady: PropTypes.func.isRequired,
};
constructor(props) {
super(props);
this.state = { users: [] };
}
componentDidMount() {
load().then(users => {
this.setState({ users });
});
}
componentDidUpdate() {
this.props.onReady();
}
render() {
return (
<div id="feature-promises">
{this.state.users.map(user => <div key={user.id}>{user.name}</div>)}
</div>
);
}
}
|
src/blocks/TopMenu/TopMenu.js
|
ducthuan-2712/To-Do
|
/*
* @flow
*/
import React, { Component } from 'react';
import { NavLink } from 'react-router-dom';
/* Component */
import Dropdown from '../../components/Dropdown';
import Icon from '../../components/Icon';
/* Block */
import PodPopover from '../PodPopover';
import './TopMenu.css';
import logo from '../../img/logo.png';
// import logo2x from '../../logo@2x.png';
class TopMenu extends Component {
constructor(props) {
super(props)
this.state = {
dropdownTeam: false,
dropdownCalendar: false
}
this.handleCallback = this.handleCallback.bind(this);
this.handleClosePod = this.handleClosePod.bind(this);
}
handleCallback(name, posX, posY, toggleClick) {
if(!toggleClick) {
switch(name) {
case 'dropdownTeam':
this._PopoverTeam.show(name, posX, posY);
this.setState({ dropdownTeam: true });
break;
case 'dropdownCalendar':
this._PopoverCalendar.show(name, posX, posY);
this.setState({ dropdownCalendar: true });
break;
default:
}
}
}
handleClosePod(name) {
switch(name) {
case 'dropdownTeam':
this.setState({ dropdownTeam: false });
break;
case 'dropdownCalendar':
this.setState({ dropdownCalendar: false });
break;
default:
}
}
render() {
let checkTeam = this.state.dropdownTeam ? ' top-menu--active': '';
let checkCalendar = this.state.dropdownCalendar ? ' top-menu--active': '';
const {location, url_team} = this.props;
let row;
if(
location.pathname === `/t/${url_team}` ||
location.pathname === `/t/${url_team}&-alert` ||
location.pathname === `/t/${url_team}&-done` ||
location.pathname === `/m/${url_team}` ||
location.pathname === `/m/${url_team}&-done`
) {
row = (
<div className={'top-menu__calendar'+checkCalendar}>
<Dropdown
active={this.state.dropdownCalendar}
name="dropdownCalendar"
callback={this.handleCallback}
>
<Icon size="md" name="date_range" />
<PodPopover
ref={(child) => { this._PopoverCalendar = child; }}
onClosePod={this.handleClosePod}
/>
</Dropdown>
</div>
)
}
return (
<div className="top-menu">
<div className="top-menu__center">
<NavLink exact to={`/t/${url_team}`} className="logo" activeClassName="logo--selected" >
<img src={logo} className="top-menu__logo" alt="presentation" role="presentation" />
</NavLink>
</div>
<div className="top-menu__right">
<div className={'top-menu__user'+checkTeam}>
<Dropdown
active={this.state.dropdownTeam}
name="dropdownTeam"
callback={this.handleCallback}
>
<Icon size="md" name="supervisor_account" />
<PodPopover
ref={(child) => { this._PopoverTeam = child; }}
onClosePod={this.handleClosePod}
/>
</Dropdown>
</div>
{row}
</div>
</div>
);
}
}
export default TopMenu;
|
js/fw/components/checkbox/index.js
|
linh918/react-native-starter-kit-demo-
|
import React, { Component } from 'react';
import {
Container,
Header,
Title,
Content,
Button,
Icon,
List,
ListItem,
CheckBox,
Text,
Left,
Right,
Body,
} from 'native-base';
import styles from './styles';
class NHCheckbox extends Component {
constructor(props) {
super(props);
this.state = {
checkbox1: true,
checkbox2: true,
checkbox3: true,
checkbox4: false,
};
}
toggleSwitch1() {
this.setState({
checkbox1: !this.state.checkbox1,
});
}
toggleSwitch2() {
this.setState({
checkbox2: !this.state.checkbox2,
});
}
toggleSwitch3() {
this.setState({
checkbox3: !this.state.checkbox3,
});
}
toggleSwitch4() {
this.setState({
checkbox4: !this.state.checkbox4,
});
}
render() {
return (
<Container style={styles.container}>
<Header>
<Left>
<Button transparent onPress={() => this.props.navigation.navigate('DrawerOpen')}>
<Icon name="menu" />
</Button>
</Left>
<Body>
<Title>Check Box</Title>
</Body>
<Right />
</Header>
<Content>
<ListItem button onPress={() => this.toggleSwitch1()}>
<CheckBox checked={this.state.checkbox1} onPress={() => this.toggleSwitch1()} />
<Body>
<Text>Lunch Break</Text>
</Body>
</ListItem>
<ListItem button onPress={() => this.toggleSwitch2()}>
<CheckBox color="red" checked={this.state.checkbox2} onPress={() => this.toggleSwitch2()} />
<Body>
<Text>Daily Stand Up</Text>
</Body>
</ListItem>
<ListItem button onPress={() => this.toggleSwitch3()}>
<CheckBox color="green" checked={this.state.checkbox3} onPress={() => this.toggleSwitch3()} />
<Body>
<Text>Finish list Screen</Text>
</Body>
</ListItem>
<ListItem button onPress={() => this.toggleSwitch4()}>
<CheckBox color="#000" checked={this.state.checkbox4} onPress={() => this.toggleSwitch4()} />
<Body>
<Text>Discussion with Client</Text>
</Body>
</ListItem>
</Content>
</Container>
);
}
}
export default NHCheckbox;
|
ajax/libs/stellar-base/0.2.0/stellar-base.js
|
pvnr0082t/cdnjs
|
var StellarBase =
/******/ (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";
__webpack_require__(1);
module.exports = __webpack_require__(5);
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(2);
/***/ },
/* 2 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global) {"use strict";
if (global._babelPolyfill) {
throw new Error("only one instance of babel/polyfill is allowed");
}
global._babelPolyfill = true;
__webpack_require__(3);
__webpack_require__(4);
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
/***/ },
/* 3 */
/***/ function(module, exports, __webpack_require__) {
/**
* Core.js 0.6.1
* https://github.com/zloirock/core-js
* License: http://rock.mit-license.org
* © 2015 Denis Pushkarev
*/
!function(global, framework, undefined){
'use strict';
/******************************************************************************
* Module : common *
******************************************************************************/
// Shortcuts for [[Class]] & property names
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'
// Aliases global objects and prototypes
, 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
, RangeError = global.RangeError
, setTimeout = global.setTimeout
, setImmediate = global.setImmediate
, clearImmediate = global.clearImmediate
, parseInt = global.parseInt
, isFinite = global.isFinite
, process = global[PROCESS]
, nextTick = process && process.nextTick
, document = global.document
, html = document && document.documentElement
, navigator = global.navigator
, define = global.define
, console = global.console || {}
, ArrayProto = Array[PROTOTYPE]
, ObjectProto = Object[PROTOTYPE]
, FunctionProto = Function[PROTOTYPE]
, Infinity = 1 / 0
, DOT = '.';
// http://jsperf.com/core-js-isobject
function isObject(it){
return it !== null && (typeof it == 'object' || typeof it == 'function');
}
function isFunction(it){
return typeof it == 'function';
}
// Native function?
var isNative = ctx(/./.test, /\[native code\]\s*\}\s*$/, 1);
// Object internal [[Class]] or toStringTag
// http://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring
var 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 toString.call(it).slice(8, -1);
}
function classof(it){
var O, T;
return it == undefined ? it === undefined ? 'Undefined' : 'Null'
: typeof (T = (O = Object(it))[SYMBOL_TAG]) == 'string' ? T : cof(O);
}
// Function
var call = FunctionProto.call
, apply = FunctionProto.apply
, REFERENCE_GET;
// Partial apply
function part(/* ...args */){
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(/* ...args */){
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);
}
}
// Optional / simple context binding
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(/* ...args */){
return fn.apply(that, arguments);
}
}
// Fast apply
// http://jsperf.lnkit.com/fast-apply/5
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);
}
// Object:
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)
// Dummy, fix for not array-like ES3 string in es5 module
, 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);
}
// 19.1.2.1 Object.assign(target, source, ...)
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;
}
// Array
// array('str1,str2,str3') => ['str1', 'str2', 'str3']
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];
/*
* 0 -> forEach
* 1 -> map
* 2 -> filter
* 3 -> some
* 4 -> every
* 5 -> find
* 6 -> findIndex
*/
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/*, that = undefined */){
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; // map
else if(res)switch(type){
case 3: return true; // some
case 5: return val; // find
case 6: return index; // findIndex
case 2: result.push(val); // filter
} else if(isEvery)return false; // every
}
}
return isFindIndex ? -1 : isSome || isEvery ? isEvery : result;
}
}
function createArrayContains(isContains){
return function(el /*, fromIndex = 0 */){
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){
// strange IE quirks mode bug -> use typeof vs isFunction
return typeof A == 'function' ? A : B;
}
// Math
var MAX_SAFE_INTEGER = 0x1fffffffffffff // pow(2, 53) - 1 == 9007199254740991
, pow = Math.pow
, abs = Math.abs
, 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);
}
// 20.1.2.4 Number.isNaN(number)
function sameNaN(number){
return number != number;
}
// 7.1.4 ToInteger
function toInteger(it){
return isNaN(it) ? 0 : trunc(it);
}
// 7.1.15 ToLength
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 lz(num){
return num > 9 ? num : '0' + num;
}
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 < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
? toString ? s.charAt(i) : a
: toString ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
}
}
// Assertion & errors
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!");
}
// Property descriptors & Symbol
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);
}
// The engine works fine with descriptors? Thank's IE8 for his funny defineProperty.
var DESC = !!function(){
try {
return defineProperty({}, 'a', {get: function(){ return 2 }}).a == 2;
} catch(e){}
}()
, 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_TAG = getWellKnownSymbol(TO_STRING_TAG)
, SYMBOL_SPECIES = getWellKnownSymbol('species')
, SYMBOL_ITERATOR;
function setSpecies(C){
if(DESC && (framework || !isNative(C)))defineProperty(C, SYMBOL_SPECIES, {
configurable: true,
get: returnThis
});
}
/******************************************************************************
* Module : common.export *
******************************************************************************/
var NODE = cof(process) == PROCESS
, core = {}
, path = framework ? global : core
, old = global.core
, exportGlobal
// type bitmap
, 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){
// there is a similar native
own = !(type & FORCED) && target && key in target
&& (!isFunction(target[key]) || isNative(target[key]));
// export native or passed
out = (own ? target : source)[key];
// prevent global pollution for namespaces
if(!framework && isGlobal && !isFunction(target[key]))exp = source[key];
// bind timers to global for call from export context
else if(type & BIND && own)exp = ctx(out, global);
// wrap global constructors for prevent change them in library
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;
// extend global
if(framework && target && !own){
if(isGlobal)target[key] = out;
else delete target[key] && hidden(target, key, out);
}
// export
if(exports[key] != out)hidden(exports, key, exp);
}
}
// CommonJS export
if(typeof module != 'undefined' && module.exports)module.exports = core;
// RequireJS export
else if(isFunction(define) && define.amd)define(function(){return core});
// Export to global object
else exportGlobal = true;
if(exportGlobal || framework){
core.noConflict = function(){
global.core = old;
return core;
}
global.core = core;
}
/******************************************************************************
* Module : common.iterators *
******************************************************************************/
SYMBOL_ITERATOR = getWellKnownSymbol(ITERATOR);
var ITER = safeSymbol('iter')
, KEY = 1
, VALUE = 2
, Iterators = {}
, IteratorPrototype = {}
// Safari has byggy iterators w/o `next`
, BUGGY_ITERATORS = 'keys' in ArrayProto && !('next' in [].keys());
// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
setIterator(IteratorPrototype, returnThis);
function setIterator(O, value){
hidden(O, SYMBOL_ITERATOR, value);
// Add iterator for FF iterator protocol
FF_ITERATOR in ArrayProto && 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){
// Define iterator
setIterator(proto, iter);
if(iter !== value){
var iterProto = getPrototypeOf(iter.call(new Constructor));
// Set @@toStringTag to native iterators
setToStringTag(iterProto, NAME + ' Iterator', true);
// FF fix
has(proto, FF_ITERATOR) && setIterator(iterProto, returnThis);
}
}
// Plug for library
Iterators[NAME] = iter;
// FF & v8 fix
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 checkDangerIterClosing(fn){
var danger = true;
var O = {
next: function(){ throw 1 },
'return': function(){ danger = false }
};
O[SYMBOL_ITERATOR] = returnThis;
try {
fn(O);
} catch(e){}
return danger;
}
function closeIterator(iterator){
var ret = iterator['return'];
if(ret !== undefined)ret.call(iterator);
}
function safeIterClose(exec, iterator){
try {
exec(iterator);
} catch(e){
closeIterator(iterator);
throw e;
}
}
function forOf(iterable, entries, fn, that){
safeIterClose(function(iterator){
var f = ctx(fn, that, entries ? 2 : 1)
, step;
while(!(step = iterator.next()).done)if(stepCall(f, step.value, entries) === false){
return closeIterator(iterator);
}
}, getIterator(iterable));
}
/******************************************************************************
* Module : es6.symbol *
******************************************************************************/
// ECMAScript 6 symbols shim
!function(TAG, SymbolRegistry, AllSymbols, setter){
// 19.4.1.1 Symbol([description])
if(!isNative(Symbol)){
Symbol = function(description){
assert(!(this instanceof Symbol), SYMBOL + ' is not a ' + CONSTRUCTOR);
var tag = uid(description)
, sym = set(create(Symbol[PROTOTYPE]), TAG, tag);
AllSymbols[tag] = sym;
DESC && setter && defineProperty(ObjectProto, tag, {
configurable: true,
set: function(value){
hidden(this, tag, value);
}
});
return sym;
}
hidden(Symbol[PROTOTYPE], TO_STRING, function(){
return this[TAG];
});
}
$define(GLOBAL + WRAP, {Symbol: Symbol});
var symbolStatics = {
// 19.4.2.1 Symbol.for(key)
'for': function(key){
return has(SymbolRegistry, key += '')
? SymbolRegistry[key]
: SymbolRegistry[key] = Symbol(key);
},
// 19.4.2.4 Symbol.iterator
iterator: SYMBOL_ITERATOR || getWellKnownSymbol(ITERATOR),
// 19.4.2.5 Symbol.keyFor(sym)
keyFor: part.call(keyOf, SymbolRegistry),
// 19.4.2.10 Symbol.species
species: SYMBOL_SPECIES,
// 19.4.2.13 Symbol.toStringTag
toStringTag: SYMBOL_TAG = getWellKnownSymbol(TO_STRING_TAG, true),
// 19.4.2.14 Symbol.unscopables
unscopables: SYMBOL_UNSCOPABLES,
pure: safeSymbol,
set: set,
useSetter: function(){setter = true},
useSimple: function(){setter = false}
};
// 19.4.2.2 Symbol.hasInstance
// 19.4.2.3 Symbol.isConcatSpreadable
// 19.4.2.6 Symbol.match
// 19.4.2.8 Symbol.replace
// 19.4.2.9 Symbol.search
// 19.4.2.11 Symbol.split
// 19.4.2.12 Symbol.toPrimitive
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, {
// 19.1.2.7 Object.getOwnPropertyNames(O)
getOwnPropertyNames: function(it){
var names = getNames(toObject(it)), result = [], key, i = 0;
while(names.length > i)has(AllSymbols, key = names[i++]) || result.push(key);
return result;
},
// 19.1.2.8 Object.getOwnPropertySymbols(O)
getOwnPropertySymbols: function(it){
var names = getNames(toObject(it)), result = [], key, i = 0;
while(names.length > i)has(AllSymbols, key = names[i++]) && result.push(AllSymbols[key]);
return result;
}
});
// 20.2.1.9 Math[@@toStringTag]
setToStringTag(Math, MATH, true);
// 24.3.3 JSON[@@toStringTag]
setToStringTag(global.JSON, 'JSON', true);
}(safeSymbol('tag'), {}, {}, true);
/******************************************************************************
* Module : es6.object.statics *
******************************************************************************/
!function(){
var objectStatic = {
// 19.1.3.1 Object.assign(target, source)
assign: assign,
// 19.1.3.10 Object.is(value1, value2)
is: function(x, y){
return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
}
};
// 19.1.3.19 Object.setPrototypeOf(O, proto)
// Works with __proto__ only. Old v8 can't works with null proto objects.
'__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);
}();
/******************************************************************************
* Module : es6.object.prototype *
******************************************************************************/
!function(tmp){
// 19.1.3.6 Object.prototype.toString()
tmp[SYMBOL_TAG] = DOT;
if(cof(tmp) != DOT)hidden(ObjectProto, TO_STRING, function(){
return '[object ' + classof(this) + ']';
});
}({});
/******************************************************************************
* Module : es6.object.statics-accept-primitives *
******************************************************************************/
!function(){
// Object static methods accept primitives
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');
}();
/******************************************************************************
* Module : es6.function *
******************************************************************************/
!function(NAME){
// 19.2.4.2 name
NAME in FunctionProto || (DESC && 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));
}
}));
}('name');
/******************************************************************************
* Module : es6.number.constructor *
******************************************************************************/
Number('0o1') && Number('0b1') || function(_Number, NumberProto){
function toNumber(it){
if(isObject(it))it = toPrimitive(it);
if(typeof it == 'string' && it.length > 2 && it.charCodeAt(0) == 48){
var binary = false;
switch(it.charCodeAt(1)){
case 66 : case 98 : binary = true;
case 79 : case 111 : return parseInt(it.slice(2), binary ? 2 : 8);
}
} return +it;
}
function toPrimitive(it){
var fn, val;
if(isFunction(fn = it.valueOf) && !isObject(val = fn.call(it)))return val;
if(isFunction(fn = it[TO_STRING]) && !isObject(val = fn.call(it)))return val;
throw TypeError("Can't convert object to number");
}
Number = function Number(it){
return this instanceof Number ? new _Number(toNumber(it)) : toNumber(it);
}
forEach.call(DESC ? getNames(_Number)
: array('MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY'), function(key){
key in Number || defineProperty(Number, key, getOwnDescriptor(_Number, key));
});
Number[PROTOTYPE] = NumberProto;
NumberProto[CONSTRUCTOR] = Number;
hidden(global, NUMBER, Number);
}(Number, Number[PROTOTYPE]);
/******************************************************************************
* Module : es6.number.statics *
******************************************************************************/
!function(isInteger){
$define(STATIC, NUMBER, {
// 20.1.2.1 Number.EPSILON
EPSILON: pow(2, -52),
// 20.1.2.2 Number.isFinite(number)
isFinite: function(it){
return typeof it == 'number' && isFinite(it);
},
// 20.1.2.3 Number.isInteger(number)
isInteger: isInteger,
// 20.1.2.4 Number.isNaN(number)
isNaN: sameNaN,
// 20.1.2.5 Number.isSafeInteger(number)
isSafeInteger: function(number){
return isInteger(number) && abs(number) <= MAX_SAFE_INTEGER;
},
// 20.1.2.6 Number.MAX_SAFE_INTEGER
MAX_SAFE_INTEGER: MAX_SAFE_INTEGER,
// 20.1.2.10 Number.MIN_SAFE_INTEGER
MIN_SAFE_INTEGER: -MAX_SAFE_INTEGER,
// 20.1.2.12 Number.parseFloat(string)
parseFloat: parseFloat,
// 20.1.2.13 Number.parseInt(string, radix)
parseInt: parseInt
});
// 20.1.2.3 Number.isInteger(number)
}(Number.isInteger || function(it){
return !isObject(it) && isFinite(it) && floor(it) === it;
});
/******************************************************************************
* Module : es6.math *
******************************************************************************/
// ECMAScript 6 shim
!function(){
// 20.2.2.28 Math.sign(x)
var E = Math.E
, exp = Math.exp
, log = Math.log
, sqrt = Math.sqrt
, sign = Math.sign || function(x){
return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1;
};
// 20.2.2.5 Math.asinh(x)
function asinh(x){
return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : log(x + sqrt(x * x + 1));
}
// 20.2.2.14 Math.expm1(x)
function expm1(x){
return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : exp(x) - 1;
}
$define(STATIC, MATH, {
// 20.2.2.3 Math.acosh(x)
acosh: function(x){
return (x = +x) < 1 ? NaN : isFinite(x) ? log(x / E + sqrt(x + 1) * sqrt(x - 1) / E) + 1 : x;
},
// 20.2.2.5 Math.asinh(x)
asinh: asinh,
// 20.2.2.7 Math.atanh(x)
atanh: function(x){
return (x = +x) == 0 ? x : log((1 + x) / (1 - x)) / 2;
},
// 20.2.2.9 Math.cbrt(x)
cbrt: function(x){
return sign(x = +x) * pow(abs(x), 1 / 3);
},
// 20.2.2.11 Math.clz32(x)
clz32: function(x){
return (x >>>= 0) ? 32 - x[TO_STRING](2).length : 32;
},
// 20.2.2.12 Math.cosh(x)
cosh: function(x){
return (exp(x = +x) + exp(-x)) / 2;
},
// 20.2.2.14 Math.expm1(x)
expm1: expm1,
// 20.2.2.16 Math.fround(x)
// TODO: fallback for IE9-
fround: function(x){
return new Float32Array([x])[0];
},
// 20.2.2.17 Math.hypot([value1[, value2[, … ]]])
hypot: function(value1, value2){
var sum = 0
, len1 = arguments.length
, len2 = len1
, args = Array(len1)
, larg = -Infinity
, arg;
while(len1--){
arg = args[len1] = +arguments[len1];
if(arg == Infinity || arg == -Infinity)return Infinity;
if(arg > larg)larg = arg;
}
larg = arg || 1;
while(len2--)sum += pow(args[len2] / larg, 2);
return larg * sqrt(sum);
},
// 20.2.2.18 Math.imul(x, y)
imul: function(x, y){
var UInt16 = 0xffff
, xn = +x
, yn = +y
, xl = UInt16 & xn
, yl = UInt16 & yn;
return 0 | xl * yl + ((UInt16 & xn >>> 16) * yl + xl * (UInt16 & yn >>> 16) << 16 >>> 0);
},
// 20.2.2.20 Math.log1p(x)
log1p: function(x){
return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : log(1 + x);
},
// 20.2.2.21 Math.log10(x)
log10: function(x){
return log(x) / Math.LN10;
},
// 20.2.2.22 Math.log2(x)
log2: function(x){
return log(x) / Math.LN2;
},
// 20.2.2.28 Math.sign(x)
sign: sign,
// 20.2.2.30 Math.sinh(x)
sinh: function(x){
return (abs(x = +x) < 1) ? (expm1(x) - expm1(-x)) / 2 : (exp(x - 1) - exp(-x - 1)) * (E / 2);
},
// 20.2.2.33 Math.tanh(x)
tanh: function(x){
var a = expm1(x = +x)
, b = expm1(-x);
return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(x) + exp(-x));
},
// 20.2.2.34 Math.trunc(x)
trunc: trunc
});
}();
/******************************************************************************
* Module : es6.string *
******************************************************************************/
!function(fromCharCode){
function assertNotRegExp(it){
if(cof(it) == REGEXP)throw TypeError();
}
$define(STATIC, STRING, {
// 21.1.2.2 String.fromCodePoint(...codePoints)
fromCodePoint: function(x){
var res = []
, len = arguments.length
, i = 0
, code
while(len > i){
code = +arguments[i++];
if(toIndex(code, 0x10ffff) !== code)throw RangeError(code + ' is not a valid code point');
res.push(code < 0x10000
? fromCharCode(code)
: fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)
);
} return res.join('');
},
// 21.1.2.4 String.raw(callSite, ...substitutions)
raw: function(callSite){
var raw = toObject(callSite.raw)
, len = toLength(raw.length)
, sln = arguments.length
, res = []
, i = 0;
while(len > i){
res.push(String(raw[i++]));
if(i < sln)res.push(String(arguments[i]));
} return res.join('');
}
});
$define(PROTO, STRING, {
// 21.1.3.3 String.prototype.codePointAt(pos)
codePointAt: createPointAt(false),
// 21.1.3.6 String.prototype.endsWith(searchString [, endPosition])
endsWith: function(searchString /*, endPosition = @length */){
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;
},
// 21.1.3.7 String.prototype.includes(searchString, position = 0)
includes: function(searchString /*, position = 0 */){
assertNotRegExp(searchString);
return !!~String(assertDefined(this)).indexOf(searchString, arguments[1]);
},
// 21.1.3.13 String.prototype.repeat(count)
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;
},
// 21.1.3.18 String.prototype.startsWith(searchString [, position ])
startsWith: function(searchString /*, position = 0 */){
assertNotRegExp(searchString);
var that = String(assertDefined(this))
, index = toLength(min(arguments[1], that.length));
searchString += '';
return that.slice(index, index + searchString.length) === searchString;
}
});
}(String.fromCharCode);
/******************************************************************************
* Module : es6.array.statics *
******************************************************************************/
!function(){
$define(STATIC + FORCED * checkDangerIterClosing(Array.from), ARRAY, {
// 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)
from: function(arrayLike/*, mapfn = undefined, thisArg = undefined*/){
var O = Object(assertDefined(arrayLike))
, mapfn = arguments[1]
, mapping = mapfn !== undefined
, f = mapping ? ctx(mapfn, arguments[2], 2) : undefined
, index = 0
, length, result, step;
if(isIterable(O)){
result = new (generic(this, Array));
safeIterClose(function(iterator){
for(; !(step = iterator.next()).done; index++){
result[index] = mapping ? f(step.value, index) : step.value;
}
}, getIterator(O));
} else {
result = new (generic(this, Array))(length = toLength(O.length));
for(; length > index; index++){
result[index] = mapping ? f(O[index], index) : O[index];
}
}
result.length = index;
return result;
}
});
$define(STATIC, ARRAY, {
// 22.1.2.3 Array.of( ...items)
of: function(/* ...args */){
var index = 0
, length = arguments.length
, result = new (generic(this, Array))(length);
while(length > index)result[index] = arguments[index++];
result.length = length;
return result;
}
});
setSpecies(Array);
}();
/******************************************************************************
* Module : es6.array.prototype *
******************************************************************************/
!function(){
$define(PROTO, ARRAY, {
// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length)
copyWithin: function(target /* = 0 */, start /* = 0, end = @length */){
var O = Object(assertDefined(this))
, len = toLength(O.length)
, to = toIndex(target, len)
, from = toIndex(start, len)
, end = arguments[2]
, fin = end === undefined ? len : toIndex(end, len)
, count = 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;
},
// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length)
fill: function(value /*, start = 0, end = @length */){
var O = Object(assertDefined(this))
, length = toLength(O.length)
, index = toIndex(arguments[1], length)
, end = arguments[2]
, endPos = end === undefined ? length : toIndex(end, length);
while(endPos > index)O[index++] = value;
return O;
},
// 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined)
find: createArrayMethod(5),
// 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined)
findIndex: createArrayMethod(6)
});
if(framework){
// 22.1.3.31 Array.prototype[@@unscopables]
forEach.call(array('find,findIndex,fill,copyWithin,entries,keys,values'), function(it){
ArrayUnscopables[it] = true;
});
SYMBOL_UNSCOPABLES in ArrayProto || hidden(ArrayProto, SYMBOL_UNSCOPABLES, ArrayUnscopables);
}
}();
/******************************************************************************
* Module : es6.iterators *
******************************************************************************/
!function(at){
// 22.1.3.4 Array.prototype.entries()
// 22.1.3.13 Array.prototype.keys()
// 22.1.3.29 Array.prototype.values()
// 22.1.3.30 Array.prototype[@@iterator]()
defineStdIterators(Array, ARRAY, function(iterated, kind){
set(this, ITER, {o: toObject(iterated), i: 0, k: kind});
// 22.1.5.2.1 %ArrayIteratorPrototype%.next()
}, function(){
var iter = this[ITER]
, O = iter.o
, kind = iter.k
, index = iter.i++;
if(!O || index >= O.length){
iter.o = undefined;
return iterResult(1);
}
if(kind == KEY) return iterResult(0, index);
if(kind == VALUE)return iterResult(0, O[index]);
return iterResult(0, [index, O[index]]);
}, VALUE);
// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
Iterators[ARGUMENTS] = Iterators[ARRAY];
// 21.1.3.27 String.prototype[@@iterator]()
defineStdIterators(String, STRING, function(iterated){
set(this, ITER, {o: String(iterated), i: 0});
// 21.1.5.2.1 %StringIteratorPrototype%.next()
}, function(){
var iter = this[ITER]
, O = iter.o
, index = iter.i
, point;
if(index >= O.length)return iterResult(1);
point = at.call(O, index);
iter.i += point.length;
return iterResult(0, point);
});
}(createPointAt(true));
/******************************************************************************
* Module : es6.regexp *
******************************************************************************/
DESC && !function(RegExpProto, _RegExp){
// RegExp allows a regex with flags as the pattern
if(!function(){try{return RegExp(/a/g, 'i') == '/a/i'}catch(e){}}()){
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);
}
// 21.2.5.3 get RegExp.prototype.flags()
if(/./g.flags != 'g')defineProperty(RegExpProto, 'flags', {
configurable: true,
get: createReplacer(/^.*\/(\w*)$/, '$1')
});
setSpecies(RegExp);
}(RegExp[PROTOTYPE], RegExp);
/******************************************************************************
* Module : web.immediate *
******************************************************************************/
// setImmediate shim
// Node.js 0.9+ & IE10+ has setImmediate, else:
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);
}
// Node.js 0.8-
if(NODE){
defer = function(id){
nextTick(part.call(run, id));
}
// Modern browsers, skip implementation for WebWorkers
// IE8 has postMessage, but it's sync & typeof its postMessage is object
} else if(addEventListener && isFunction(postMessage) && !global.importScripts){
defer = function(id){
postMessage(id, '*');
}
addEventListener('message', listner, false);
// WebWorkers
} else if(isFunction(MessageChannel)){
channel = new MessageChannel;
port = channel.port2;
channel.port1.onmessage = listner;
defer = ctx(port.postMessage, port, 1);
// IE8-
} else if(document && ONREADYSTATECHANGE in document[CREATE_ELEMENT]('script')){
defer = function(id){
html.appendChild(document[CREATE_ELEMENT]('script'))[ONREADYSTATECHANGE] = function(){
html.removeChild(this);
run(id);
}
}
// Rest old browsers
} else {
defer = function(id){
setTimeout(run, 0, id);
}
}
}('onreadystatechange');
$define(GLOBAL + BIND, {
setImmediate: setImmediate,
clearImmediate: clearImmediate
});
/******************************************************************************
* Module : es6.promise *
******************************************************************************/
// ES6 promises shim
// Based on https://github.com/getify/native-promise-only/
!function(Promise, test){
isFunction(Promise) && isFunction(Promise.resolve)
&& Promise.resolve(test = new Promise(function(){})) == test
|| function(asap, RECORD){
function isThenable(it){
var then;
if(isObject(it))then = it.then;
return isFunction(then) ? then : false;
}
function handledRejectionOrHasOnRejected(promise){
var record = promise[RECORD]
, chain = record.c
, i = 0
, react;
if(record.h)return true;
while(chain.length > i){
react = chain[i++];
if(react.fail || handledRejectionOrHasOnRejected(react.P))return true;
}
}
function notify(record, reject){
var chain = record.c;
if(reject || chain.length)asap(function(){
var promise = record.p
, value = record.v
, ok = record.s == 1
, i = 0;
if(reject && !handledRejectionOrHasOnRejected(promise)){
setTimeout(function(){
if(!handledRejectionOrHasOnRejected(promise)){
if(NODE){
if(!process.emit('unhandledRejection', value, promise)){
// default node.js behavior
}
} else if(isFunction(console.error)){
console.error('Unhandled promise rejection', value);
}
}
}, 1e3);
} else while(chain.length > i)!function(react){
var cb = ok ? react.ok : react.fail
, ret, then;
try {
if(cb){
if(!ok)record.h = true;
ret = cb === true ? value : cb(value);
if(ret === react.P){
react.rej(TypeError(PROMISE + '-chain cycle'));
} else if(then = isThenable(ret)){
then.call(ret, react.res, react.rej);
} else react.res(ret);
} else react.rej(value);
} catch(err){
react.rej(err);
}
}(chain[i++]);
chain.length = 0;
});
}
function resolve(value){
var record = this
, then, wrapper;
if(record.d)return;
record.d = true;
record = record.r || record; // unwrap
try {
if(then = isThenable(value)){
wrapper = {r: record, d: false}; // wrap
then.call(value, ctx(resolve, wrapper, 1), ctx(reject, wrapper, 1));
} else {
record.v = value;
record.s = 1;
notify(record);
}
} catch(err){
reject.call(wrapper || {r: record, d: false}, err); // wrap
}
}
function reject(value){
var record = this;
if(record.d)return;
record.d = true;
record = record.r || record; // unwrap
record.v = value;
record.s = 2;
notify(record, true);
}
function getConstructor(C){
var S = assertObject(C)[SYMBOL_SPECIES];
return S != undefined ? S : C;
}
// 25.4.3.1 Promise(executor)
Promise = function(executor){
assertFunction(executor);
assertInstance(this, Promise, PROMISE);
var record = {
p: this, // promise
c: [], // chain
s: 0, // state
d: false, // done
v: undefined, // value
h: false // handled rejection
};
hidden(this, RECORD, record);
try {
executor(ctx(resolve, record, 1), ctx(reject, record, 1));
} catch(err){
reject.call(record, err);
}
}
assignHidden(Promise[PROTOTYPE], {
// 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
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);
}), record = this[RECORD];
record.c.push(react);
record.s && notify(record);
return P;
},
// 25.4.5.1 Promise.prototype.catch(onRejected)
'catch': function(onRejected){
return this.then(undefined, onRejected);
}
});
assignHidden(Promise, {
// 25.4.4.1 Promise.all(iterable)
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);
});
},
// 25.4.4.4 Promise.race(iterable)
race: function(iterable){
var Promise = getConstructor(this);
return new Promise(function(resolve, reject){
forOf(iterable, false, function(promise){
Promise.resolve(promise).then(resolve, reject);
});
});
},
// 25.4.4.5 Promise.reject(r)
reject: function(r){
return new (getConstructor(this))(function(resolve, reject){
reject(r);
});
},
// 25.4.4.6 Promise.resolve(x)
resolve: function(x){
return isObject(x) && RECORD in x && getPrototypeOf(x) === this[PROTOTYPE]
? x : new (getConstructor(this))(function(resolve, reject){
resolve(x);
});
}
});
}(nextTick || setImmediate, safeSymbol('record'));
setToStringTag(Promise, PROMISE);
setSpecies(Promise);
$define(GLOBAL + FORCED * !isNative(Promise), {Promise: Promise});
}(global[PROMISE]);
/******************************************************************************
* Module : es6.collections *
******************************************************************************/
// ECMAScript 6 collections shim
!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')))){
// create collection constructor
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 || !DESC || defineProperty(C[PROTOTYPE], 'size', {get: function(){
return assertDefined(this[SIZE]);
}});
} else {
var Native = C
, inst = new C
, chain = inst[ADDER](isWeak ? {} : -0, 1)
, buggyZero;
// wrap to init collections from iterable
if(checkDangerIterClosing(function(O){ new C(O) })){
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;
});
// fix converting -0 key to +0
if(buggyZero){
fixSVZ('delete');
fixSVZ('has');
isMap && fixSVZ('get');
}
// + fix .add & .set for chaining
if(buggyZero || chain !== inst)fixSVZ(ADDER, true);
}
setToStringTag(C, NAME);
setSpecies(C);
O[NAME] = C;
$define(GLOBAL + WRAP + FORCED * !isNative(C), O);
// add .keys, .values, .entries, [@@iterator]
// 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11
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;
// revert to the last existing entry
while(entry && entry.r)entry = entry.p;
// get next entry
if(!iter.o || !(iter.l = entry = entry ? entry.n : iter.o[FIRST])){
// or finish the iteration
iter.o = undefined;
return iterResult(1);
}
// return step by kind
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){
// return primitive with prefix
if(!isObject(it))return (typeof it == 'string' ? 'S' : 'P') + it;
// can't set id to frozen object
if(isFrozen(it))return 'F';
if(!has(it, UID)){
// not necessary to add id
if(!create)return 'E';
// add missing object id
hidden(it, UID, ++uid);
// return object id with prefix
} return 'O' + it[UID];
}
function getEntry(that, key){
// fast case
var index = fastKey(key), entry;
if(index != 'F')return that[O1][index];
// frozen object case
for(entry = that[FIRST]; entry; entry = entry.n){
if(entry.k == key)return entry;
}
}
function def(that, key, value){
var entry = getEntry(that, key)
, prev, index;
// change existing entry
if(entry)entry.v = value;
// create new entry
else {
that[LAST] = entry = {
i: index = fastKey(key, true), // <- index
k: key, // <- key
v: value, // <- value
p: prev = that[LAST], // <- previous entry
n: undefined, // <- next entry
r: false // <- removed
};
if(!that[FIRST])that[FIRST] = entry;
if(prev)prev.n = entry;
that[SIZE]++;
// add to index
if(index != 'F')that[O1][index] = entry;
} return that;
}
var collectionMethods = {
// 23.1.3.1 Map.prototype.clear()
// 23.2.3.2 Set.prototype.clear()
clear: function(){
for(var that = this, data = that[O1], entry = that[FIRST]; entry; entry = entry.n){
entry.r = true;
if(entry.p)entry.p = entry.p.n = undefined;
delete data[entry.i];
}
that[FIRST] = that[LAST] = undefined;
that[SIZE] = 0;
},
// 23.1.3.3 Map.prototype.delete(key)
// 23.2.3.4 Set.prototype.delete(value)
'delete': function(key){
var that = this
, entry = getEntry(that, key);
if(entry){
var next = entry.n
, prev = entry.p;
delete that[O1][entry.i];
entry.r = true;
if(prev)prev.n = next;
if(next)next.p = prev;
if(that[FIRST] == entry)that[FIRST] = next;
if(that[LAST] == entry)that[LAST] = prev;
that[SIZE]--;
} return !!entry;
},
// 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
// 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
forEach: function(callbackfn /*, that = undefined */){
var f = ctx(callbackfn, arguments[1], 3)
, entry;
while(entry = entry ? entry.n : this[FIRST]){
f(entry.v, entry.k, this);
// revert to the last existing entry
while(entry && entry.r)entry = entry.p;
}
},
// 23.1.3.7 Map.prototype.has(key)
// 23.2.3.7 Set.prototype.has(value)
has: function(key){
return !!getEntry(this, key);
}
}
// 23.1 Map Objects
Map = getCollection(Map, MAP, {
// 23.1.3.6 Map.prototype.get(key)
get: function(key){
var entry = getEntry(this, key);
return entry && entry.v;
},
// 23.1.3.9 Map.prototype.set(key, value)
set: function(key, value){
return def(this, key === 0 ? 0 : key, value);
}
}, collectionMethods, true);
// 23.2 Set Objects
Set = getCollection(Set, SET, {
// 23.2.3.1 Set.prototype.add(value)
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 = {
// 23.3.3.2 WeakMap.prototype.delete(key)
// 23.4.3.3 WeakSet.prototype.delete(value)
'delete': function(key){
if(!isObject(key))return false;
if(isFrozen(key))return leakStore(this)['delete'](key);
return has(key, WEAK) && has(key[WEAK], this[UID]) && delete key[WEAK][this[UID]];
},
// 23.3.3.4 WeakMap.prototype.has(key)
// 23.4.3.4 WeakSet.prototype.has(value)
has: function(key){
if(!isObject(key))return false;
if(isFrozen(key))return leakStore(this).has(key);
return has(key, WEAK) && has(key[WEAK], this[UID]);
}
};
// 23.3 WeakMap Objects
WeakMap = getCollection(WeakMap, WEAKMAP, {
// 23.3.3.3 WeakMap.prototype.get(key)
get: function(key){
if(isObject(key)){
if(isFrozen(key))return leakStore(this).get(key);
if(has(key, WEAK))return key[WEAK][this[UID]];
}
},
// 23.3.3.5 WeakMap.prototype.set(key, value)
set: function(key, value){
return defWeak(this, key, value);
}
}, weakMethods, true, true);
// IE11 WeakMap frozen keys fix
if(framework && new WeakMap().set(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){
// store frozen objects on leaky map
if(isObject(a) && isFrozen(a)){
var result = leakStore(this)[key](a, b);
return key == 'set' ? this : result;
// store all the rest on native weakmap
} return method.call(this, a, b);
};
});
}
// 23.4 WeakSet Objects
WeakSet = getCollection(WeakSet, WEAKSET, {
// 23.4.3.1 WeakSet.prototype.add(value)
add: function(value){
return defWeak(this, value, true);
}
}, weakMethods, false, true);
}();
/******************************************************************************
* Module : es6.reflect *
******************************************************************************/
!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/*, receiver*/){
var receiver = arguments.length < 3 ? target : arguments[2]
, desc = getOwnDescriptor(assertObject(target), propertyKey), proto;
if(desc)return has(desc, 'value')
? desc.value
: desc.get === undefined
? undefined
: desc.get.call(receiver);
return isObject(proto = getPrototypeOf(target))
? reflectGet(proto, propertyKey, receiver)
: undefined;
}
function reflectSet(target, propertyKey, V/*, receiver*/){
var receiver = arguments.length < 4 ? target : arguments[3]
, ownDesc = getOwnDescriptor(assertObject(target), propertyKey)
, existingDescriptor, proto;
if(!ownDesc){
if(isObject(proto = getPrototypeOf(target))){
return reflectSet(proto, propertyKey, V, receiver);
}
ownDesc = descriptor(0);
}
if(has(ownDesc, 'value')){
if(ownDesc.writable === false || !isObject(receiver))return false;
existingDescriptor = getOwnDescriptor(receiver, propertyKey) || descriptor(0);
existingDescriptor.value = V;
return defineProperty(receiver, propertyKey, existingDescriptor), true;
}
return ownDesc.set === undefined
? false
: (ownDesc.set.call(receiver, V), true);
}
var isExtensible = Object.isExtensible || returnIt;
var reflect = {
// 26.1.1 Reflect.apply(target, thisArgument, argumentsList)
apply: ctx(call, apply, 3),
// 26.1.2 Reflect.construct(target, argumentsList [, newTarget])
construct: function(target, argumentsList /*, newTarget*/){
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;
},
// 26.1.3 Reflect.defineProperty(target, propertyKey, attributes)
defineProperty: wrap(defineProperty),
// 26.1.4 Reflect.deleteProperty(target, propertyKey)
deleteProperty: function(target, propertyKey){
var desc = getOwnDescriptor(assertObject(target), propertyKey);
return desc && !desc.configurable ? false : delete target[propertyKey];
},
// 26.1.5 Reflect.enumerate(target)
enumerate: function(target){
return new Enumerate(assertObject(target));
},
// 26.1.6 Reflect.get(target, propertyKey [, receiver])
get: reflectGet,
// 26.1.7 Reflect.getOwnPropertyDescriptor(target, propertyKey)
getOwnPropertyDescriptor: function(target, propertyKey){
return getOwnDescriptor(assertObject(target), propertyKey);
},
// 26.1.8 Reflect.getPrototypeOf(target)
getPrototypeOf: function(target){
return getPrototypeOf(assertObject(target));
},
// 26.1.9 Reflect.has(target, propertyKey)
has: function(target, propertyKey){
return propertyKey in target;
},
// 26.1.10 Reflect.isExtensible(target)
isExtensible: function(target){
return !!isExtensible(assertObject(target));
},
// 26.1.11 Reflect.ownKeys(target)
ownKeys: ownKeys,
// 26.1.12 Reflect.preventExtensions(target)
preventExtensions: wrap(Object.preventExtensions || returnIt),
// 26.1.13 Reflect.set(target, propertyKey, V [, receiver])
set: reflectSet
}
// 26.1.14 Reflect.setPrototypeOf(target, proto)
if(setPrototypeOf)reflect.setPrototypeOf = function(target, proto){
return setPrototypeOf(assertObject(target), proto), true;
};
$define(GLOBAL, {Reflect: {}});
$define(STATIC, 'Reflect', reflect);
}();
/******************************************************************************
* Module : es7.proposals *
******************************************************************************/
!function(){
$define(PROTO, ARRAY, {
// https://github.com/domenic/Array.prototype.includes
includes: createArrayContains(true)
});
$define(PROTO, STRING, {
// https://github.com/mathiasbynens/String.prototype.at
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, {
// https://gist.github.com/WebReflection/9353781
getOwnPropertyDescriptors: function(object){
var O = toObject(object)
, result = {};
forEach.call(ownKeys(O), function(key){
defineProperty(result, key, descriptor(0, getOwnDescriptor(O, key)));
});
return result;
},
// https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-04/apr-9.md#51-objectentries-objectvalues
values: createObjectToArray(false),
entries: createObjectToArray(true)
});
$define(STATIC, REGEXP, {
// https://gist.github.com/kangax/9698100
escape: createReplacer(/([\\\-[\]{}()*+?.,^$|])/g, '\\$1', true)
});
}();
/******************************************************************************
* Module : es7.abstract-refs *
******************************************************************************/
// https://github.com/zenparsing/es-abstract-refs
!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');
/******************************************************************************
* Module : js.array.statics *
******************************************************************************/
// JavaScript 1.6 / Strawman array statics shim
!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);
}({});
/******************************************************************************
* Module : web.dom.itarable *
******************************************************************************/
!function(NodeList){
if(framework && NodeList && !(SYMBOL_ITERATOR in NodeList[PROTOTYPE])){
hidden(NodeList[PROTOTYPE], SYMBOL_ITERATOR, Iterators[ARRAY]);
}
Iterators.NodeList = Iterators[ARRAY];
}(global.NodeList);
}(typeof self != 'undefined' && self.Math === Math ? self : Function('return this')(), true);
/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global) {/**
* Copyright (c) 2014, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* https://raw.github.com/facebook/regenerator/master/LICENSE file. An
* additional grant of patent rights can be found in the PATENTS file in
* the same directory.
*/
!(function(global) {
"use strict";
var hasOwn = Object.prototype.hasOwnProperty;
var undefined; // More compressible than void 0.
var iteratorSymbol =
typeof Symbol === "function" && Symbol.iterator || "@@iterator";
var inModule = typeof module === "object";
var runtime = global.regeneratorRuntime;
if (runtime) {
if (inModule) {
// If regeneratorRuntime is defined globally and we're in a module,
// make the exports object identical to regeneratorRuntime.
module.exports = runtime;
}
// Don't bother evaluating the rest of this file if the runtime was
// already defined globally.
return;
}
// Define the runtime globally (as expected by generated code) as either
// module.exports (if we're in a module) or a new, empty object.
runtime = global.regeneratorRuntime = inModule ? module.exports : {};
function wrap(innerFn, outerFn, self, tryLocsList) {
return new Generator(innerFn, outerFn, self || null, tryLocsList || []);
}
runtime.wrap = wrap;
// Try/catch helper to minimize deoptimizations. Returns a completion
// record like context.tryEntries[i].completion. This interface could
// have been (and was previously) designed to take a closure to be
// invoked without arguments, but in all the cases we care about we
// already have an existing method we want to call, so there's no need
// to create a new function object. We can even get away with assuming
// the method takes exactly one argument, since that happens to be true
// in every case, so we don't have to touch the arguments object. The
// only additional allocation required is the completion record, which
// has a stable shape and so hopefully should be cheap to allocate.
function tryCatch(fn, obj, arg) {
try {
return { type: "normal", arg: fn.call(obj, arg) };
} catch (err) {
return { type: "throw", arg: err };
}
}
var GenStateSuspendedStart = "suspendedStart";
var GenStateSuspendedYield = "suspendedYield";
var GenStateExecuting = "executing";
var GenStateCompleted = "completed";
// Returning this object from the innerFn has the same effect as
// breaking out of the dispatch switch statement.
var ContinueSentinel = {};
// Dummy constructor functions that we use as the .constructor and
// .constructor.prototype properties for functions that return Generator
// objects. For full spec compliance, you may wish to configure your
// minifier not to mangle the names of these two functions.
function GeneratorFunction() {}
function GeneratorFunctionPrototype() {}
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype;
GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
GeneratorFunctionPrototype.constructor = GeneratorFunction;
GeneratorFunction.displayName = "GeneratorFunction";
runtime.isGeneratorFunction = function(genFun) {
var ctor = typeof genFun === "function" && genFun.constructor;
return ctor
? ctor === GeneratorFunction ||
// For the native GeneratorFunction constructor, the best we can
// do is to check its .name property.
(ctor.displayName || ctor.name) === "GeneratorFunction"
: false;
};
runtime.mark = function(genFun) {
genFun.__proto__ = GeneratorFunctionPrototype;
genFun.prototype = Object.create(Gp);
return genFun;
};
runtime.async = function(innerFn, outerFn, self, tryLocsList) {
return new Promise(function(resolve, reject) {
var generator = wrap(innerFn, outerFn, self, tryLocsList);
var callNext = step.bind(generator.next);
var callThrow = step.bind(generator["throw"]);
function step(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, tryLocsList) {
var generator = outerFn ? Object.create(outerFn.prototype) : this;
var context = new Context(tryLocsList);
var state = GenStateSuspendedStart;
function invoke(method, arg) {
if (state === GenStateExecuting) {
throw new Error("Generator is already running");
}
if (state === GenStateCompleted) {
// Be forgiving, per 25.3.3.3.3 of the spec:
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
return doneResult();
}
while (true) {
var delegate = context.delegate;
if (delegate) {
var record = tryCatch(
delegate.iterator[method],
delegate.iterator,
arg
);
if (record.type === "throw") {
context.delegate = null;
// Like returning generator.throw(uncaught), but without the
// overhead of an extra function call.
method = "throw";
arg = record.arg;
continue;
}
// Delegate generator ran and handled its own exceptions so
// regardless of what the method was, we continue as if it is
// "next" with an undefined arg.
method = "next";
arg = undefined;
var info = record.arg;
if (info.done) {
context[delegate.resultName] = info.value;
context.next = delegate.nextLoc;
} else {
state = GenStateSuspendedYield;
return info;
}
context.delegate = null;
}
if (method === "next") {
if (state === GenStateSuspendedStart &&
typeof arg !== "undefined") {
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
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)) {
// If the dispatched exception was caught by a catch block,
// then let that catch block handle the exception normally.
method = "next";
arg = undefined;
}
} else if (method === "return") {
context.abrupt("return", arg);
}
state = GenStateExecuting;
var record = tryCatch(innerFn, self, context);
if (record.type === "normal") {
// If an exception is thrown from innerFn, we leave state ===
// GenStateExecuting and loop back for another invocation.
state = context.done
? GenStateCompleted
: GenStateSuspendedYield;
var info = {
value: record.arg,
done: context.done
};
if (record.arg === ContinueSentinel) {
if (context.delegate && method === "next") {
// Deliberately forget the last sent value so that we don't
// accidentally pass it on to the delegate.
arg = undefined;
}
} else {
return info;
}
} else if (record.type === "throw") {
state = GenStateCompleted;
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(locs) {
var entry = { tryLoc: locs[0] };
if (1 in locs) {
entry.catchLoc = locs[1];
}
if (2 in locs) {
entry.finallyLoc = locs[2];
entry.afterLoc = locs[3];
}
this.tryEntries.push(entry);
}
function resetTryEntry(entry) {
var record = entry.completion || {};
record.type = "normal";
delete record.arg;
entry.completion = record;
}
function Context(tryLocsList) {
// The root entry object (effectively a try statement without a catch
// or a finally block) gives us a place to store values thrown from
// locations where there is no enclosing try statement.
this.tryEntries = [{ tryLoc: "root" }];
tryLocsList.forEach(pushTryEntry, this);
this.reset();
}
runtime.keys = function(object) {
var keys = [];
for (var key in object) {
keys.push(key);
}
keys.reverse();
// Rather than returning an object with a next method, we keep
// things simple and return the next function itself.
return function next() {
while (keys.length) {
var key = keys.pop();
if (key in object) {
next.value = key;
next.done = false;
return next;
}
}
// To avoid creating an additional object, we just hang the .value
// and .done properties off the next function object itself. This
// also ensures that the minifier will not anonymize the function.
next.done = true;
return next;
};
};
function values(iterable) {
if (iterable) {
var iteratorMethod = iterable[iteratorSymbol];
if (iteratorMethod) {
return iteratorMethod.call(iterable);
}
if (typeof iterable.next === "function") {
return iterable;
}
if (!isNaN(iterable.length)) {
var i = -1, next = function next() {
while (++i < iterable.length) {
if (hasOwn.call(iterable, i)) {
next.value = iterable[i];
next.done = false;
return next;
}
}
next.value = undefined;
next.done = true;
return next;
};
return next.next = next;
}
}
// Return an iterator with no values.
return { next: doneResult };
}
runtime.values = values;
function doneResult() {
return { value: undefined, done: true };
}
Context.prototype = {
constructor: Context,
reset: function() {
this.prev = 0;
this.next = 0;
this.sent = undefined;
this.done = false;
this.delegate = null;
this.tryEntries.forEach(resetTryEntry);
// Pre-initialize at least 20 temporary variables to enable hidden
// class optimizations for simple generators.
for (var tempIndex = 0, tempName;
hasOwn.call(this, tempName = "t" + tempIndex) || tempIndex < 20;
++tempIndex) {
this[tempName] = null;
}
},
stop: function() {
this.done = true;
var rootEntry = this.tryEntries[0];
var rootRecord = rootEntry.completion;
if (rootRecord.type === "throw") {
throw rootRecord.arg;
}
return this.rval;
},
dispatchException: function(exception) {
if (this.done) {
throw exception;
}
var context = this;
function handle(loc, caught) {
record.type = "throw";
record.arg = exception;
context.next = loc;
return !!caught;
}
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
var record = entry.completion;
if (entry.tryLoc === "root") {
// Exception thrown outside of any try block that could handle
// it, so set the completion value of the entire function to
// throw the exception.
return handle("end");
}
if (entry.tryLoc <= this.prev) {
var hasCatch = hasOwn.call(entry, "catchLoc");
var hasFinally = hasOwn.call(entry, "finallyLoc");
if (hasCatch && hasFinally) {
if (this.prev < entry.catchLoc) {
return handle(entry.catchLoc, true);
} else if (this.prev < entry.finallyLoc) {
return handle(entry.finallyLoc);
}
} else if (hasCatch) {
if (this.prev < entry.catchLoc) {
return handle(entry.catchLoc, true);
}
} else if (hasFinally) {
if (this.prev < entry.finallyLoc) {
return handle(entry.finallyLoc);
}
} else {
throw new Error("try statement without catch or finally");
}
}
}
},
abrupt: function(type, arg) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc <= this.prev &&
hasOwn.call(entry, "finallyLoc") &&
this.prev < entry.finallyLoc) {
var finallyEntry = entry;
break;
}
}
if (finallyEntry &&
(type === "break" ||
type === "continue") &&
finallyEntry.tryLoc <= arg &&
arg < finallyEntry.finallyLoc) {
// Ignore the finally entry if control is not jumping to a
// location outside the try/catch block.
finallyEntry = null;
}
var record = finallyEntry ? finallyEntry.completion : {};
record.type = type;
record.arg = arg;
if (finallyEntry) {
this.next = finallyEntry.finallyLoc;
} else {
this.complete(record);
}
return ContinueSentinel;
},
complete: function(record, afterLoc) {
if (record.type === "throw") {
throw record.arg;
}
if (record.type === "break" ||
record.type === "continue") {
this.next = record.arg;
} else if (record.type === "return") {
this.rval = record.arg;
this.next = "end";
} else if (record.type === "normal" && afterLoc) {
this.next = afterLoc;
}
return ContinueSentinel;
},
finish: function(finallyLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.finallyLoc === finallyLoc) {
return this.complete(entry.completion, entry.afterLoc);
}
}
},
"catch": function(tryLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc === tryLoc) {
var record = entry.completion;
if (record.type === "throw") {
var thrown = record.arg;
resetTryEntry(entry);
}
return thrown;
}
}
// The context.catch method must only be called with a location
// argument that corresponds to a known catch block.
throw new Error("illegal catch attempt");
},
delegateYield: function(iterable, resultName, nextLoc) {
this.delegate = {
iterator: values(iterable),
resultName: resultName,
nextLoc: nextLoc
};
return ContinueSentinel;
}
};
})(
// Among the various tricks for obtaining a reference to the global
// object, this seems to be the most reliable technique that does not
// use indirect eval (which violates Content Security Policy).
typeof global === "object" ? global :
typeof window === "object" ? window : this
);
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
/***/ },
/* 5 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; };
var _defaults = function (obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; };
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
Object.defineProperty(exports, "__esModule", {
value: true
});
var xdr = _interopRequire(__webpack_require__(33));
exports.xdr = xdr;
exports.hash = __webpack_require__(16).hash;
var _signing = __webpack_require__(77);
exports.sign = _signing.sign;
exports.verify = _signing.verify;
exports.Keypair = __webpack_require__(80).Keypair;
var _jsXdr = __webpack_require__(34);
exports.UnsignedHyper = _jsXdr.UnsignedHyper;
exports.Hyper = _jsXdr.Hyper;
exports.Transaction = __webpack_require__(31).Transaction;
exports.TransactionBuilder = __webpack_require__(6).TransactionBuilder;
exports.Currency = __webpack_require__(29).Currency;
exports.Operation = __webpack_require__(28).Operation;
exports.Memo = __webpack_require__(32).Memo;
exports.Account = __webpack_require__(7).Account;
_defaults(exports, _interopRequireWildcard(__webpack_require__(8)));
/***/ },
/* 6 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
Object.defineProperty(exports, "__esModule", {
value: true
});
var _index = __webpack_require__(5);
var xdr = _index.xdr;
var hash = _index.hash;
var Keypair = _index.Keypair;
var Account = __webpack_require__(7).Account;
var Operation = __webpack_require__(28).Operation;
var Transaction = __webpack_require__(31).Transaction;
var Memo = __webpack_require__(32).Memo;
var FEE = 1000;
var MIN_LEDGER = 0;
var MAX_LEDGER = 4294967295; // max uint32
/**
* @class TransactionBuilder
*/
var TransactionBuilder = exports.TransactionBuilder = (function () {
/**
* <p>Transaction builder helps constructs a new Transaction using the given account
* as the transaction's "source account". The transaction will use the current sequence
* number of the given account as its sequence number and increment the given account's
* sequence number by one. The given source account must include a private key for signing
* the transaction or an error will be thrown.</p>
*
* <p>Operations can be added to the transaction via their corresponding builder methods, and
* each returns the TransactionBuilder object so they can be chained together. After adding
* the desired operations, call the build() method on the TransactionBuilder to return a fully
* constructed Transaction that can be signed. The returned transaction will contain the
* sequence number of the source account and include the signature from the source account.</p>
*
* <p>The following code example creates a new transaction with two payment operations
* and a changeTrust operation. The Transaction's source account first funds destinationA,
* then extends a trust line to destination A for a currency, then destinationA sends the
* source account an amount of that currency. The built transaction would need to be signed by
* both the source acccount and the destinationA account for it to be valid.</p>
*
* <pre>var transaction = new TransactionBuilder(source)
* .addOperation(Operation.payment({
destination: destinationA,
amount: "20000000",
currency: Currency.native()
}) // <- funds and creates destinationA
* .build();
* </pre>
* @constructor
* @param {Account} sourceAccount - The source account for this transaction.
* @param {object} [opts]
* @param {number} [opts.fee] - The max fee willing to pay for this transaction.
* @param {object} [opts.timebounds] - The timebounds for the validity of this transaction.
* @param {string} [opts.timebounds.minTime] - 64 bit unix timestamp
* @param {string} [opts.timebounds.maxTime] - 64 bit unix timestamp
* @param {Memo} [opts.memo] - The memo for the transaction
* @param {}
*/
function TransactionBuilder(source) {
var opts = arguments[1] === undefined ? {} : arguments[1];
_classCallCheck(this, TransactionBuilder);
if (!source) {
throw new Error("must specify source account for the transaction");
}
this.source = source;
this.operations = [];
this.signers = [];
this.fee = opts.fee || FEE;
this.timebounds = opts.timebounds;
this.memo = opts.memo || Memo.none();
// the signed hex form of the transaction to be sent to Horizon
this.blob = null;
}
_createClass(TransactionBuilder, {
addOperation: {
/**
* Adds an operation to the transaction.
* @param {xdr.Operation} The xdr operation object, use {@link Operation} static methods.
*/
value: function addOperation(operation) {
this.operations.push(operation);
return this;
}
},
addSigner: {
/**
* Adds the given signer's signature to the transaction.
*/
value: function addSigner(keypair) {
this.signers.push(keypair);
return this;
}
},
build: {
/**
* This will build the transaction and sign it with the source account. It will
* also increment the source account's sequence number by 1.
* @returns {Transaction} will return the built Transaction.
*/
value: function build() {
var attrs = {
sourceAccount: Keypair.fromAddress(this.source.address).publicKey(),
fee: this.fee,
seqNum: xdr.SequenceNumber.fromString(String(Number(this.source.sequence) + 1)),
memo: this.memo
};
if (this.timebounds) {
attrs.timeBounds = new xdr.TimeBounds(this.timebounds);
}
var tx = new xdr.Transaction(attrs);
this.source.sequence = this.source.sequence + 1;
tx.operations(this.operations);
var tx_raw = tx.toXDR();
var tx_hash = hash(tx_raw);
var signatures = [];
for (var i = 0; i < this.signers.length; i++) {
signatures.push(this.signers[i].signDecorated(tx_hash));
}
var envelope = new xdr.TransactionEnvelope({ tx: tx, signatures: signatures });
return new Transaction(envelope);
}
}
});
return TransactionBuilder;
})();
/***/ },
/* 7 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
Object.defineProperty(exports, "__esModule", {
value: true
});
var decodeBase58Check = __webpack_require__(8).decodeBase58Check;
/**
* @class Account
*/
var Account = exports.Account = (function () {
/**
* Create a new Account object.
* @param {string} address
* @param {number} sequence
*/
function Account(address, sequence) {
_classCallCheck(this, Account);
this.address = address;
this.sequence = sequence;
}
_createClass(Account, null, {
isValidAddress: {
/**
* Returns true if the given address is a valid Stellar address.
*/
value: function isValidAddress(address) {
try {
decodeBase58Check("accountId", address);
} catch (err) {
return false;
}
return true;
}
}
});
return Account;
})();
/***/ },
/* 8 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(Buffer) {"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
exports.decodeBase58 = decodeBase58;
exports.decodeBase58Check = decodeBase58Check;
exports.encodeBase58 = encodeBase58;
exports.encodeBase58Check = encodeBase58Check;
Object.defineProperty(exports, "__esModule", {
value: true
});
var bs58 = _interopRequire(__webpack_require__(13));
var _lodash = __webpack_require__(14);
var isUndefined = _lodash.isUndefined;
var isNull = _lodash.isNull;
var hash = __webpack_require__(16).hash;
var nacl = __webpack_require__(26);
var versionBytes = {
accountId: 0, // decimal 0
none: 1, // decimal 1
seed: 33 };
function decodeBase58(encoded) {
return new Buffer(bs58.decode(encoded));
}
function decodeBase58Check(versionByteName, encoded) {
var decoded = bs58.decode(encoded);
var versionByte = decoded[0];
var payload = decoded.slice(0, decoded.length - 4);
var data = payload.slice(1);
var checksum = decoded.slice(decoded.length - 4);
var expectedVersion = versionBytes[versionByteName];
if (isUndefined(expectedVersion)) {
throw new Error("" + versionByteName + " is not a valid version byte name. expected one of \"accountId\", \"seed\", or \"none\"");
}
if (versionByte !== expectedVersion) {
throw new Error("invalid version byte. expected " + expectedVersion + ", got " + versionByte);
}
var expectedChecksum = calculateChecksum(payload);
if (!verifyChecksum(expectedChecksum, checksum)) {
throw new Error("invalid checksum");
}
if (versionByteName === "accountId" && decoded.length !== 37) {
throw new Error("Decoded address length is invalid. Expected 37, got " + decoded.length);
}
return new Buffer(data);
}
function encodeBase58(data) {
if (isNull(data) || isUndefined(data)) {
throw new Error("cannot encode null data");
}
return bs58.encode(data);
}
function encodeBase58Check(versionByteName, data) {
if (isNull(data) || isUndefined(data)) {
throw new Error("cannot encode null data");
}
var versionByte = versionBytes[versionByteName];
if (isUndefined(versionByte)) {
throw new Error("" + versionByteName + " is not a valid version byte name. expected one of \"accountId\", \"seed\", or \"none\"");
}
data = new Buffer(data);
var versionBuffer = new Buffer([versionByte]);
var payload = Buffer.concat([versionBuffer, data]);
var checksum = calculateChecksum(payload);
var unencoded = Buffer.concat([payload, checksum]);
return encodeBase58(unencoded);
}
function calculateChecksum(payload) {
var inner = hash(payload);
var outer = hash(inner);
return outer.slice(0, 4);
}
function verifyChecksum(expected, actual) {
if (expected.length !== actual.length) {
return false;
}
if (expected.length === 0) {
return true;
}
for (var i = 0; i < expected.length; i++) {
if (expected[i] !== actual[i]) {
return false;
}
}
return true;
}
// decimal 33
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(9).Buffer))
/***/ },
/* 9 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(Buffer) {/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
* @license MIT
*/
var base64 = __webpack_require__(10)
var ieee754 = __webpack_require__(11)
var isArray = __webpack_require__(12)
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 (arg) {
if (!(this instanceof Buffer)) {
// Avoid going through an ArgumentsAdaptorTrampoline in the common case.
if (arguments.length > 1) return new Buffer(arg, arguments[1])
return new Buffer(arg)
}
this.length = 0
this.parent = undefined
// Common case.
if (typeof arg === 'number') {
return fromNumber(this, arg)
}
// Slightly less common case.
if (typeof arg === 'string') {
return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')
}
// Unusual.
return fromObject(this, arg)
}
function fromNumber (that, length) {
that = allocate(that, length < 0 ? 0 : checked(length) | 0)
if (!Buffer.TYPED_ARRAY_SUPPORT) {
for (var i = 0; i < length; i++) {
that[i] = 0
}
}
return that
}
function fromString (that, string, encoding) {
if (typeof encoding !== 'string' || encoding === '') encoding = 'utf8'
// Assumption: byteLength() return value is always < kMaxLength.
var length = byteLength(string, encoding) | 0
that = allocate(that, length)
that.write(string, encoding)
return that
}
function fromObject (that, object) {
if (Buffer.isBuffer(object)) return fromBuffer(that, object)
if (isArray(object)) return fromArray(that, object)
if (object == null) {
throw new TypeError('must start with number, buffer, array or string')
}
if (typeof ArrayBuffer !== 'undefined' && object.buffer instanceof ArrayBuffer) {
return fromTypedArray(that, object)
}
if (object.length) return fromArrayLike(that, object)
return fromJsonObject(that, object)
}
function fromBuffer (that, buffer) {
var length = checked(buffer.length) | 0
that = allocate(that, length)
buffer.copy(that, 0, 0, length)
return that
}
function fromArray (that, array) {
var length = checked(array.length) | 0
that = allocate(that, length)
for (var i = 0; i < length; i += 1) {
that[i] = array[i] & 255
}
return that
}
// Duplicate of fromArray() to keep fromArray() monomorphic.
function fromTypedArray (that, array) {
var length = checked(array.length) | 0
that = allocate(that, length)
// Truncating the elements is probably not what people expect from typed
// arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior
// of the old Buffer constructor.
for (var i = 0; i < length; i += 1) {
that[i] = array[i] & 255
}
return that
}
function fromArrayLike (that, array) {
var length = checked(array.length) | 0
that = allocate(that, length)
for (var i = 0; i < length; i += 1) {
that[i] = array[i] & 255
}
return that
}
// Deserialize { type: 'Buffer', data: [1,2,3,...] } into a Buffer object.
// Returns a zero-length buffer for inputs that don't conform to the spec.
function fromJsonObject (that, object) {
var array
var length = 0
if (object.type === 'Buffer' && isArray(object.data)) {
array = object.data
length = checked(array.length) | 0
}
that = allocate(that, length)
for (var i = 0; i < length; i += 1) {
that[i] = array[i] & 255
}
return that
}
function allocate (that, length) {
if (Buffer.TYPED_ARRAY_SUPPORT) {
// Return an augmented `Uint8Array` instance, for best performance
that = Buffer._augment(new Uint8Array(length))
} else {
// Fallback: Return an object instance of the Buffer class
that.length = length
that._isBuffer = true
}
var fromPool = length !== 0 && length <= Buffer.poolSize >>> 1
if (fromPool) that.parent = rootParent
return that
}
function checked (length) {
// Note: cannot use `length < kMaxLength` here because that fails when
// length is NaN (which is otherwise coerced to zero.)
if (length >= kMaxLength) {
throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
'size: 0x' + kMaxLength.toString(16) + ' bytes')
}
return length | 0
}
function SlowBuffer (subject, encoding) {
if (!(this instanceof SlowBuffer)) return new SlowBuffer(subject, encoding)
var buf = new Buffer(subject, encoding)
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
var i = 0
var len = Math.min(x, y)
while (i < len) {
if (a[i] !== b[i]) break
++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, length) {
if (!isArray(list)) throw new TypeError('list argument must be an Array of Buffers.')
if (list.length === 0) {
return new Buffer(0)
} else if (list.length === 1) {
return list[0]
}
var i
if (length === undefined) {
length = 0
for (i = 0; i < list.length; i++) {
length += list[i].length
}
}
var buf = new Buffer(length)
var pos = 0
for (i = 0; i < list.length; i++) {
var item = list[i]
item.copy(buf, pos)
pos += item.length
}
return buf
}
function byteLength (string, encoding) {
if (typeof string !== 'string') string = String(string)
if (string.length === 0) return 0
switch (encoding || 'utf8') {
case 'ascii':
case 'binary':
case 'raw':
return string.length
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return string.length * 2
case 'hex':
return string.length >>> 1
case 'utf8':
case 'utf-8':
return utf8ToBytes(string).length
case 'base64':
return base64ToBytes(string).length
default:
return string.length
}
}
Buffer.byteLength = byteLength
// 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) {
return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
}
function asciiWrite (buf, string, offset, length) {
return blitBuffer(asciiToBytes(string), buf, offset, length)
}
function binaryWrite (buf, string, offset, length) {
return asciiWrite(buf, string, offset, length)
}
function base64Write (buf, string, offset, length) {
return blitBuffer(base64ToBytes(string), buf, offset, length)
}
function ucs2Write (buf, string, offset, length) {
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
}
Buffer.prototype.write = function write (string, offset, length, encoding) {
// Buffer#write(string)
if (offset === undefined) {
encoding = 'utf8'
length = this.length
offset = 0
// Buffer#write(string, encoding)
} else if (length === undefined && typeof offset === 'string') {
encoding = offset
length = this.length
offset = 0
// Buffer#write(string, offset[, length][, encoding])
} else if (isFinite(offset)) {
offset = offset | 0
if (isFinite(length)) {
length = length | 0
if (encoding === undefined) encoding = 'utf8'
} else {
encoding = length
length = undefined
}
// legacy write(string, encoding, offset, length) - remove in v0.13
} else {
var swap = encoding
encoding = offset
offset = length | 0
length = swap
}
var remaining = this.length - offset
if (length === undefined || length > remaining) length = remaining
if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
throw new RangeError('attempt to write outside buffer bounds')
}
if (!encoding) encoding = 'utf8'
var loweredCase = false
for (;;) {
switch (encoding) {
case 'hex':
return hexWrite(this, string, offset, length)
case 'utf8':
case 'utf-8':
return utf8Write(this, string, offset, length)
case 'ascii':
return asciiWrite(this, string, offset, length)
case 'binary':
return binaryWrite(this, string, offset, length)
case 'base64':
// Warning: maxLength not taken into account in base64Write
return base64Write(this, string, offset, length)
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return ucs2Write(this, string, offset, length)
default:
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
encoding = ('' + encoding).toLowerCase()
loweredCase = true
}
}
}
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)
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) & 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) & 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) {
var limit = Math.pow(2, 8 * byteLength - 1)
checkInt(this, value, offset, byteLength, limit - 1, -limit)
}
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) {
var limit = Math.pow(2, 8 * byteLength - 1)
checkInt(this, value, offset, byteLength, limit - 1, -limit)
}
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, targetStart, start, end) {
if (!start) start = 0
if (!end && end !== 0) end = this.length
if (targetStart >= target.length) targetStart = target.length
if (!targetStart) targetStart = 0
if (end > 0 && end < start) end = start
// Copy 0 bytes; we're done
if (end === start) return 0
if (target.length === 0 || this.length === 0) return 0
// Fatal error conditions
if (targetStart < 0) {
throw new RangeError('targetStart out of bounds')
}
if (start < 0 || start >= this.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 - targetStart < end - start) {
end = target.length - targetStart + start
}
var len = end - start
if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
for (var i = 0; i < len; i++) {
target[i + targetStart] = this[i + start]
}
} else {
target._set(this.subarray(start, start + len), targetStart)
}
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 set method before overwriting
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 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
}
}
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(9).Buffer))
/***/ },
/* 10 */
/***/ function(module, exports, __webpack_require__) {
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
}(false ? (this.base64js = {}) : exports))
/***/ },
/* 11 */
/***/ function(module, exports, __webpack_require__) {
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
}
/***/ },
/* 12 */
/***/ function(module, exports, __webpack_require__) {
/**
* 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);
};
/***/ },
/* 13 */
/***/ function(module, exports, __webpack_require__) {
// vendored from http://cryptocoinjs.com/modules/misc/bs58/
// Base58 encoding/decoding
// Originally written by Mike Hearn for BitcoinJ
// Copyright (c) 2011 Google Inc
// Ported to JavaScript by Stefan Thomas
// Merged Buffer refactorings from base58-native by Stephen Pair
// Copyright (c) 2013 BitPay Inc
"use strict";
var ALPHABET = "gsphnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCr65jkm8oFqi1tuvAxyz";
var ALPHABET_MAP = {};
for (var i = 0; i < ALPHABET.length; ++i) {
ALPHABET_MAP[ALPHABET.charAt(i)] = i;
}
var BASE = 58;
function encode(buffer) {
if (buffer.length === 0) {
return "";
}var i,
j,
digits = [0];
for (i = 0; i < buffer.length; ++i) {
for (j = 0; j < digits.length; ++j) digits[j] <<= 8;
digits[0] += buffer[i];
var carry = 0;
for (j = 0; j < digits.length; ++j) {
digits[j] += carry;
carry = digits[j] / BASE | 0;
digits[j] %= BASE;
}
while (carry) {
digits.push(carry % BASE);
carry = carry / BASE | 0;
}
}
// deal with leading zeros
for (i = 0; buffer[i] === 0 && i < buffer.length - 1; ++i) digits.push(0);
// convert digits to a string
var str = "";
for (i = digits.length - 1; i >= 0; --i) {
str += ALPHABET[digits[i]];
}
return str;
}
function decode(string) {
if (string.length === 0) {
return [];
}var i,
j,
bytes = [0];
for (i = 0; i < string.length; ++i) {
var c = string[i];
if (!(c in ALPHABET_MAP)) throw new Error("Non-base58 character");
for (j = 0; j < bytes.length; ++j) bytes[j] *= BASE;
bytes[0] += ALPHABET_MAP[c];
var carry = 0;
for (j = 0; j < bytes.length; ++j) {
bytes[j] += carry;
carry = bytes[j] >> 8;
bytes[j] &= 255;
}
while (carry) {
bytes.push(carry & 255);
carry >>= 8;
}
}
// deal with leading zeros
for (i = 0; string[i] === "g" && i < string.length - 1; ++i) bytes.push(0);
return bytes.reverse();
}
module.exports = {
encode: encode,
decode: decode
};
/***/ },
/* 14 */
/***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(module, global) {/**
* @license
* lodash 3.9.3 (Custom Build) <https://lodash.com/>
* Build: `lodash modern -d -o ./index.js`
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
;(function() {
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
var undefined;
/** Used as the semantic version number. */
var VERSION = '3.9.3';
/** Used to compose bitmasks for wrapper metadata. */
var BIND_FLAG = 1,
BIND_KEY_FLAG = 2,
CURRY_BOUND_FLAG = 4,
CURRY_FLAG = 8,
CURRY_RIGHT_FLAG = 16,
PARTIAL_FLAG = 32,
PARTIAL_RIGHT_FLAG = 64,
ARY_FLAG = 128,
REARG_FLAG = 256;
/** Used as default options for `_.trunc`. */
var DEFAULT_TRUNC_LENGTH = 30,
DEFAULT_TRUNC_OMISSION = '...';
/** Used to detect when a function becomes hot. */
var HOT_COUNT = 150,
HOT_SPAN = 16;
/** Used to indicate the type of lazy iteratees. */
var LAZY_DROP_WHILE_FLAG = 0,
LAZY_FILTER_FLAG = 1,
LAZY_MAP_FLAG = 2;
/** Used as the `TypeError` message for "Functions" methods. */
var FUNC_ERROR_TEXT = 'Expected a function';
/** Used as the internal argument placeholder. */
var PLACEHOLDER = '__lodash_placeholder__';
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
arrayTag = '[object Array]',
boolTag = '[object Boolean]',
dateTag = '[object Date]',
errorTag = '[object Error]',
funcTag = '[object Function]',
mapTag = '[object Map]',
numberTag = '[object Number]',
objectTag = '[object Object]',
regexpTag = '[object RegExp]',
setTag = '[object Set]',
stringTag = '[object String]',
weakMapTag = '[object WeakMap]';
var arrayBufferTag = '[object ArrayBuffer]',
float32Tag = '[object Float32Array]',
float64Tag = '[object Float64Array]',
int8Tag = '[object Int8Array]',
int16Tag = '[object Int16Array]',
int32Tag = '[object Int32Array]',
uint8Tag = '[object Uint8Array]',
uint8ClampedTag = '[object Uint8ClampedArray]',
uint16Tag = '[object Uint16Array]',
uint32Tag = '[object Uint32Array]';
/** Used to match empty string literals in compiled template source. */
var reEmptyStringLeading = /\b__p \+= '';/g,
reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
/** Used to match HTML entities and HTML characters. */
var reEscapedHtml = /&(?:amp|lt|gt|quot|#39|#96);/g,
reUnescapedHtml = /[&<>"'`]/g,
reHasEscapedHtml = RegExp(reEscapedHtml.source),
reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
/** Used to match template delimiters. */
var reEscape = /<%-([\s\S]+?)%>/g,
reEvaluate = /<%([\s\S]+?)%>/g,
reInterpolate = /<%=([\s\S]+?)%>/g;
/** Used to match property names within property paths. */
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,
reIsPlainProp = /^\w*$/,
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g;
/**
* Used to match `RegExp` [special characters](http://www.regular-expressions.info/characters.html#special).
* In addition to special characters the forward slash is escaped to allow for
* easier `eval` use and `Function` compilation.
*/
var reRegExpChars = /[.*+?^${}()|[\]\/\\]/g,
reHasRegExpChars = RegExp(reRegExpChars.source);
/** Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). */
var reComboMark = /[\u0300-\u036f\ufe20-\ufe23]/g;
/** Used to match backslashes in property paths. */
var reEscapeChar = /\\(\\)?/g;
/** Used to match [ES template delimiters](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components). */
var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
/** Used to match `RegExp` flags from their coerced string values. */
var reFlags = /\w*$/;
/** Used to detect hexadecimal string values. */
var reHasHexPrefix = /^0[xX]/;
/** Used to detect host constructors (Safari > 5). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;
/** Used to detect unsigned integer values. */
var reIsUint = /^\d+$/;
/** Used to match latin-1 supplementary letters (excluding mathematical operators). */
var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g;
/** Used to ensure capturing order of template delimiters. */
var reNoMatch = /($^)/;
/** Used to match unescaped characters in compiled string literals. */
var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
/** Used to match words to create compound words. */
var reWords = (function() {
var upper = '[A-Z\\xc0-\\xd6\\xd8-\\xde]',
lower = '[a-z\\xdf-\\xf6\\xf8-\\xff]+';
return RegExp(upper + '+(?=' + upper + lower + ')|' + upper + '?' + lower + '|' + upper + '+|[0-9]+', 'g');
}());
/** Used to detect and test for whitespace. */
var whitespace = (
// Basic whitespace characters.
' \t\x0b\f\xa0\ufeff' +
// Line terminators.
'\n\r\u2028\u2029' +
// Unicode category "Zs" space separators.
'\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000'
);
/** Used to assign default `context` object properties. */
var contextProps = [
'Array', 'ArrayBuffer', 'Date', 'Error', 'Float32Array', 'Float64Array',
'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Math', 'Number',
'Object', 'RegExp', 'Set', 'String', '_', 'clearTimeout', 'document',
'isFinite', 'parseFloat', 'parseInt', 'setTimeout', 'TypeError', 'Uint8Array',
'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', 'window'
];
/** Used to make template sourceURLs easier to identify. */
var templateCounter = -1;
/** Used to identify `toStringTag` values of typed arrays. */
var typedArrayTags = {};
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
typedArrayTags[uint32Tag] = true;
typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
typedArrayTags[dateTag] = typedArrayTags[errorTag] =
typedArrayTags[funcTag] = typedArrayTags[mapTag] =
typedArrayTags[numberTag] = typedArrayTags[objectTag] =
typedArrayTags[regexpTag] = typedArrayTags[setTag] =
typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
/** Used to identify `toStringTag` values supported by `_.clone`. */
var cloneableTags = {};
cloneableTags[argsTag] = cloneableTags[arrayTag] =
cloneableTags[arrayBufferTag] = cloneableTags[boolTag] =
cloneableTags[dateTag] = cloneableTags[float32Tag] =
cloneableTags[float64Tag] = cloneableTags[int8Tag] =
cloneableTags[int16Tag] = cloneableTags[int32Tag] =
cloneableTags[numberTag] = cloneableTags[objectTag] =
cloneableTags[regexpTag] = cloneableTags[stringTag] =
cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
cloneableTags[errorTag] = cloneableTags[funcTag] =
cloneableTags[mapTag] = cloneableTags[setTag] =
cloneableTags[weakMapTag] = false;
/** Used as an internal `_.debounce` options object by `_.throttle`. */
var debounceOptions = {
'leading': false,
'maxWait': 0,
'trailing': false
};
/** Used to map latin-1 supplementary letters to basic latin letters. */
var deburredLetters = {
'\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
'\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
'\xc7': 'C', '\xe7': 'c',
'\xd0': 'D', '\xf0': 'd',
'\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
'\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
'\xcC': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
'\xeC': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
'\xd1': 'N', '\xf1': 'n',
'\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
'\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
'\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
'\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
'\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
'\xc6': 'Ae', '\xe6': 'ae',
'\xde': 'Th', '\xfe': 'th',
'\xdf': 'ss'
};
/** Used to map characters to HTML entities. */
var htmlEscapes = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": ''',
'`': '`'
};
/** Used to map HTML entities to characters. */
var htmlUnescapes = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
''': "'",
'`': '`'
};
/** Used to determine if values are of the language type `Object`. */
var objectTypes = {
'function': true,
'object': true
};
/** Used to escape characters for inclusion in compiled string literals. */
var stringEscapes = {
'\\': '\\',
"'": "'",
'\n': 'n',
'\r': 'r',
'\u2028': 'u2028',
'\u2029': 'u2029'
};
/** Detect free variable `exports`. */
var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports;
/** Detect free variable `module`. */
var freeModule = objectTypes[typeof module] && module && !module.nodeType && module;
/** Detect free variable `global` from Node.js. */
var freeGlobal = freeExports && freeModule && typeof global == 'object' && global && global.Object && global;
/** Detect free variable `self`. */
var freeSelf = objectTypes[typeof self] && self && self.Object && self;
/** Detect free variable `window`. */
var freeWindow = objectTypes[typeof window] && window && window.Object && window;
/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports && freeExports;
/**
* Used as a reference to the global object.
*
* The `this` value is used if it's the global object to avoid Greasemonkey's
* restricted `window` object, otherwise the `window` object is used.
*/
var root = freeGlobal || ((freeWindow !== (this && this.window)) && freeWindow) || freeSelf || this;
/*--------------------------------------------------------------------------*/
/**
* The base implementation of `compareAscending` which compares values and
* sorts them in ascending order without guaranteeing a stable sort.
*
* @private
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {number} Returns the sort order indicator for `value`.
*/
function baseCompareAscending(value, other) {
if (value !== other) {
var valIsNull = value === null,
valIsUndef = value === undefined,
valIsReflexive = value === value;
var othIsNull = other === null,
othIsUndef = other === undefined,
othIsReflexive = other === other;
if ((value > other && !othIsNull) || !valIsReflexive ||
(valIsNull && !othIsUndef && othIsReflexive) ||
(valIsUndef && othIsReflexive)) {
return 1;
}
if ((value < other && !valIsNull) || !othIsReflexive ||
(othIsNull && !valIsUndef && valIsReflexive) ||
(othIsUndef && valIsReflexive)) {
return -1;
}
}
return 0;
}
/**
* The base implementation of `_.findIndex` and `_.findLastIndex` without
* support for callback shorthands and `this` binding.
*
* @private
* @param {Array} array The array to search.
* @param {Function} predicate The function invoked per iteration.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function baseFindIndex(array, predicate, fromRight) {
var length = array.length,
index = fromRight ? length : -1;
while ((fromRight ? index-- : ++index < length)) {
if (predicate(array[index], index, array)) {
return index;
}
}
return -1;
}
/**
* The base implementation of `_.indexOf` without support for binary searches.
*
* @private
* @param {Array} array The array to search.
* @param {*} value The value to search for.
* @param {number} fromIndex The index to search from.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function baseIndexOf(array, value, fromIndex) {
if (value !== value) {
return indexOfNaN(array, fromIndex);
}
var index = fromIndex - 1,
length = array.length;
while (++index < length) {
if (array[index] === value) {
return index;
}
}
return -1;
}
/**
* The base implementation of `_.isFunction` without support for environments
* with incorrect `typeof` results.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
*/
function baseIsFunction(value) {
// Avoid a Chakra JIT bug in compatibility modes of IE 11.
// See https://github.com/jashkenas/underscore/issues/1621 for more details.
return typeof value == 'function' || false;
}
/**
* Converts `value` to a string if it's not one. An empty string is returned
* for `null` or `undefined` values.
*
* @private
* @param {*} value The value to process.
* @returns {string} Returns the string.
*/
function baseToString(value) {
if (typeof value == 'string') {
return value;
}
return value == null ? '' : (value + '');
}
/**
* Used by `_.trim` and `_.trimLeft` to get the index of the first character
* of `string` that is not found in `chars`.
*
* @private
* @param {string} string The string to inspect.
* @param {string} chars The characters to find.
* @returns {number} Returns the index of the first character not found in `chars`.
*/
function charsLeftIndex(string, chars) {
var index = -1,
length = string.length;
while (++index < length && chars.indexOf(string.charAt(index)) > -1) {}
return index;
}
/**
* Used by `_.trim` and `_.trimRight` to get the index of the last character
* of `string` that is not found in `chars`.
*
* @private
* @param {string} string The string to inspect.
* @param {string} chars The characters to find.
* @returns {number} Returns the index of the last character not found in `chars`.
*/
function charsRightIndex(string, chars) {
var index = string.length;
while (index-- && chars.indexOf(string.charAt(index)) > -1) {}
return index;
}
/**
* Used by `_.sortBy` to compare transformed elements of a collection and stable
* sort them in ascending order.
*
* @private
* @param {Object} object The object to compare to `other`.
* @param {Object} other The object to compare to `object`.
* @returns {number} Returns the sort order indicator for `object`.
*/
function compareAscending(object, other) {
return baseCompareAscending(object.criteria, other.criteria) || (object.index - other.index);
}
/**
* Used by `_.sortByOrder` to compare multiple properties of each element
* in a collection and stable sort them in the following order:
*
* If `orders` is unspecified, sort in ascending order for all properties.
* Otherwise, for each property, sort in ascending order if its corresponding value in
* orders is true, and descending order if false.
*
* @private
* @param {Object} object The object to compare to `other`.
* @param {Object} other The object to compare to `object`.
* @param {boolean[]} orders The order to sort by for each property.
* @returns {number} Returns the sort order indicator for `object`.
*/
function compareMultiple(object, other, orders) {
var index = -1,
objCriteria = object.criteria,
othCriteria = other.criteria,
length = objCriteria.length,
ordersLength = orders.length;
while (++index < length) {
var result = baseCompareAscending(objCriteria[index], othCriteria[index]);
if (result) {
if (index >= ordersLength) {
return result;
}
return result * (orders[index] ? 1 : -1);
}
}
// Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
// that causes it, under certain circumstances, to provide the same value for
// `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
// for more details.
//
// This also ensures a stable sort in V8 and other engines.
// See https://code.google.com/p/v8/issues/detail?id=90 for more details.
return object.index - other.index;
}
/**
* Used by `_.deburr` to convert latin-1 supplementary letters to basic latin letters.
*
* @private
* @param {string} letter The matched letter to deburr.
* @returns {string} Returns the deburred letter.
*/
function deburrLetter(letter) {
return deburredLetters[letter];
}
/**
* Used by `_.escape` to convert characters to HTML entities.
*
* @private
* @param {string} chr The matched character to escape.
* @returns {string} Returns the escaped character.
*/
function escapeHtmlChar(chr) {
return htmlEscapes[chr];
}
/**
* Used by `_.template` to escape characters for inclusion in compiled
* string literals.
*
* @private
* @param {string} chr The matched character to escape.
* @returns {string} Returns the escaped character.
*/
function escapeStringChar(chr) {
return '\\' + stringEscapes[chr];
}
/**
* Gets the index at which the first occurrence of `NaN` is found in `array`.
*
* @private
* @param {Array} array The array to search.
* @param {number} fromIndex The index to search from.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {number} Returns the index of the matched `NaN`, else `-1`.
*/
function indexOfNaN(array, fromIndex, fromRight) {
var length = array.length,
index = fromIndex + (fromRight ? 0 : -1);
while ((fromRight ? index-- : ++index < length)) {
var other = array[index];
if (other !== other) {
return index;
}
}
return -1;
}
/**
* Checks if `value` is object-like.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
*/
function isObjectLike(value) {
return !!value && typeof value == 'object';
}
/**
* Used by `trimmedLeftIndex` and `trimmedRightIndex` to determine if a
* character code is whitespace.
*
* @private
* @param {number} charCode The character code to inspect.
* @returns {boolean} Returns `true` if `charCode` is whitespace, else `false`.
*/
function isSpace(charCode) {
return ((charCode <= 160 && (charCode >= 9 && charCode <= 13) || charCode == 32 || charCode == 160) || charCode == 5760 || charCode == 6158 ||
(charCode >= 8192 && (charCode <= 8202 || charCode == 8232 || charCode == 8233 || charCode == 8239 || charCode == 8287 || charCode == 12288 || charCode == 65279)));
}
/**
* Replaces all `placeholder` elements in `array` with an internal placeholder
* and returns an array of their indexes.
*
* @private
* @param {Array} array The array to modify.
* @param {*} placeholder The placeholder to replace.
* @returns {Array} Returns the new array of placeholder indexes.
*/
function replaceHolders(array, placeholder) {
var index = -1,
length = array.length,
resIndex = -1,
result = [];
while (++index < length) {
if (array[index] === placeholder) {
array[index] = PLACEHOLDER;
result[++resIndex] = index;
}
}
return result;
}
/**
* An implementation of `_.uniq` optimized for sorted arrays without support
* for callback shorthands and `this` binding.
*
* @private
* @param {Array} array The array to inspect.
* @param {Function} [iteratee] The function invoked per iteration.
* @returns {Array} Returns the new duplicate-value-free array.
*/
function sortedUniq(array, iteratee) {
var seen,
index = -1,
length = array.length,
resIndex = -1,
result = [];
while (++index < length) {
var value = array[index],
computed = iteratee ? iteratee(value, index, array) : value;
if (!index || seen !== computed) {
seen = computed;
result[++resIndex] = value;
}
}
return result;
}
/**
* Used by `_.trim` and `_.trimLeft` to get the index of the first non-whitespace
* character of `string`.
*
* @private
* @param {string} string The string to inspect.
* @returns {number} Returns the index of the first non-whitespace character.
*/
function trimmedLeftIndex(string) {
var index = -1,
length = string.length;
while (++index < length && isSpace(string.charCodeAt(index))) {}
return index;
}
/**
* Used by `_.trim` and `_.trimRight` to get the index of the last non-whitespace
* character of `string`.
*
* @private
* @param {string} string The string to inspect.
* @returns {number} Returns the index of the last non-whitespace character.
*/
function trimmedRightIndex(string) {
var index = string.length;
while (index-- && isSpace(string.charCodeAt(index))) {}
return index;
}
/**
* Used by `_.unescape` to convert HTML entities to characters.
*
* @private
* @param {string} chr The matched character to unescape.
* @returns {string} Returns the unescaped character.
*/
function unescapeHtmlChar(chr) {
return htmlUnescapes[chr];
}
/*--------------------------------------------------------------------------*/
/**
* Create a new pristine `lodash` function using the given `context` object.
*
* @static
* @memberOf _
* @category Utility
* @param {Object} [context=root] The context object.
* @returns {Function} Returns a new `lodash` function.
* @example
*
* _.mixin({ 'foo': _.constant('foo') });
*
* var lodash = _.runInContext();
* lodash.mixin({ 'bar': lodash.constant('bar') });
*
* _.isFunction(_.foo);
* // => true
* _.isFunction(_.bar);
* // => false
*
* lodash.isFunction(lodash.foo);
* // => false
* lodash.isFunction(lodash.bar);
* // => true
*
* // using `context` to mock `Date#getTime` use in `_.now`
* var mock = _.runInContext({
* 'Date': function() {
* return { 'getTime': getTimeMock };
* }
* });
*
* // or creating a suped-up `defer` in Node.js
* var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
*/
function runInContext(context) {
// Avoid issues with some ES3 environments that attempt to use values, named
// after built-in constructors like `Object`, for the creation of literals.
// ES5 clears this up by stating that literals must use built-in constructors.
// See https://es5.github.io/#x11.1.5 for more details.
context = context ? _.defaults(root.Object(), context, _.pick(root, contextProps)) : root;
/** Native constructor references. */
var Array = context.Array,
Date = context.Date,
Error = context.Error,
Function = context.Function,
Math = context.Math,
Number = context.Number,
Object = context.Object,
RegExp = context.RegExp,
String = context.String,
TypeError = context.TypeError;
/** Used for native method references. */
var arrayProto = Array.prototype,
objectProto = Object.prototype,
stringProto = String.prototype;
/** Used to detect DOM support. */
var document = (document = context.window) ? document.document : null;
/** Used to resolve the decompiled source of functions. */
var fnToString = Function.prototype.toString;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/** Used to generate unique IDs. */
var idCounter = 0;
/**
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring)
* of values.
*/
var objToString = objectProto.toString;
/** Used to restore the original `_` reference in `_.noConflict`. */
var oldDash = context._;
/** Used to detect if a method is native. */
var reIsNative = RegExp('^' +
escapeRegExp(fnToString.call(hasOwnProperty))
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
);
/** Native method references. */
var ArrayBuffer = getNative(context, 'ArrayBuffer'),
bufferSlice = getNative(ArrayBuffer && new ArrayBuffer(0), 'slice'),
ceil = Math.ceil,
clearTimeout = context.clearTimeout,
floor = Math.floor,
getPrototypeOf = getNative(Object, 'getPrototypeOf'),
parseFloat = context.parseFloat,
push = arrayProto.push,
Set = getNative(context, 'Set'),
setTimeout = context.setTimeout,
splice = arrayProto.splice,
Uint8Array = getNative(context, 'Uint8Array'),
WeakMap = getNative(context, 'WeakMap');
/** Used to clone array buffers. */
var Float64Array = (function() {
// Safari 5 errors when using an array buffer to initialize a typed array
// where the array buffer's `byteLength` is not a multiple of the typed
// array's `BYTES_PER_ELEMENT`.
try {
var func = getNative(context, 'Float64Array'),
result = new func(new ArrayBuffer(10), 0, 1) && func;
} catch(e) {}
return result || null;
}());
/* Native method references for those with the same name as other `lodash` methods. */
var nativeCreate = getNative(Object, 'create'),
nativeIsArray = getNative(Array, 'isArray'),
nativeIsFinite = context.isFinite,
nativeKeys = getNative(Object, 'keys'),
nativeMax = Math.max,
nativeMin = Math.min,
nativeNow = getNative(Date, 'now'),
nativeNumIsFinite = getNative(Number, 'isFinite'),
nativeParseInt = context.parseInt,
nativeRandom = Math.random;
/** Used as references for `-Infinity` and `Infinity`. */
var NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY,
POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
/** Used as references for the maximum length and index of an array. */
var MAX_ARRAY_LENGTH = 4294967295,
MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
/** Used as the size, in bytes, of each `Float64Array` element. */
var FLOAT64_BYTES_PER_ELEMENT = Float64Array ? Float64Array.BYTES_PER_ELEMENT : 0;
/**
* Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer)
* of an array-like value.
*/
var MAX_SAFE_INTEGER = 9007199254740991;
/** Used to store function metadata. */
var metaMap = WeakMap && new WeakMap;
/** Used to lookup unminified function names. */
var realNames = {};
/*------------------------------------------------------------------------*/
/**
* Creates a `lodash` object which wraps `value` to enable implicit chaining.
* Methods that operate on and return arrays, collections, and functions can
* be chained together. Methods that return a boolean or single value will
* automatically end the chain returning the unwrapped value. Explicit chaining
* may be enabled using `_.chain`. The execution of chained methods is lazy,
* that is, execution is deferred until `_#value` is implicitly or explicitly
* called.
*
* Lazy evaluation allows several methods to support shortcut fusion. Shortcut
* fusion is an optimization that merges iteratees to avoid creating intermediate
* arrays and reduce the number of iteratee executions.
*
* Chaining is supported in custom builds as long as the `_#value` method is
* directly or indirectly included in the build.
*
* In addition to lodash methods, wrappers have `Array` and `String` methods.
*
* The wrapper `Array` methods are:
* `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`,
* `splice`, and `unshift`
*
* The wrapper `String` methods are:
* `replace` and `split`
*
* The wrapper methods that support shortcut fusion are:
* `compact`, `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `filter`,
* `first`, `initial`, `last`, `map`, `pluck`, `reject`, `rest`, `reverse`,
* `slice`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `toArray`,
* and `where`
*
* The chainable wrapper methods are:
* `after`, `ary`, `assign`, `at`, `before`, `bind`, `bindAll`, `bindKey`,
* `callback`, `chain`, `chunk`, `commit`, `compact`, `concat`, `constant`,
* `countBy`, `create`, `curry`, `debounce`, `defaults`, `defer`, `delay`,
* `difference`, `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `fill`,
* `filter`, `flatten`, `flattenDeep`, `flow`, `flowRight`, `forEach`,
* `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `functions`,
* `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, `invoke`, `keys`,
* `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
* `memoize`, `merge`, `method`, `methodOf`, `mixin`, `negate`, `omit`, `once`,
* `pairs`, `partial`, `partialRight`, `partition`, `pick`, `plant`, `pluck`,
* `property`, `propertyOf`, `pull`, `pullAt`, `push`, `range`, `rearg`,
* `reject`, `remove`, `rest`, `restParam`, `reverse`, `set`, `shuffle`,
* `slice`, `sort`, `sortBy`, `sortByAll`, `sortByOrder`, `splice`, `spread`,
* `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `tap`, `throttle`,
* `thru`, `times`, `toArray`, `toPlainObject`, `transform`, `union`, `uniq`,
* `unshift`, `unzip`, `unzipWith`, `values`, `valuesIn`, `where`, `without`,
* `wrap`, `xor`, `zip`, `zipObject`, `zipWith`
*
* The wrapper methods that are **not** chainable by default are:
* `add`, `attempt`, `camelCase`, `capitalize`, `clone`, `cloneDeep`, `deburr`,
* `endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`,
* `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`, `get`,
* `gt`, `gte`, `has`, `identity`, `includes`, `indexOf`, `inRange`, `isArguments`,
* `isArray`, `isBoolean`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isError`,
* `isFinite` `isFunction`, `isMatch`, `isNative`, `isNaN`, `isNull`, `isNumber`,
* `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`,
* `isTypedArray`, `join`, `kebabCase`, `last`, `lastIndexOf`, `lt`, `lte`,
* `max`, `min`, `noConflict`, `noop`, `now`, `pad`, `padLeft`, `padRight`,
* `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, `repeat`, `result`,
* `runInContext`, `shift`, `size`, `snakeCase`, `some`, `sortedIndex`,
* `sortedLastIndex`, `startCase`, `startsWith`, `sum`, `template`, `trim`,
* `trimLeft`, `trimRight`, `trunc`, `unescape`, `uniqueId`, `value`, and `words`
*
* The wrapper method `sample` will return a wrapped value when `n` is provided,
* otherwise an unwrapped value is returned.
*
* @name _
* @constructor
* @category Chain
* @param {*} value The value to wrap in a `lodash` instance.
* @returns {Object} Returns the new `lodash` wrapper instance.
* @example
*
* var wrapped = _([1, 2, 3]);
*
* // returns an unwrapped value
* wrapped.reduce(function(total, n) {
* return total + n;
* });
* // => 6
*
* // returns a wrapped value
* var squares = wrapped.map(function(n) {
* return n * n;
* });
*
* _.isArray(squares);
* // => false
*
* _.isArray(squares.value());
* // => true
*/
function lodash(value) {
if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
if (value instanceof LodashWrapper) {
return value;
}
if (hasOwnProperty.call(value, '__chain__') && hasOwnProperty.call(value, '__wrapped__')) {
return wrapperClone(value);
}
}
return new LodashWrapper(value);
}
/**
* The function whose prototype all chaining wrappers inherit from.
*
* @private
*/
function baseLodash() {
// No operation performed.
}
/**
* The base constructor for creating `lodash` wrapper objects.
*
* @private
* @param {*} value The value to wrap.
* @param {boolean} [chainAll] Enable chaining for all wrapper methods.
* @param {Array} [actions=[]] Actions to peform to resolve the unwrapped value.
*/
function LodashWrapper(value, chainAll, actions) {
this.__wrapped__ = value;
this.__actions__ = actions || [];
this.__chain__ = !!chainAll;
}
/**
* An object environment feature flags.
*
* @static
* @memberOf _
* @type Object
*/
var support = lodash.support = {};
(function(x) {
var Ctor = function() { this.x = x; },
object = { '0': x, 'length': x },
props = [];
Ctor.prototype = { 'valueOf': x, 'y': x };
for (var key in new Ctor) { props.push(key); }
/**
* Detect if the DOM is supported.
*
* @memberOf _.support
* @type boolean
*/
try {
support.dom = document.createDocumentFragment().nodeType === 11;
} catch(e) {
support.dom = false;
}
}(1, 0));
/**
* By default, the template delimiters used by lodash are like those in
* embedded Ruby (ERB). Change the following template settings to use
* alternative delimiters.
*
* @static
* @memberOf _
* @type Object
*/
lodash.templateSettings = {
/**
* Used to detect `data` property values to be HTML-escaped.
*
* @memberOf _.templateSettings
* @type RegExp
*/
'escape': reEscape,
/**
* Used to detect code to be evaluated.
*
* @memberOf _.templateSettings
* @type RegExp
*/
'evaluate': reEvaluate,
/**
* Used to detect `data` property values to inject.
*
* @memberOf _.templateSettings
* @type RegExp
*/
'interpolate': reInterpolate,
/**
* Used to reference the data object in the template text.
*
* @memberOf _.templateSettings
* @type string
*/
'variable': '',
/**
* Used to import variables into the compiled template.
*
* @memberOf _.templateSettings
* @type Object
*/
'imports': {
/**
* A reference to the `lodash` function.
*
* @memberOf _.templateSettings.imports
* @type Function
*/
'_': lodash
}
};
/*------------------------------------------------------------------------*/
/**
* Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
*
* @private
* @param {*} value The value to wrap.
*/
function LazyWrapper(value) {
this.__wrapped__ = value;
this.__actions__ = null;
this.__dir__ = 1;
this.__dropCount__ = 0;
this.__filtered__ = false;
this.__iteratees__ = null;
this.__takeCount__ = POSITIVE_INFINITY;
this.__views__ = null;
}
/**
* Creates a clone of the lazy wrapper object.
*
* @private
* @name clone
* @memberOf LazyWrapper
* @returns {Object} Returns the cloned `LazyWrapper` object.
*/
function lazyClone() {
var actions = this.__actions__,
iteratees = this.__iteratees__,
views = this.__views__,
result = new LazyWrapper(this.__wrapped__);
result.__actions__ = actions ? arrayCopy(actions) : null;
result.__dir__ = this.__dir__;
result.__filtered__ = this.__filtered__;
result.__iteratees__ = iteratees ? arrayCopy(iteratees) : null;
result.__takeCount__ = this.__takeCount__;
result.__views__ = views ? arrayCopy(views) : null;
return result;
}
/**
* Reverses the direction of lazy iteration.
*
* @private
* @name reverse
* @memberOf LazyWrapper
* @returns {Object} Returns the new reversed `LazyWrapper` object.
*/
function lazyReverse() {
if (this.__filtered__) {
var result = new LazyWrapper(this);
result.__dir__ = -1;
result.__filtered__ = true;
} else {
result = this.clone();
result.__dir__ *= -1;
}
return result;
}
/**
* Extracts the unwrapped value from its lazy wrapper.
*
* @private
* @name value
* @memberOf LazyWrapper
* @returns {*} Returns the unwrapped value.
*/
function lazyValue() {
var array = this.__wrapped__.value();
if (!isArray(array)) {
return baseWrapperValue(array, this.__actions__);
}
var dir = this.__dir__,
isRight = dir < 0,
view = getView(0, array.length, this.__views__),
start = view.start,
end = view.end,
length = end - start,
index = isRight ? end : (start - 1),
takeCount = nativeMin(length, this.__takeCount__),
iteratees = this.__iteratees__,
iterLength = iteratees ? iteratees.length : 0,
resIndex = 0,
result = [];
outer:
while (length-- && resIndex < takeCount) {
index += dir;
var iterIndex = -1,
value = array[index];
while (++iterIndex < iterLength) {
var data = iteratees[iterIndex],
iteratee = data.iteratee,
type = data.type;
if (type == LAZY_DROP_WHILE_FLAG) {
if (data.done && (isRight ? (index > data.index) : (index < data.index))) {
data.count = 0;
data.done = false;
}
data.index = index;
if (!data.done) {
var limit = data.limit;
if (!(data.done = limit > -1 ? (data.count++ >= limit) : !iteratee(value))) {
continue outer;
}
}
} else {
var computed = iteratee(value);
if (type == LAZY_MAP_FLAG) {
value = computed;
} else if (!computed) {
if (type == LAZY_FILTER_FLAG) {
continue outer;
} else {
break outer;
}
}
}
}
result[resIndex++] = value;
}
return result;
}
/*------------------------------------------------------------------------*/
/**
* Creates a cache object to store key/value pairs.
*
* @private
* @static
* @name Cache
* @memberOf _.memoize
*/
function MapCache() {
this.__data__ = {};
}
/**
* Removes `key` and its value from the cache.
*
* @private
* @name delete
* @memberOf _.memoize.Cache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed successfully, else `false`.
*/
function mapDelete(key) {
return this.has(key) && delete this.__data__[key];
}
/**
* Gets the cached value for `key`.
*
* @private
* @name get
* @memberOf _.memoize.Cache
* @param {string} key The key of the value to get.
* @returns {*} Returns the cached value.
*/
function mapGet(key) {
return key == '__proto__' ? undefined : this.__data__[key];
}
/**
* Checks if a cached value for `key` exists.
*
* @private
* @name has
* @memberOf _.memoize.Cache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function mapHas(key) {
return key != '__proto__' && hasOwnProperty.call(this.__data__, key);
}
/**
* Sets `value` to `key` of the cache.
*
* @private
* @name set
* @memberOf _.memoize.Cache
* @param {string} key The key of the value to cache.
* @param {*} value The value to cache.
* @returns {Object} Returns the cache object.
*/
function mapSet(key, value) {
if (key != '__proto__') {
this.__data__[key] = value;
}
return this;
}
/*------------------------------------------------------------------------*/
/**
*
* Creates a cache object to store unique values.
*
* @private
* @param {Array} [values] The values to cache.
*/
function SetCache(values) {
var length = values ? values.length : 0;
this.data = { 'hash': nativeCreate(null), 'set': new Set };
while (length--) {
this.push(values[length]);
}
}
/**
* Checks if `value` is in `cache` mimicking the return signature of
* `_.indexOf` by returning `0` if the value is found, else `-1`.
*
* @private
* @param {Object} cache The cache to search.
* @param {*} value The value to search for.
* @returns {number} Returns `0` if `value` is found, else `-1`.
*/
function cacheIndexOf(cache, value) {
var data = cache.data,
result = (typeof value == 'string' || isObject(value)) ? data.set.has(value) : data.hash[value];
return result ? 0 : -1;
}
/**
* Adds `value` to the cache.
*
* @private
* @name push
* @memberOf SetCache
* @param {*} value The value to cache.
*/
function cachePush(value) {
var data = this.data;
if (typeof value == 'string' || isObject(value)) {
data.set.add(value);
} else {
data.hash[value] = true;
}
}
/*------------------------------------------------------------------------*/
/**
* Copies the values of `source` to `array`.
*
* @private
* @param {Array} source The array to copy values from.
* @param {Array} [array=[]] The array to copy values to.
* @returns {Array} Returns `array`.
*/
function arrayCopy(source, array) {
var index = -1,
length = source.length;
array || (array = Array(length));
while (++index < length) {
array[index] = source[index];
}
return array;
}
/**
* A specialized version of `_.forEach` for arrays without support for callback
* shorthands and `this` binding.
*
* @private
* @param {Array} array The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns `array`.
*/
function arrayEach(array, iteratee) {
var index = -1,
length = array.length;
while (++index < length) {
if (iteratee(array[index], index, array) === false) {
break;
}
}
return array;
}
/**
* A specialized version of `_.forEachRight` for arrays without support for
* callback shorthands and `this` binding.
*
* @private
* @param {Array} array The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns `array`.
*/
function arrayEachRight(array, iteratee) {
var length = array.length;
while (length--) {
if (iteratee(array[length], length, array) === false) {
break;
}
}
return array;
}
/**
* A specialized version of `_.every` for arrays without support for callback
* shorthands and `this` binding.
*
* @private
* @param {Array} array The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {boolean} Returns `true` if all elements pass the predicate check,
* else `false`.
*/
function arrayEvery(array, predicate) {
var index = -1,
length = array.length;
while (++index < length) {
if (!predicate(array[index], index, array)) {
return false;
}
}
return true;
}
/**
* A specialized version of `baseExtremum` for arrays which invokes `iteratee`
* with one argument: (value).
*
* @private
* @param {Array} array The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {Function} comparator The function used to compare values.
* @param {*} exValue The initial extremum value.
* @returns {*} Returns the extremum value.
*/
function arrayExtremum(array, iteratee, comparator, exValue) {
var index = -1,
length = array.length,
computed = exValue,
result = computed;
while (++index < length) {
var value = array[index],
current = +iteratee(value);
if (comparator(current, computed)) {
computed = current;
result = value;
}
}
return result;
}
/**
* A specialized version of `_.filter` for arrays without support for callback
* shorthands and `this` binding.
*
* @private
* @param {Array} array The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
*/
function arrayFilter(array, predicate) {
var index = -1,
length = array.length,
resIndex = -1,
result = [];
while (++index < length) {
var value = array[index];
if (predicate(value, index, array)) {
result[++resIndex] = value;
}
}
return result;
}
/**
* A specialized version of `_.map` for arrays without support for callback
* shorthands and `this` binding.
*
* @private
* @param {Array} array The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the new mapped array.
*/
function arrayMap(array, iteratee) {
var index = -1,
length = array.length,
result = Array(length);
while (++index < length) {
result[index] = iteratee(array[index], index, array);
}
return result;
}
/**
* A specialized version of `_.reduce` for arrays without support for callback
* shorthands and `this` binding.
*
* @private
* @param {Array} array The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {*} [accumulator] The initial value.
* @param {boolean} [initFromArray] Specify using the first element of `array`
* as the initial value.
* @returns {*} Returns the accumulated value.
*/
function arrayReduce(array, iteratee, accumulator, initFromArray) {
var index = -1,
length = array.length;
if (initFromArray && length) {
accumulator = array[++index];
}
while (++index < length) {
accumulator = iteratee(accumulator, array[index], index, array);
}
return accumulator;
}
/**
* A specialized version of `_.reduceRight` for arrays without support for
* callback shorthands and `this` binding.
*
* @private
* @param {Array} array The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {*} [accumulator] The initial value.
* @param {boolean} [initFromArray] Specify using the last element of `array`
* as the initial value.
* @returns {*} Returns the accumulated value.
*/
function arrayReduceRight(array, iteratee, accumulator, initFromArray) {
var length = array.length;
if (initFromArray && length) {
accumulator = array[--length];
}
while (length--) {
accumulator = iteratee(accumulator, array[length], length, array);
}
return accumulator;
}
/**
* A specialized version of `_.some` for arrays without support for callback
* shorthands and `this` binding.
*
* @private
* @param {Array} array The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {boolean} Returns `true` if any element passes the predicate check,
* else `false`.
*/
function arraySome(array, predicate) {
var index = -1,
length = array.length;
while (++index < length) {
if (predicate(array[index], index, array)) {
return true;
}
}
return false;
}
/**
* A specialized version of `_.sum` for arrays without support for iteratees.
*
* @private
* @param {Array} array The array to iterate over.
* @returns {number} Returns the sum.
*/
function arraySum(array) {
var length = array.length,
result = 0;
while (length--) {
result += +array[length] || 0;
}
return result;
}
/**
* Used by `_.defaults` to customize its `_.assign` use.
*
* @private
* @param {*} objectValue The destination object property value.
* @param {*} sourceValue The source object property value.
* @returns {*} Returns the value to assign to the destination object.
*/
function assignDefaults(objectValue, sourceValue) {
return objectValue === undefined ? sourceValue : objectValue;
}
/**
* Used by `_.template` to customize its `_.assign` use.
*
* **Note:** This function is like `assignDefaults` except that it ignores
* inherited property values when checking if a property is `undefined`.
*
* @private
* @param {*} objectValue The destination object property value.
* @param {*} sourceValue The source object property value.
* @param {string} key The key associated with the object and source values.
* @param {Object} object The destination object.
* @returns {*} Returns the value to assign to the destination object.
*/
function assignOwnDefaults(objectValue, sourceValue, key, object) {
return (objectValue === undefined || !hasOwnProperty.call(object, key))
? sourceValue
: objectValue;
}
/**
* A specialized version of `_.assign` for customizing assigned values without
* support for argument juggling, multiple sources, and `this` binding `customizer`
* functions.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @param {Function} customizer The function to customize assigned values.
* @returns {Object} Returns `object`.
*/
function assignWith(object, source, customizer) {
var index = -1,
props = keys(source),
length = props.length;
while (++index < length) {
var key = props[index],
value = object[key],
result = customizer(value, source[key], key, object, source);
if ((result === result ? (result !== value) : (value === value)) ||
(value === undefined && !(key in object))) {
object[key] = result;
}
}
return object;
}
/**
* The base implementation of `_.assign` without support for argument juggling,
* multiple sources, and `customizer` functions.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @returns {Object} Returns `object`.
*/
function baseAssign(object, source) {
return source == null
? object
: baseCopy(source, keys(source), object);
}
/**
* The base implementation of `_.at` without support for string collections
* and individual key arguments.
*
* @private
* @param {Array|Object} collection The collection to iterate over.
* @param {number[]|string[]} props The property names or indexes of elements to pick.
* @returns {Array} Returns the new array of picked elements.
*/
function baseAt(collection, props) {
var index = -1,
isNil = collection == null,
isArr = !isNil && isArrayLike(collection),
length = isArr ? collection.length : 0,
propsLength = props.length,
result = Array(propsLength);
while(++index < propsLength) {
var key = props[index];
if (isArr) {
result[index] = isIndex(key, length) ? collection[key] : undefined;
} else {
result[index] = isNil ? undefined : collection[key];
}
}
return result;
}
/**
* Copies properties of `source` to `object`.
*
* @private
* @param {Object} source The object to copy properties from.
* @param {Array} props The property names to copy.
* @param {Object} [object={}] The object to copy properties to.
* @returns {Object} Returns `object`.
*/
function baseCopy(source, props, object) {
object || (object = {});
var index = -1,
length = props.length;
while (++index < length) {
var key = props[index];
object[key] = source[key];
}
return object;
}
/**
* The base implementation of `_.callback` which supports specifying the
* number of arguments to provide to `func`.
*
* @private
* @param {*} [func=_.identity] The value to convert to a callback.
* @param {*} [thisArg] The `this` binding of `func`.
* @param {number} [argCount] The number of arguments to provide to `func`.
* @returns {Function} Returns the callback.
*/
function baseCallback(func, thisArg, argCount) {
var type = typeof func;
if (type == 'function') {
return thisArg === undefined
? func
: bindCallback(func, thisArg, argCount);
}
if (func == null) {
return identity;
}
if (type == 'object') {
return baseMatches(func);
}
return thisArg === undefined
? property(func)
: baseMatchesProperty(func, thisArg);
}
/**
* The base implementation of `_.clone` without support for argument juggling
* and `this` binding `customizer` functions.
*
* @private
* @param {*} value The value to clone.
* @param {boolean} [isDeep] Specify a deep clone.
* @param {Function} [customizer] The function to customize cloning values.
* @param {string} [key] The key of `value`.
* @param {Object} [object] The object `value` belongs to.
* @param {Array} [stackA=[]] Tracks traversed source objects.
* @param {Array} [stackB=[]] Associates clones with source counterparts.
* @returns {*} Returns the cloned value.
*/
function baseClone(value, isDeep, customizer, key, object, stackA, stackB) {
var result;
if (customizer) {
result = object ? customizer(value, key, object) : customizer(value);
}
if (result !== undefined) {
return result;
}
if (!isObject(value)) {
return value;
}
var isArr = isArray(value);
if (isArr) {
result = initCloneArray(value);
if (!isDeep) {
return arrayCopy(value, result);
}
} else {
var tag = objToString.call(value),
isFunc = tag == funcTag;
if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
result = initCloneObject(isFunc ? {} : value);
if (!isDeep) {
return baseAssign(result, value);
}
} else {
return cloneableTags[tag]
? initCloneByTag(value, tag, isDeep)
: (object ? value : {});
}
}
// Check for circular references and return corresponding clone.
stackA || (stackA = []);
stackB || (stackB = []);
var length = stackA.length;
while (length--) {
if (stackA[length] == value) {
return stackB[length];
}
}
// Add the source value to the stack of traversed objects and associate it with its clone.
stackA.push(value);
stackB.push(result);
// Recursively populate clone (susceptible to call stack limits).
(isArr ? arrayEach : baseForOwn)(value, function(subValue, key) {
result[key] = baseClone(subValue, isDeep, customizer, key, value, stackA, stackB);
});
return result;
}
/**
* The base implementation of `_.create` without support for assigning
* properties to the created object.
*
* @private
* @param {Object} prototype The object to inherit from.
* @returns {Object} Returns the new object.
*/
var baseCreate = (function() {
function object() {}
return function(prototype) {
if (isObject(prototype)) {
object.prototype = prototype;
var result = new object;
object.prototype = null;
}
return result || {};
};
}());
/**
* The base implementation of `_.delay` and `_.defer` which accepts an index
* of where to slice the arguments to provide to `func`.
*
* @private
* @param {Function} func The function to delay.
* @param {number} wait The number of milliseconds to delay invocation.
* @param {Object} args The arguments provide to `func`.
* @returns {number} Returns the timer id.
*/
function baseDelay(func, wait, args) {
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
return setTimeout(function() { func.apply(undefined, args); }, wait);
}
/**
* The base implementation of `_.difference` which accepts a single array
* of values to exclude.
*
* @private
* @param {Array} array The array to inspect.
* @param {Array} values The values to exclude.
* @returns {Array} Returns the new array of filtered values.
*/
function baseDifference(array, values) {
var length = array ? array.length : 0,
result = [];
if (!length) {
return result;
}
var index = -1,
indexOf = getIndexOf(),
isCommon = indexOf == baseIndexOf,
cache = (isCommon && values.length >= 200) ? createCache(values) : null,
valuesLength = values.length;
if (cache) {
indexOf = cacheIndexOf;
isCommon = false;
values = cache;
}
outer:
while (++index < length) {
var value = array[index];
if (isCommon && value === value) {
var valuesIndex = valuesLength;
while (valuesIndex--) {
if (values[valuesIndex] === value) {
continue outer;
}
}
result.push(value);
}
else if (indexOf(values, value, 0) < 0) {
result.push(value);
}
}
return result;
}
/**
* The base implementation of `_.forEach` without support for callback
* shorthands and `this` binding.
*
* @private
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array|Object|string} Returns `collection`.
*/
var baseEach = createBaseEach(baseForOwn);
/**
* The base implementation of `_.forEachRight` without support for callback
* shorthands and `this` binding.
*
* @private
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array|Object|string} Returns `collection`.
*/
var baseEachRight = createBaseEach(baseForOwnRight, true);
/**
* The base implementation of `_.every` without support for callback
* shorthands and `this` binding.
*
* @private
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {boolean} Returns `true` if all elements pass the predicate check,
* else `false`
*/
function baseEvery(collection, predicate) {
var result = true;
baseEach(collection, function(value, index, collection) {
result = !!predicate(value, index, collection);
return result;
});
return result;
}
/**
* Gets the extremum value of `collection` invoking `iteratee` for each value
* in `collection` to generate the criterion by which the value is ranked.
* The `iteratee` is invoked with three arguments: (value, index|key, collection).
*
* @private
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {Function} comparator The function used to compare values.
* @param {*} exValue The initial extremum value.
* @returns {*} Returns the extremum value.
*/
function baseExtremum(collection, iteratee, comparator, exValue) {
var computed = exValue,
result = computed;
baseEach(collection, function(value, index, collection) {
var current = +iteratee(value, index, collection);
if (comparator(current, computed) || (current === exValue && current === result)) {
computed = current;
result = value;
}
});
return result;
}
/**
* The base implementation of `_.fill` without an iteratee call guard.
*
* @private
* @param {Array} array The array to fill.
* @param {*} value The value to fill `array` with.
* @param {number} [start=0] The start position.
* @param {number} [end=array.length] The end position.
* @returns {Array} Returns `array`.
*/
function baseFill(array, value, start, end) {
var length = array.length;
start = start == null ? 0 : (+start || 0);
if (start < 0) {
start = -start > length ? 0 : (length + start);
}
end = (end === undefined || end > length) ? length : (+end || 0);
if (end < 0) {
end += length;
}
length = start > end ? 0 : (end >>> 0);
start >>>= 0;
while (start < length) {
array[start++] = value;
}
return array;
}
/**
* The base implementation of `_.filter` without support for callback
* shorthands and `this` binding.
*
* @private
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
*/
function baseFilter(collection, predicate) {
var result = [];
baseEach(collection, function(value, index, collection) {
if (predicate(value, index, collection)) {
result.push(value);
}
});
return result;
}
/**
* The base implementation of `_.find`, `_.findLast`, `_.findKey`, and `_.findLastKey`,
* without support for callback shorthands and `this` binding, which iterates
* over `collection` using the provided `eachFunc`.
*
* @private
* @param {Array|Object|string} collection The collection to search.
* @param {Function} predicate The function invoked per iteration.
* @param {Function} eachFunc The function to iterate over `collection`.
* @param {boolean} [retKey] Specify returning the key of the found element
* instead of the element itself.
* @returns {*} Returns the found element or its key, else `undefined`.
*/
function baseFind(collection, predicate, eachFunc, retKey) {
var result;
eachFunc(collection, function(value, key, collection) {
if (predicate(value, key, collection)) {
result = retKey ? key : value;
return false;
}
});
return result;
}
/**
* The base implementation of `_.flatten` with added support for restricting
* flattening and specifying the start index.
*
* @private
* @param {Array} array The array to flatten.
* @param {boolean} [isDeep] Specify a deep flatten.
* @param {boolean} [isStrict] Restrict flattening to arrays-like objects.
* @returns {Array} Returns the new flattened array.
*/
function baseFlatten(array, isDeep, isStrict) {
var index = -1,
length = array.length,
resIndex = -1,
result = [];
while (++index < length) {
var value = array[index];
if (isObjectLike(value) && isArrayLike(value) &&
(isStrict || isArray(value) || isArguments(value))) {
if (isDeep) {
// Recursively flatten arrays (susceptible to call stack limits).
value = baseFlatten(value, isDeep, isStrict);
}
var valIndex = -1,
valLength = value.length;
while (++valIndex < valLength) {
result[++resIndex] = value[valIndex];
}
} else if (!isStrict) {
result[++resIndex] = value;
}
}
return result;
}
/**
* The base implementation of `baseForIn` and `baseForOwn` which iterates
* over `object` properties returned by `keysFunc` invoking `iteratee` for
* each property. Iteratee functions may exit iteration early by explicitly
* returning `false`.
*
* @private
* @param {Object} object The object to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {Function} keysFunc The function to get the keys of `object`.
* @returns {Object} Returns `object`.
*/
var baseFor = createBaseFor();
/**
* This function is like `baseFor` except that it iterates over properties
* in the opposite order.
*
* @private
* @param {Object} object The object to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {Function} keysFunc The function to get the keys of `object`.
* @returns {Object} Returns `object`.
*/
var baseForRight = createBaseFor(true);
/**
* The base implementation of `_.forIn` without support for callback
* shorthands and `this` binding.
*
* @private
* @param {Object} object The object to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Object} Returns `object`.
*/
function baseForIn(object, iteratee) {
return baseFor(object, iteratee, keysIn);
}
/**
* The base implementation of `_.forOwn` without support for callback
* shorthands and `this` binding.
*
* @private
* @param {Object} object The object to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Object} Returns `object`.
*/
function baseForOwn(object, iteratee) {
return baseFor(object, iteratee, keys);
}
/**
* The base implementation of `_.forOwnRight` without support for callback
* shorthands and `this` binding.
*
* @private
* @param {Object} object The object to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Object} Returns `object`.
*/
function baseForOwnRight(object, iteratee) {
return baseForRight(object, iteratee, keys);
}
/**
* The base implementation of `_.functions` which creates an array of
* `object` function property names filtered from those provided.
*
* @private
* @param {Object} object The object to inspect.
* @param {Array} props The property names to filter.
* @returns {Array} Returns the new array of filtered property names.
*/
function baseFunctions(object, props) {
var index = -1,
length = props.length,
resIndex = -1,
result = [];
while (++index < length) {
var key = props[index];
if (isFunction(object[key])) {
result[++resIndex] = key;
}
}
return result;
}
/**
* The base implementation of `get` without support for string paths
* and default values.
*
* @private
* @param {Object} object The object to query.
* @param {Array} path The path of the property to get.
* @param {string} [pathKey] The key representation of path.
* @returns {*} Returns the resolved value.
*/
function baseGet(object, path, pathKey) {
if (object == null) {
return;
}
if (pathKey !== undefined && pathKey in toObject(object)) {
path = [pathKey];
}
var index = 0,
length = path.length;
while (object != null && index < length) {
object = object[path[index++]];
}
return (index && index == length) ? object : undefined;
}
/**
* The base implementation of `_.isEqual` without support for `this` binding
* `customizer` functions.
*
* @private
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @param {Function} [customizer] The function to customize comparing values.
* @param {boolean} [isLoose] Specify performing partial comparisons.
* @param {Array} [stackA] Tracks traversed `value` objects.
* @param {Array} [stackB] Tracks traversed `other` objects.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
*/
function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) {
if (value === other) {
return true;
}
if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
return value !== value && other !== other;
}
return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB);
}
/**
* A specialized version of `baseIsEqual` for arrays and objects which performs
* deep comparisons and tracks traversed objects enabling objects with circular
* references to be compared.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} [customizer] The function to customize comparing objects.
* @param {boolean} [isLoose] Specify performing partial comparisons.
* @param {Array} [stackA=[]] Tracks traversed `value` objects.
* @param {Array} [stackB=[]] Tracks traversed `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function baseIsEqualDeep(object, other, equalFunc, customizer, isLoose, stackA, stackB) {
var objIsArr = isArray(object),
othIsArr = isArray(other),
objTag = arrayTag,
othTag = arrayTag;
if (!objIsArr) {
objTag = objToString.call(object);
if (objTag == argsTag) {
objTag = objectTag;
} else if (objTag != objectTag) {
objIsArr = isTypedArray(object);
}
}
if (!othIsArr) {
othTag = objToString.call(other);
if (othTag == argsTag) {
othTag = objectTag;
} else if (othTag != objectTag) {
othIsArr = isTypedArray(other);
}
}
var objIsObj = objTag == objectTag,
othIsObj = othTag == objectTag,
isSameTag = objTag == othTag;
if (isSameTag && !(objIsArr || objIsObj)) {
return equalByTag(object, other, objTag);
}
if (!isLoose) {
var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
if (objIsWrapped || othIsWrapped) {
return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, isLoose, stackA, stackB);
}
}
if (!isSameTag) {
return false;
}
// Assume cyclic values are equal.
// For more information on detecting circular references see https://es5.github.io/#JO.
stackA || (stackA = []);
stackB || (stackB = []);
var length = stackA.length;
while (length--) {
if (stackA[length] == object) {
return stackB[length] == other;
}
}
// Add `object` and `other` to the stack of traversed objects.
stackA.push(object);
stackB.push(other);
var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isLoose, stackA, stackB);
stackA.pop();
stackB.pop();
return result;
}
/**
* The base implementation of `_.isMatch` without support for callback
* shorthands and `this` binding.
*
* @private
* @param {Object} object The object to inspect.
* @param {Array} matchData The propery names, values, and compare flags to match.
* @param {Function} [customizer] The function to customize comparing objects.
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
*/
function baseIsMatch(object, matchData, customizer) {
var index = matchData.length,
length = index,
noCustomizer = !customizer;
if (object == null) {
return !length;
}
object = toObject(object);
while (index--) {
var data = matchData[index];
if ((noCustomizer && data[2])
? data[1] !== object[data[0]]
: !(data[0] in object)
) {
return false;
}
}
while (++index < length) {
data = matchData[index];
var key = data[0],
objValue = object[key],
srcValue = data[1];
if (noCustomizer && data[2]) {
if (objValue === undefined && !(key in object)) {
return false;
}
} else {
var result = customizer ? customizer(objValue, srcValue, key) : undefined;
if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, true) : result)) {
return false;
}
}
}
return true;
}
/**
* The base implementation of `_.map` without support for callback shorthands
* and `this` binding.
*
* @private
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the new mapped array.
*/
function baseMap(collection, iteratee) {
var index = -1,
result = isArrayLike(collection) ? Array(collection.length) : [];
baseEach(collection, function(value, key, collection) {
result[++index] = iteratee(value, key, collection);
});
return result;
}
/**
* The base implementation of `_.matches` which does not clone `source`.
*
* @private
* @param {Object} source The object of property values to match.
* @returns {Function} Returns the new function.
*/
function baseMatches(source) {
var matchData = getMatchData(source);
if (matchData.length == 1 && matchData[0][2]) {
var key = matchData[0][0],
value = matchData[0][1];
return function(object) {
if (object == null) {
return false;
}
return object[key] === value && (value !== undefined || (key in toObject(object)));
};
}
return function(object) {
return baseIsMatch(object, matchData);
};
}
/**
* The base implementation of `_.matchesProperty` which does not clone `srcValue`.
*
* @private
* @param {string} path The path of the property to get.
* @param {*} srcValue The value to compare.
* @returns {Function} Returns the new function.
*/
function baseMatchesProperty(path, srcValue) {
var isArr = isArray(path),
isCommon = isKey(path) && isStrictComparable(srcValue),
pathKey = (path + '');
path = toPath(path);
return function(object) {
if (object == null) {
return false;
}
var key = pathKey;
object = toObject(object);
if ((isArr || !isCommon) && !(key in object)) {
object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
if (object == null) {
return false;
}
key = last(path);
object = toObject(object);
}
return object[key] === srcValue
? (srcValue !== undefined || (key in object))
: baseIsEqual(srcValue, object[key], undefined, true);
};
}
/**
* The base implementation of `_.merge` without support for argument juggling,
* multiple sources, and `this` binding `customizer` functions.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @param {Function} [customizer] The function to customize merging properties.
* @param {Array} [stackA=[]] Tracks traversed source objects.
* @param {Array} [stackB=[]] Associates values with source counterparts.
* @returns {Object} Returns `object`.
*/
function baseMerge(object, source, customizer, stackA, stackB) {
if (!isObject(object)) {
return object;
}
var isSrcArr = isArrayLike(source) && (isArray(source) || isTypedArray(source)),
props = isSrcArr ? null : keys(source);
arrayEach(props || source, function(srcValue, key) {
if (props) {
key = srcValue;
srcValue = source[key];
}
if (isObjectLike(srcValue)) {
stackA || (stackA = []);
stackB || (stackB = []);
baseMergeDeep(object, source, key, baseMerge, customizer, stackA, stackB);
}
else {
var value = object[key],
result = customizer ? customizer(value, srcValue, key, object, source) : undefined,
isCommon = result === undefined;
if (isCommon) {
result = srcValue;
}
if ((result !== undefined || (isSrcArr && !(key in object))) &&
(isCommon || (result === result ? (result !== value) : (value === value)))) {
object[key] = result;
}
}
});
return object;
}
/**
* A specialized version of `baseMerge` for arrays and objects which performs
* deep merges and tracks traversed objects enabling objects with circular
* references to be merged.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @param {string} key The key of the value to merge.
* @param {Function} mergeFunc The function to merge values.
* @param {Function} [customizer] The function to customize merging properties.
* @param {Array} [stackA=[]] Tracks traversed source objects.
* @param {Array} [stackB=[]] Associates values with source counterparts.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function baseMergeDeep(object, source, key, mergeFunc, customizer, stackA, stackB) {
var length = stackA.length,
srcValue = source[key];
while (length--) {
if (stackA[length] == srcValue) {
object[key] = stackB[length];
return;
}
}
var value = object[key],
result = customizer ? customizer(value, srcValue, key, object, source) : undefined,
isCommon = result === undefined;
if (isCommon) {
result = srcValue;
if (isArrayLike(srcValue) && (isArray(srcValue) || isTypedArray(srcValue))) {
result = isArray(value)
? value
: (isArrayLike(value) ? arrayCopy(value) : []);
}
else if (isPlainObject(srcValue) || isArguments(srcValue)) {
result = isArguments(value)
? toPlainObject(value)
: (isPlainObject(value) ? value : {});
}
else {
isCommon = false;
}
}
// Add the source value to the stack of traversed objects and associate
// it with its merged value.
stackA.push(srcValue);
stackB.push(result);
if (isCommon) {
// Recursively merge objects and arrays (susceptible to call stack limits).
object[key] = mergeFunc(result, srcValue, customizer, stackA, stackB);
} else if (result === result ? (result !== value) : (value === value)) {
object[key] = result;
}
}
/**
* The base implementation of `_.property` without support for deep paths.
*
* @private
* @param {string} key The key of the property to get.
* @returns {Function} Returns the new function.
*/
function baseProperty(key) {
return function(object) {
return object == null ? undefined : object[key];
};
}
/**
* A specialized version of `baseProperty` which supports deep paths.
*
* @private
* @param {Array|string} path The path of the property to get.
* @returns {Function} Returns the new function.
*/
function basePropertyDeep(path) {
var pathKey = (path + '');
path = toPath(path);
return function(object) {
return baseGet(object, path, pathKey);
};
}
/**
* The base implementation of `_.pullAt` without support for individual
* index arguments and capturing the removed elements.
*
* @private
* @param {Array} array The array to modify.
* @param {number[]} indexes The indexes of elements to remove.
* @returns {Array} Returns `array`.
*/
function basePullAt(array, indexes) {
var length = array ? indexes.length : 0;
while (length--) {
var index = indexes[length];
if (index != previous && isIndex(index)) {
var previous = index;
splice.call(array, index, 1);
}
}
return array;
}
/**
* The base implementation of `_.random` without support for argument juggling
* and returning floating-point numbers.
*
* @private
* @param {number} min The minimum possible value.
* @param {number} max The maximum possible value.
* @returns {number} Returns the random number.
*/
function baseRandom(min, max) {
return min + floor(nativeRandom() * (max - min + 1));
}
/**
* The base implementation of `_.reduce` and `_.reduceRight` without support
* for callback shorthands and `this` binding, which iterates over `collection`
* using the provided `eachFunc`.
*
* @private
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {*} accumulator The initial value.
* @param {boolean} initFromCollection Specify using the first or last element
* of `collection` as the initial value.
* @param {Function} eachFunc The function to iterate over `collection`.
* @returns {*} Returns the accumulated value.
*/
function baseReduce(collection, iteratee, accumulator, initFromCollection, eachFunc) {
eachFunc(collection, function(value, index, collection) {
accumulator = initFromCollection
? (initFromCollection = false, value)
: iteratee(accumulator, value, index, collection);
});
return accumulator;
}
/**
* The base implementation of `setData` without support for hot loop detection.
*
* @private
* @param {Function} func The function to associate metadata with.
* @param {*} data The metadata.
* @returns {Function} Returns `func`.
*/
var baseSetData = !metaMap ? identity : function(func, data) {
metaMap.set(func, data);
return func;
};
/**
* The base implementation of `_.slice` without an iteratee call guard.
*
* @private
* @param {Array} array The array to slice.
* @param {number} [start=0] The start position.
* @param {number} [end=array.length] The end position.
* @returns {Array} Returns the slice of `array`.
*/
function baseSlice(array, start, end) {
var index = -1,
length = array.length;
start = start == null ? 0 : (+start || 0);
if (start < 0) {
start = -start > length ? 0 : (length + start);
}
end = (end === undefined || end > length) ? length : (+end || 0);
if (end < 0) {
end += length;
}
length = start > end ? 0 : ((end - start) >>> 0);
start >>>= 0;
var result = Array(length);
while (++index < length) {
result[index] = array[index + start];
}
return result;
}
/**
* The base implementation of `_.some` without support for callback shorthands
* and `this` binding.
*
* @private
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {boolean} Returns `true` if any element passes the predicate check,
* else `false`.
*/
function baseSome(collection, predicate) {
var result;
baseEach(collection, function(value, index, collection) {
result = predicate(value, index, collection);
return !result;
});
return !!result;
}
/**
* The base implementation of `_.sortBy` which uses `comparer` to define
* the sort order of `array` and replaces criteria objects with their
* corresponding values.
*
* @private
* @param {Array} array The array to sort.
* @param {Function} comparer The function to define sort order.
* @returns {Array} Returns `array`.
*/
function baseSortBy(array, comparer) {
var length = array.length;
array.sort(comparer);
while (length--) {
array[length] = array[length].value;
}
return array;
}
/**
* The base implementation of `_.sortByOrder` without param guards.
*
* @private
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
* @param {boolean[]} orders The sort orders of `iteratees`.
* @returns {Array} Returns the new sorted array.
*/
function baseSortByOrder(collection, iteratees, orders) {
var callback = getCallback(),
index = -1;
iteratees = arrayMap(iteratees, function(iteratee) { return callback(iteratee); });
var result = baseMap(collection, function(value) {
var criteria = arrayMap(iteratees, function(iteratee) { return iteratee(value); });
return { 'criteria': criteria, 'index': ++index, 'value': value };
});
return baseSortBy(result, function(object, other) {
return compareMultiple(object, other, orders);
});
}
/**
* The base implementation of `_.sum` without support for callback shorthands
* and `this` binding.
*
* @private
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {number} Returns the sum.
*/
function baseSum(collection, iteratee) {
var result = 0;
baseEach(collection, function(value, index, collection) {
result += +iteratee(value, index, collection) || 0;
});
return result;
}
/**
* The base implementation of `_.uniq` without support for callback shorthands
* and `this` binding.
*
* @private
* @param {Array} array The array to inspect.
* @param {Function} [iteratee] The function invoked per iteration.
* @returns {Array} Returns the new duplicate-value-free array.
*/
function baseUniq(array, iteratee) {
var index = -1,
indexOf = getIndexOf(),
length = array.length,
isCommon = indexOf == baseIndexOf,
isLarge = isCommon && length >= 200,
seen = isLarge ? createCache() : null,
result = [];
if (seen) {
indexOf = cacheIndexOf;
isCommon = false;
} else {
isLarge = false;
seen = iteratee ? [] : result;
}
outer:
while (++index < length) {
var value = array[index],
computed = iteratee ? iteratee(value, index, array) : value;
if (isCommon && value === value) {
var seenIndex = seen.length;
while (seenIndex--) {
if (seen[seenIndex] === computed) {
continue outer;
}
}
if (iteratee) {
seen.push(computed);
}
result.push(value);
}
else if (indexOf(seen, computed, 0) < 0) {
if (iteratee || isLarge) {
seen.push(computed);
}
result.push(value);
}
}
return result;
}
/**
* The base implementation of `_.values` and `_.valuesIn` which creates an
* array of `object` property values corresponding to the property names
* of `props`.
*
* @private
* @param {Object} object The object to query.
* @param {Array} props The property names to get values for.
* @returns {Object} Returns the array of property values.
*/
function baseValues(object, props) {
var index = -1,
length = props.length,
result = Array(length);
while (++index < length) {
result[index] = object[props[index]];
}
return result;
}
/**
* The base implementation of `_.dropRightWhile`, `_.dropWhile`, `_.takeRightWhile`,
* and `_.takeWhile` without support for callback shorthands and `this` binding.
*
* @private
* @param {Array} array The array to query.
* @param {Function} predicate The function invoked per iteration.
* @param {boolean} [isDrop] Specify dropping elements instead of taking them.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Array} Returns the slice of `array`.
*/
function baseWhile(array, predicate, isDrop, fromRight) {
var length = array.length,
index = fromRight ? length : -1;
while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) {}
return isDrop
? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
: baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
}
/**
* The base implementation of `wrapperValue` which returns the result of
* performing a sequence of actions on the unwrapped `value`, where each
* successive action is supplied the return value of the previous.
*
* @private
* @param {*} value The unwrapped value.
* @param {Array} actions Actions to peform to resolve the unwrapped value.
* @returns {*} Returns the resolved value.
*/
function baseWrapperValue(value, actions) {
var result = value;
if (result instanceof LazyWrapper) {
result = result.value();
}
var index = -1,
length = actions.length;
while (++index < length) {
var args = [result],
action = actions[index];
push.apply(args, action.args);
result = action.func.apply(action.thisArg, args);
}
return result;
}
/**
* Performs a binary search of `array` to determine the index at which `value`
* should be inserted into `array` in order to maintain its sort order.
*
* @private
* @param {Array} array The sorted array to inspect.
* @param {*} value The value to evaluate.
* @param {boolean} [retHighest] Specify returning the highest qualified index.
* @returns {number} Returns the index at which `value` should be inserted
* into `array`.
*/
function binaryIndex(array, value, retHighest) {
var low = 0,
high = array ? array.length : low;
if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
while (low < high) {
var mid = (low + high) >>> 1,
computed = array[mid];
if ((retHighest ? (computed <= value) : (computed < value)) && computed !== null) {
low = mid + 1;
} else {
high = mid;
}
}
return high;
}
return binaryIndexBy(array, value, identity, retHighest);
}
/**
* This function is like `binaryIndex` except that it invokes `iteratee` for
* `value` and each element of `array` to compute their sort ranking. The
* iteratee is invoked with one argument; (value).
*
* @private
* @param {Array} array The sorted array to inspect.
* @param {*} value The value to evaluate.
* @param {Function} iteratee The function invoked per iteration.
* @param {boolean} [retHighest] Specify returning the highest qualified index.
* @returns {number} Returns the index at which `value` should be inserted
* into `array`.
*/
function binaryIndexBy(array, value, iteratee, retHighest) {
value = iteratee(value);
var low = 0,
high = array ? array.length : 0,
valIsNaN = value !== value,
valIsNull = value === null,
valIsUndef = value === undefined;
while (low < high) {
var mid = floor((low + high) / 2),
computed = iteratee(array[mid]),
isDef = computed !== undefined,
isReflexive = computed === computed;
if (valIsNaN) {
var setLow = isReflexive || retHighest;
} else if (valIsNull) {
setLow = isReflexive && isDef && (retHighest || computed != null);
} else if (valIsUndef) {
setLow = isReflexive && (retHighest || isDef);
} else if (computed == null) {
setLow = false;
} else {
setLow = retHighest ? (computed <= value) : (computed < value);
}
if (setLow) {
low = mid + 1;
} else {
high = mid;
}
}
return nativeMin(high, MAX_ARRAY_INDEX);
}
/**
* A specialized version of `baseCallback` which only supports `this` binding
* and specifying the number of arguments to provide to `func`.
*
* @private
* @param {Function} func The function to bind.
* @param {*} thisArg The `this` binding of `func`.
* @param {number} [argCount] The number of arguments to provide to `func`.
* @returns {Function} Returns the callback.
*/
function bindCallback(func, thisArg, argCount) {
if (typeof func != 'function') {
return identity;
}
if (thisArg === undefined) {
return func;
}
switch (argCount) {
case 1: return function(value) {
return func.call(thisArg, value);
};
case 3: return function(value, index, collection) {
return func.call(thisArg, value, index, collection);
};
case 4: return function(accumulator, value, index, collection) {
return func.call(thisArg, accumulator, value, index, collection);
};
case 5: return function(value, other, key, object, source) {
return func.call(thisArg, value, other, key, object, source);
};
}
return function() {
return func.apply(thisArg, arguments);
};
}
/**
* Creates a clone of the given array buffer.
*
* @private
* @param {ArrayBuffer} buffer The array buffer to clone.
* @returns {ArrayBuffer} Returns the cloned array buffer.
*/
function bufferClone(buffer) {
return bufferSlice.call(buffer, 0);
}
if (!bufferSlice) {
// PhantomJS has `ArrayBuffer` and `Uint8Array` but not `Float64Array`.
bufferClone = !(ArrayBuffer && Uint8Array) ? constant(null) : function(buffer) {
var byteLength = buffer.byteLength,
floatLength = Float64Array ? floor(byteLength / FLOAT64_BYTES_PER_ELEMENT) : 0,
offset = floatLength * FLOAT64_BYTES_PER_ELEMENT,
result = new ArrayBuffer(byteLength);
if (floatLength) {
var view = new Float64Array(result, 0, floatLength);
view.set(new Float64Array(buffer, 0, floatLength));
}
if (byteLength != offset) {
view = new Uint8Array(result, offset);
view.set(new Uint8Array(buffer, offset));
}
return result;
};
}
/**
* Creates an array that is the composition of partially applied arguments,
* placeholders, and provided arguments into a single array of arguments.
*
* @private
* @param {Array|Object} args The provided arguments.
* @param {Array} partials The arguments to prepend to those provided.
* @param {Array} holders The `partials` placeholder indexes.
* @returns {Array} Returns the new array of composed arguments.
*/
function composeArgs(args, partials, holders) {
var holdersLength = holders.length,
argsIndex = -1,
argsLength = nativeMax(args.length - holdersLength, 0),
leftIndex = -1,
leftLength = partials.length,
result = Array(argsLength + leftLength);
while (++leftIndex < leftLength) {
result[leftIndex] = partials[leftIndex];
}
while (++argsIndex < holdersLength) {
result[holders[argsIndex]] = args[argsIndex];
}
while (argsLength--) {
result[leftIndex++] = args[argsIndex++];
}
return result;
}
/**
* This function is like `composeArgs` except that the arguments composition
* is tailored for `_.partialRight`.
*
* @private
* @param {Array|Object} args The provided arguments.
* @param {Array} partials The arguments to append to those provided.
* @param {Array} holders The `partials` placeholder indexes.
* @returns {Array} Returns the new array of composed arguments.
*/
function composeArgsRight(args, partials, holders) {
var holdersIndex = -1,
holdersLength = holders.length,
argsIndex = -1,
argsLength = nativeMax(args.length - holdersLength, 0),
rightIndex = -1,
rightLength = partials.length,
result = Array(argsLength + rightLength);
while (++argsIndex < argsLength) {
result[argsIndex] = args[argsIndex];
}
var offset = argsIndex;
while (++rightIndex < rightLength) {
result[offset + rightIndex] = partials[rightIndex];
}
while (++holdersIndex < holdersLength) {
result[offset + holders[holdersIndex]] = args[argsIndex++];
}
return result;
}
/**
* Creates a function that aggregates a collection, creating an accumulator
* object composed from the results of running each element in the collection
* through an iteratee.
*
* **Note:** This function is used to create `_.countBy`, `_.groupBy`, `_.indexBy`,
* and `_.partition`.
*
* @private
* @param {Function} setter The function to set keys and values of the accumulator object.
* @param {Function} [initializer] The function to initialize the accumulator object.
* @returns {Function} Returns the new aggregator function.
*/
function createAggregator(setter, initializer) {
return function(collection, iteratee, thisArg) {
var result = initializer ? initializer() : {};
iteratee = getCallback(iteratee, thisArg, 3);
if (isArray(collection)) {
var index = -1,
length = collection.length;
while (++index < length) {
var value = collection[index];
setter(result, value, iteratee(value, index, collection), collection);
}
} else {
baseEach(collection, function(value, key, collection) {
setter(result, value, iteratee(value, key, collection), collection);
});
}
return result;
};
}
/**
* Creates a function that assigns properties of source object(s) to a given
* destination object.
*
* **Note:** This function is used to create `_.assign`, `_.defaults`, and `_.merge`.
*
* @private
* @param {Function} assigner The function to assign values.
* @returns {Function} Returns the new assigner function.
*/
function createAssigner(assigner) {
return restParam(function(object, sources) {
var index = -1,
length = object == null ? 0 : sources.length,
customizer = length > 2 ? sources[length - 2] : undefined,
guard = length > 2 ? sources[2] : undefined,
thisArg = length > 1 ? sources[length - 1] : undefined;
if (typeof customizer == 'function') {
customizer = bindCallback(customizer, thisArg, 5);
length -= 2;
} else {
customizer = typeof thisArg == 'function' ? thisArg : undefined;
length -= (customizer ? 1 : 0);
}
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
customizer = length < 3 ? undefined : customizer;
length = 1;
}
while (++index < length) {
var source = sources[index];
if (source) {
assigner(object, source, customizer);
}
}
return object;
});
}
/**
* Creates a `baseEach` or `baseEachRight` function.
*
* @private
* @param {Function} eachFunc The function to iterate over a collection.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new base function.
*/
function createBaseEach(eachFunc, fromRight) {
return function(collection, iteratee) {
var length = collection ? getLength(collection) : 0;
if (!isLength(length)) {
return eachFunc(collection, iteratee);
}
var index = fromRight ? length : -1,
iterable = toObject(collection);
while ((fromRight ? index-- : ++index < length)) {
if (iteratee(iterable[index], index, iterable) === false) {
break;
}
}
return collection;
};
}
/**
* Creates a base function for `_.forIn` or `_.forInRight`.
*
* @private
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new base function.
*/
function createBaseFor(fromRight) {
return function(object, iteratee, keysFunc) {
var iterable = toObject(object),
props = keysFunc(object),
length = props.length,
index = fromRight ? length : -1;
while ((fromRight ? index-- : ++index < length)) {
var key = props[index];
if (iteratee(iterable[key], key, iterable) === false) {
break;
}
}
return object;
};
}
/**
* Creates a function that wraps `func` and invokes it with the `this`
* binding of `thisArg`.
*
* @private
* @param {Function} func The function to bind.
* @param {*} [thisArg] The `this` binding of `func`.
* @returns {Function} Returns the new bound function.
*/
function createBindWrapper(func, thisArg) {
var Ctor = createCtorWrapper(func);
function wrapper() {
var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
return fn.apply(thisArg, arguments);
}
return wrapper;
}
/**
* Creates a `Set` cache object to optimize linear searches of large arrays.
*
* @private
* @param {Array} [values] The values to cache.
* @returns {null|Object} Returns the new cache object if `Set` is supported, else `null`.
*/
var createCache = !(nativeCreate && Set) ? constant(null) : function(values) {
return new SetCache(values);
};
/**
* Creates a function that produces compound words out of the words in a
* given string.
*
* @private
* @param {Function} callback The function to combine each word.
* @returns {Function} Returns the new compounder function.
*/
function createCompounder(callback) {
return function(string) {
var index = -1,
array = words(deburr(string)),
length = array.length,
result = '';
while (++index < length) {
result = callback(result, array[index], index);
}
return result;
};
}
/**
* Creates a function that produces an instance of `Ctor` regardless of
* whether it was invoked as part of a `new` expression or by `call` or `apply`.
*
* @private
* @param {Function} Ctor The constructor to wrap.
* @returns {Function} Returns the new wrapped function.
*/
function createCtorWrapper(Ctor) {
return function() {
// Use a `switch` statement to work with class constructors.
// See https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects-call-thisargument-argumentslist
// for more details.
var args = arguments;
switch (args.length) {
case 0: return new Ctor;
case 1: return new Ctor(args[0]);
case 2: return new Ctor(args[0], args[1]);
case 3: return new Ctor(args[0], args[1], args[2]);
case 4: return new Ctor(args[0], args[1], args[2], args[3]);
case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
}
var thisBinding = baseCreate(Ctor.prototype),
result = Ctor.apply(thisBinding, args);
// Mimic the constructor's `return` behavior.
// See https://es5.github.io/#x13.2.2 for more details.
return isObject(result) ? result : thisBinding;
};
}
/**
* Creates a `_.curry` or `_.curryRight` function.
*
* @private
* @param {boolean} flag The curry bit flag.
* @returns {Function} Returns the new curry function.
*/
function createCurry(flag) {
function curryFunc(func, arity, guard) {
if (guard && isIterateeCall(func, arity, guard)) {
arity = null;
}
var result = createWrapper(func, flag, null, null, null, null, null, arity);
result.placeholder = curryFunc.placeholder;
return result;
}
return curryFunc;
}
/**
* Creates a `_.max` or `_.min` function.
*
* @private
* @param {Function} comparator The function used to compare values.
* @param {*} exValue The initial extremum value.
* @returns {Function} Returns the new extremum function.
*/
function createExtremum(comparator, exValue) {
return function(collection, iteratee, thisArg) {
if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {
iteratee = null;
}
iteratee = getCallback(iteratee, thisArg, 3);
if (iteratee.length == 1) {
collection = toIterable(collection);
var result = arrayExtremum(collection, iteratee, comparator, exValue);
if (!(collection.length && result === exValue)) {
return result;
}
}
return baseExtremum(collection, iteratee, comparator, exValue);
};
}
/**
* Creates a `_.find` or `_.findLast` function.
*
* @private
* @param {Function} eachFunc The function to iterate over a collection.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new find function.
*/
function createFind(eachFunc, fromRight) {
return function(collection, predicate, thisArg) {
predicate = getCallback(predicate, thisArg, 3);
if (isArray(collection)) {
var index = baseFindIndex(collection, predicate, fromRight);
return index > -1 ? collection[index] : undefined;
}
return baseFind(collection, predicate, eachFunc);
};
}
/**
* Creates a `_.findIndex` or `_.findLastIndex` function.
*
* @private
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new find function.
*/
function createFindIndex(fromRight) {
return function(array, predicate, thisArg) {
if (!(array && array.length)) {
return -1;
}
predicate = getCallback(predicate, thisArg, 3);
return baseFindIndex(array, predicate, fromRight);
};
}
/**
* Creates a `_.findKey` or `_.findLastKey` function.
*
* @private
* @param {Function} objectFunc The function to iterate over an object.
* @returns {Function} Returns the new find function.
*/
function createFindKey(objectFunc) {
return function(object, predicate, thisArg) {
predicate = getCallback(predicate, thisArg, 3);
return baseFind(object, predicate, objectFunc, true);
};
}
/**
* Creates a `_.flow` or `_.flowRight` function.
*
* @private
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new flow function.
*/
function createFlow(fromRight) {
return function() {
var wrapper,
length = arguments.length,
index = fromRight ? length : -1,
leftIndex = 0,
funcs = Array(length);
while ((fromRight ? index-- : ++index < length)) {
var func = funcs[leftIndex++] = arguments[index];
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
if (!wrapper && LodashWrapper.prototype.thru && getFuncName(func) == 'wrapper') {
wrapper = new LodashWrapper([]);
}
}
index = wrapper ? -1 : length;
while (++index < length) {
func = funcs[index];
var funcName = getFuncName(func),
data = funcName == 'wrapper' ? getData(func) : null;
if (data && isLaziable(data[0]) && data[1] == (ARY_FLAG | CURRY_FLAG | PARTIAL_FLAG | REARG_FLAG) && !data[4].length && data[9] == 1) {
wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
} else {
wrapper = (func.length == 1 && isLaziable(func)) ? wrapper[funcName]() : wrapper.thru(func);
}
}
return function() {
var args = arguments;
if (wrapper && args.length == 1 && isArray(args[0])) {
return wrapper.plant(args[0]).value();
}
var index = 0,
result = length ? funcs[index].apply(this, args) : args[0];
while (++index < length) {
result = funcs[index].call(this, result);
}
return result;
};
};
}
/**
* Creates a function for `_.forEach` or `_.forEachRight`.
*
* @private
* @param {Function} arrayFunc The function to iterate over an array.
* @param {Function} eachFunc The function to iterate over a collection.
* @returns {Function} Returns the new each function.
*/
function createForEach(arrayFunc, eachFunc) {
return function(collection, iteratee, thisArg) {
return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection))
? arrayFunc(collection, iteratee)
: eachFunc(collection, bindCallback(iteratee, thisArg, 3));
};
}
/**
* Creates a function for `_.forIn` or `_.forInRight`.
*
* @private
* @param {Function} objectFunc The function to iterate over an object.
* @returns {Function} Returns the new each function.
*/
function createForIn(objectFunc) {
return function(object, iteratee, thisArg) {
if (typeof iteratee != 'function' || thisArg !== undefined) {
iteratee = bindCallback(iteratee, thisArg, 3);
}
return objectFunc(object, iteratee, keysIn);
};
}
/**
* Creates a function for `_.forOwn` or `_.forOwnRight`.
*
* @private
* @param {Function} objectFunc The function to iterate over an object.
* @returns {Function} Returns the new each function.
*/
function createForOwn(objectFunc) {
return function(object, iteratee, thisArg) {
if (typeof iteratee != 'function' || thisArg !== undefined) {
iteratee = bindCallback(iteratee, thisArg, 3);
}
return objectFunc(object, iteratee);
};
}
/**
* Creates a function for `_.mapKeys` or `_.mapValues`.
*
* @private
* @param {boolean} [isMapKeys] Specify mapping keys instead of values.
* @returns {Function} Returns the new map function.
*/
function createObjectMapper(isMapKeys) {
return function(object, iteratee, thisArg) {
var result = {};
iteratee = getCallback(iteratee, thisArg, 3);
baseForOwn(object, function(value, key, object) {
var mapped = iteratee(value, key, object);
key = isMapKeys ? mapped : key;
value = isMapKeys ? value : mapped;
result[key] = value;
});
return result;
};
}
/**
* Creates a function for `_.padLeft` or `_.padRight`.
*
* @private
* @param {boolean} [fromRight] Specify padding from the right.
* @returns {Function} Returns the new pad function.
*/
function createPadDir(fromRight) {
return function(string, length, chars) {
string = baseToString(string);
return (fromRight ? string : '') + createPadding(string, length, chars) + (fromRight ? '' : string);
};
}
/**
* Creates a `_.partial` or `_.partialRight` function.
*
* @private
* @param {boolean} flag The partial bit flag.
* @returns {Function} Returns the new partial function.
*/
function createPartial(flag) {
var partialFunc = restParam(function(func, partials) {
var holders = replaceHolders(partials, partialFunc.placeholder);
return createWrapper(func, flag, null, partials, holders);
});
return partialFunc;
}
/**
* Creates a function for `_.reduce` or `_.reduceRight`.
*
* @private
* @param {Function} arrayFunc The function to iterate over an array.
* @param {Function} eachFunc The function to iterate over a collection.
* @returns {Function} Returns the new each function.
*/
function createReduce(arrayFunc, eachFunc) {
return function(collection, iteratee, accumulator, thisArg) {
var initFromArray = arguments.length < 3;
return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection))
? arrayFunc(collection, iteratee, accumulator, initFromArray)
: baseReduce(collection, getCallback(iteratee, thisArg, 4), accumulator, initFromArray, eachFunc);
};
}
/**
* Creates a function that wraps `func` and invokes it with optional `this`
* binding of, partial application, and currying.
*
* @private
* @param {Function|string} func The function or method name to reference.
* @param {number} bitmask The bitmask of flags. See `createWrapper` for more details.
* @param {*} [thisArg] The `this` binding of `func`.
* @param {Array} [partials] The arguments to prepend to those provided to the new function.
* @param {Array} [holders] The `partials` placeholder indexes.
* @param {Array} [partialsRight] The arguments to append to those provided to the new function.
* @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
* @param {Array} [argPos] The argument positions of the new function.
* @param {number} [ary] The arity cap of `func`.
* @param {number} [arity] The arity of `func`.
* @returns {Function} Returns the new wrapped function.
*/
function createHybridWrapper(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
var isAry = bitmask & ARY_FLAG,
isBind = bitmask & BIND_FLAG,
isBindKey = bitmask & BIND_KEY_FLAG,
isCurry = bitmask & CURRY_FLAG,
isCurryBound = bitmask & CURRY_BOUND_FLAG,
isCurryRight = bitmask & CURRY_RIGHT_FLAG,
Ctor = isBindKey ? null : createCtorWrapper(func);
function wrapper() {
// Avoid `arguments` object use disqualifying optimizations by
// converting it to an array before providing it to other functions.
var length = arguments.length,
index = length,
args = Array(length);
while (index--) {
args[index] = arguments[index];
}
if (partials) {
args = composeArgs(args, partials, holders);
}
if (partialsRight) {
args = composeArgsRight(args, partialsRight, holdersRight);
}
if (isCurry || isCurryRight) {
var placeholder = wrapper.placeholder,
argsHolders = replaceHolders(args, placeholder);
length -= argsHolders.length;
if (length < arity) {
var newArgPos = argPos ? arrayCopy(argPos) : null,
newArity = nativeMax(arity - length, 0),
newsHolders = isCurry ? argsHolders : null,
newHoldersRight = isCurry ? null : argsHolders,
newPartials = isCurry ? args : null,
newPartialsRight = isCurry ? null : args;
bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG);
bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG);
if (!isCurryBound) {
bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG);
}
var newData = [func, bitmask, thisArg, newPartials, newsHolders, newPartialsRight, newHoldersRight, newArgPos, ary, newArity],
result = createHybridWrapper.apply(undefined, newData);
if (isLaziable(func)) {
setData(result, newData);
}
result.placeholder = placeholder;
return result;
}
}
var thisBinding = isBind ? thisArg : this,
fn = isBindKey ? thisBinding[func] : func;
if (argPos) {
args = reorder(args, argPos);
}
if (isAry && ary < args.length) {
args.length = ary;
}
if (this && this !== root && this instanceof wrapper) {
fn = Ctor || createCtorWrapper(func);
}
return fn.apply(thisBinding, args);
}
return wrapper;
}
/**
* Creates the padding required for `string` based on the given `length`.
* The `chars` string is truncated if the number of characters exceeds `length`.
*
* @private
* @param {string} string The string to create padding for.
* @param {number} [length=0] The padding length.
* @param {string} [chars=' '] The string used as padding.
* @returns {string} Returns the pad for `string`.
*/
function createPadding(string, length, chars) {
var strLength = string.length;
length = +length;
if (strLength >= length || !nativeIsFinite(length)) {
return '';
}
var padLength = length - strLength;
chars = chars == null ? ' ' : (chars + '');
return repeat(chars, ceil(padLength / chars.length)).slice(0, padLength);
}
/**
* Creates a function that wraps `func` and invokes it with the optional `this`
* binding of `thisArg` and the `partials` prepended to those provided to
* the wrapper.
*
* @private
* @param {Function} func The function to partially apply arguments to.
* @param {number} bitmask The bitmask of flags. See `createWrapper` for more details.
* @param {*} thisArg The `this` binding of `func`.
* @param {Array} partials The arguments to prepend to those provided to the new function.
* @returns {Function} Returns the new bound function.
*/
function createPartialWrapper(func, bitmask, thisArg, partials) {
var isBind = bitmask & BIND_FLAG,
Ctor = createCtorWrapper(func);
function wrapper() {
// Avoid `arguments` object use disqualifying optimizations by
// converting it to an array before providing it `func`.
var argsIndex = -1,
argsLength = arguments.length,
leftIndex = -1,
leftLength = partials.length,
args = Array(argsLength + leftLength);
while (++leftIndex < leftLength) {
args[leftIndex] = partials[leftIndex];
}
while (argsLength--) {
args[leftIndex++] = arguments[++argsIndex];
}
var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
return fn.apply(isBind ? thisArg : this, args);
}
return wrapper;
}
/**
* Creates a `_.sortedIndex` or `_.sortedLastIndex` function.
*
* @private
* @param {boolean} [retHighest] Specify returning the highest qualified index.
* @returns {Function} Returns the new index function.
*/
function createSortedIndex(retHighest) {
return function(array, value, iteratee, thisArg) {
var callback = getCallback(iteratee);
return (iteratee == null && callback === baseCallback)
? binaryIndex(array, value, retHighest)
: binaryIndexBy(array, value, callback(iteratee, thisArg, 1), retHighest);
};
}
/**
* Creates a function that either curries or invokes `func` with optional
* `this` binding and partially applied arguments.
*
* @private
* @param {Function|string} func The function or method name to reference.
* @param {number} bitmask The bitmask of flags.
* The bitmask may be composed of the following flags:
* 1 - `_.bind`
* 2 - `_.bindKey`
* 4 - `_.curry` or `_.curryRight` of a bound function
* 8 - `_.curry`
* 16 - `_.curryRight`
* 32 - `_.partial`
* 64 - `_.partialRight`
* 128 - `_.rearg`
* 256 - `_.ary`
* @param {*} [thisArg] The `this` binding of `func`.
* @param {Array} [partials] The arguments to be partially applied.
* @param {Array} [holders] The `partials` placeholder indexes.
* @param {Array} [argPos] The argument positions of the new function.
* @param {number} [ary] The arity cap of `func`.
* @param {number} [arity] The arity of `func`.
* @returns {Function} Returns the new wrapped function.
*/
function createWrapper(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
var isBindKey = bitmask & BIND_KEY_FLAG;
if (!isBindKey && typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
var length = partials ? partials.length : 0;
if (!length) {
bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG);
partials = holders = null;
}
length -= (holders ? holders.length : 0);
if (bitmask & PARTIAL_RIGHT_FLAG) {
var partialsRight = partials,
holdersRight = holders;
partials = holders = null;
}
var data = isBindKey ? null : getData(func),
newData = [func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity];
if (data) {
mergeData(newData, data);
bitmask = newData[1];
arity = newData[9];
}
newData[9] = arity == null
? (isBindKey ? 0 : func.length)
: (nativeMax(arity - length, 0) || 0);
if (bitmask == BIND_FLAG) {
var result = createBindWrapper(newData[0], newData[2]);
} else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !newData[4].length) {
result = createPartialWrapper.apply(undefined, newData);
} else {
result = createHybridWrapper.apply(undefined, newData);
}
var setter = data ? baseSetData : setData;
return setter(result, newData);
}
/**
* A specialized version of `baseIsEqualDeep` for arrays with support for
* partial deep comparisons.
*
* @private
* @param {Array} array The array to compare.
* @param {Array} other The other array to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} [customizer] The function to customize comparing arrays.
* @param {boolean} [isLoose] Specify performing partial comparisons.
* @param {Array} [stackA] Tracks traversed `value` objects.
* @param {Array} [stackB] Tracks traversed `other` objects.
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
*/
function equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) {
var index = -1,
arrLength = array.length,
othLength = other.length;
if (arrLength != othLength && !(isLoose && othLength > arrLength)) {
return false;
}
// Ignore non-index properties.
while (++index < arrLength) {
var arrValue = array[index],
othValue = other[index],
result = customizer ? customizer(isLoose ? othValue : arrValue, isLoose ? arrValue : othValue, index) : undefined;
if (result !== undefined) {
if (result) {
continue;
}
return false;
}
// Recursively compare arrays (susceptible to call stack limits).
if (isLoose) {
if (!arraySome(other, function(othValue) {
return arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB);
})) {
return false;
}
} else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB))) {
return false;
}
}
return true;
}
/**
* A specialized version of `baseIsEqualDeep` for comparing objects of
* the same `toStringTag`.
*
* **Note:** This function only supports comparing values with tags of
* `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
*
* @private
* @param {Object} value The object to compare.
* @param {Object} other The other object to compare.
* @param {string} tag The `toStringTag` of the objects to compare.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalByTag(object, other, tag) {
switch (tag) {
case boolTag:
case dateTag:
// 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 +object == +other;
case errorTag:
return object.name == other.name && object.message == other.message;
case numberTag:
// Treat `NaN` vs. `NaN` as equal.
return (object != +object)
? other != +other
: object == +other;
case regexpTag:
case stringTag:
// Coerce regexes to strings and treat strings primitives and string
// objects as equal. See https://es5.github.io/#x15.10.6.4 for more details.
return object == (other + '');
}
return false;
}
/**
* A specialized version of `baseIsEqualDeep` for objects with support for
* partial deep comparisons.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} [customizer] The function to customize comparing values.
* @param {boolean} [isLoose] Specify performing partial comparisons.
* @param {Array} [stackA] Tracks traversed `value` objects.
* @param {Array} [stackB] Tracks traversed `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalObjects(object, other, equalFunc, customizer, isLoose, stackA, stackB) {
var objProps = keys(object),
objLength = objProps.length,
othProps = keys(other),
othLength = othProps.length;
if (objLength != othLength && !isLoose) {
return false;
}
var index = objLength;
while (index--) {
var key = objProps[index];
if (!(isLoose ? key in other : hasOwnProperty.call(other, key))) {
return false;
}
}
var skipCtor = isLoose;
while (++index < objLength) {
key = objProps[index];
var objValue = object[key],
othValue = other[key],
result = customizer ? customizer(isLoose ? othValue : objValue, isLoose? objValue : othValue, key) : undefined;
// Recursively compare objects (susceptible to call stack limits).
if (!(result === undefined ? equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB) : result)) {
return false;
}
skipCtor || (skipCtor = key == 'constructor');
}
if (!skipCtor) {
var objCtor = object.constructor,
othCtor = other.constructor;
// Non `Object` object instances with different constructors are not equal.
if (objCtor != othCtor &&
('constructor' in object && 'constructor' in other) &&
!(typeof objCtor == 'function' && objCtor instanceof objCtor &&
typeof othCtor == 'function' && othCtor instanceof othCtor)) {
return false;
}
}
return true;
}
/**
* Gets the appropriate "callback" function. If the `_.callback` method is
* customized this function returns the custom method, otherwise it returns
* the `baseCallback` function. If arguments are provided the chosen function
* is invoked with them and its result is returned.
*
* @private
* @returns {Function} Returns the chosen function or its result.
*/
function getCallback(func, thisArg, argCount) {
var result = lodash.callback || callback;
result = result === callback ? baseCallback : result;
return argCount ? result(func, thisArg, argCount) : result;
}
/**
* Gets metadata for `func`.
*
* @private
* @param {Function} func The function to query.
* @returns {*} Returns the metadata for `func`.
*/
var getData = !metaMap ? noop : function(func) {
return metaMap.get(func);
};
/**
* Gets the name of `func`.
*
* @private
* @param {Function} func The function to query.
* @returns {string} Returns the function name.
*/
function getFuncName(func) {
var result = func.name,
array = realNames[result],
length = array ? array.length : 0;
while (length--) {
var data = array[length],
otherFunc = data.func;
if (otherFunc == null || otherFunc == func) {
return data.name;
}
}
return result;
}
/**
* Gets the appropriate "indexOf" function. If the `_.indexOf` method is
* customized this function returns the custom method, otherwise it returns
* the `baseIndexOf` function. If arguments are provided the chosen function
* is invoked with them and its result is returned.
*
* @private
* @returns {Function|number} Returns the chosen function or its result.
*/
function getIndexOf(collection, target, fromIndex) {
var result = lodash.indexOf || indexOf;
result = result === indexOf ? baseIndexOf : result;
return collection ? result(collection, target, fromIndex) : result;
}
/**
* Gets the "length" property value of `object`.
*
* **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
* that affects Safari on at least iOS 8.1-8.3 ARM64.
*
* @private
* @param {Object} object The object to query.
* @returns {*} Returns the "length" value.
*/
var getLength = baseProperty('length');
/**
* Gets the propery names, values, and compare flags of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the match data of `object`.
*/
function getMatchData(object) {
var result = pairs(object),
length = result.length;
while (length--) {
result[length][2] = isStrictComparable(result[length][1]);
}
return result;
}
/**
* Gets the native function at `key` of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {string} key The key of the method to get.
* @returns {*} Returns the function if it's native, else `undefined`.
*/
function getNative(object, key) {
var value = object == null ? undefined : object[key];
return isNative(value) ? value : undefined;
}
/**
* Gets the view, applying any `transforms` to the `start` and `end` positions.
*
* @private
* @param {number} start The start of the view.
* @param {number} end The end of the view.
* @param {Array} [transforms] The transformations to apply to the view.
* @returns {Object} Returns an object containing the `start` and `end`
* positions of the view.
*/
function getView(start, end, transforms) {
var index = -1,
length = transforms ? transforms.length : 0;
while (++index < length) {
var data = transforms[index],
size = data.size;
switch (data.type) {
case 'drop': start += size; break;
case 'dropRight': end -= size; break;
case 'take': end = nativeMin(end, start + size); break;
case 'takeRight': start = nativeMax(start, end - size); break;
}
}
return { 'start': start, 'end': end };
}
/**
* Initializes an array clone.
*
* @private
* @param {Array} array The array to clone.
* @returns {Array} Returns the initialized clone.
*/
function initCloneArray(array) {
var length = array.length,
result = new array.constructor(length);
// Add array properties assigned by `RegExp#exec`.
if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
result.index = array.index;
result.input = array.input;
}
return result;
}
/**
* Initializes an object clone.
*
* @private
* @param {Object} object The object to clone.
* @returns {Object} Returns the initialized clone.
*/
function initCloneObject(object) {
var Ctor = object.constructor;
if (!(typeof Ctor == 'function' && Ctor instanceof Ctor)) {
Ctor = Object;
}
return new Ctor;
}
/**
* Initializes an object clone based on its `toStringTag`.
*
* **Note:** This function only supports cloning values with tags of
* `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
*
* @private
* @param {Object} object The object to clone.
* @param {string} tag The `toStringTag` of the object to clone.
* @param {boolean} [isDeep] Specify a deep clone.
* @returns {Object} Returns the initialized clone.
*/
function initCloneByTag(object, tag, isDeep) {
var Ctor = object.constructor;
switch (tag) {
case arrayBufferTag:
return bufferClone(object);
case boolTag:
case dateTag:
return new Ctor(+object);
case float32Tag: case float64Tag:
case int8Tag: case int16Tag: case int32Tag:
case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
var buffer = object.buffer;
return new Ctor(isDeep ? bufferClone(buffer) : buffer, object.byteOffset, object.length);
case numberTag:
case stringTag:
return new Ctor(object);
case regexpTag:
var result = new Ctor(object.source, reFlags.exec(object));
result.lastIndex = object.lastIndex;
}
return result;
}
/**
* Invokes the method at `path` on `object`.
*
* @private
* @param {Object} object The object to query.
* @param {Array|string} path The path of the method to invoke.
* @param {Array} args The arguments to invoke the method with.
* @returns {*} Returns the result of the invoked method.
*/
function invokePath(object, path, args) {
if (object != null && !isKey(path, object)) {
path = toPath(path);
object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
path = last(path);
}
var func = object == null ? object : object[path];
return func == null ? undefined : func.apply(object, args);
}
/**
* Checks if `value` is array-like.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
*/
function isArrayLike(value) {
return value != null && isLength(getLength(value));
}
/**
* Checks if `value` is a valid array-like index.
*
* @private
* @param {*} value The value to check.
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
*/
function isIndex(value, length) {
value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
length = length == null ? MAX_SAFE_INTEGER : length;
return value > -1 && value % 1 == 0 && value < length;
}
/**
* Checks if the provided arguments are from an iteratee call.
*
* @private
* @param {*} value The potential iteratee value argument.
* @param {*} index The potential iteratee index or key argument.
* @param {*} object The potential iteratee object argument.
* @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.
*/
function isIterateeCall(value, index, object) {
if (!isObject(object)) {
return false;
}
var type = typeof index;
if (type == 'number'
? (isArrayLike(object) && isIndex(index, object.length))
: (type == 'string' && index in object)) {
var other = object[index];
return value === value ? (value === other) : (other !== other);
}
return false;
}
/**
* Checks if `value` is a property name and not a property path.
*
* @private
* @param {*} value The value to check.
* @param {Object} [object] The object to query keys on.
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
*/
function isKey(value, object) {
var type = typeof value;
if ((type == 'string' && reIsPlainProp.test(value)) || type == 'number') {
return true;
}
if (isArray(value)) {
return false;
}
var result = !reIsDeepProp.test(value);
return result || (object != null && value in toObject(object));
}
/**
* Checks if `func` has a lazy counterpart.
*
* @private
* @param {Function} func The function to check.
* @returns {boolean} Returns `true` if `func` has a lazy counterpart, else `false`.
*/
function isLaziable(func) {
var funcName = getFuncName(func);
if (!(funcName in LazyWrapper.prototype)) {
return false;
}
var other = lodash[funcName];
if (func === other) {
return true;
}
var data = getData(other);
return !!data && func === data[0];
}
/**
* Checks if `value` is a valid array-like length.
*
* **Note:** This function is based on [`ToLength`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength).
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
*/
function isLength(value) {
return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}
/**
* Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` if suitable for strict
* equality comparisons, else `false`.
*/
function isStrictComparable(value) {
return value === value && !isObject(value);
}
/**
* Merges the function metadata of `source` into `data`.
*
* Merging metadata reduces the number of wrappers required to invoke a function.
* This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
* may be applied regardless of execution order. Methods like `_.ary` and `_.rearg`
* augment function arguments, making the order in which they are executed important,
* preventing the merging of metadata. However, we make an exception for a safe
* common case where curried functions have `_.ary` and or `_.rearg` applied.
*
* @private
* @param {Array} data The destination metadata.
* @param {Array} source The source metadata.
* @returns {Array} Returns `data`.
*/
function mergeData(data, source) {
var bitmask = data[1],
srcBitmask = source[1],
newBitmask = bitmask | srcBitmask,
isCommon = newBitmask < ARY_FLAG;
var isCombo =
(srcBitmask == ARY_FLAG && bitmask == CURRY_FLAG) ||
(srcBitmask == ARY_FLAG && bitmask == REARG_FLAG && data[7].length <= source[8]) ||
(srcBitmask == (ARY_FLAG | REARG_FLAG) && bitmask == CURRY_FLAG);
// Exit early if metadata can't be merged.
if (!(isCommon || isCombo)) {
return data;
}
// Use source `thisArg` if available.
if (srcBitmask & BIND_FLAG) {
data[2] = source[2];
// Set when currying a bound function.
newBitmask |= (bitmask & BIND_FLAG) ? 0 : CURRY_BOUND_FLAG;
}
// Compose partial arguments.
var value = source[3];
if (value) {
var partials = data[3];
data[3] = partials ? composeArgs(partials, value, source[4]) : arrayCopy(value);
data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : arrayCopy(source[4]);
}
// Compose partial right arguments.
value = source[5];
if (value) {
partials = data[5];
data[5] = partials ? composeArgsRight(partials, value, source[6]) : arrayCopy(value);
data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : arrayCopy(source[6]);
}
// Use source `argPos` if available.
value = source[7];
if (value) {
data[7] = arrayCopy(value);
}
// Use source `ary` if it's smaller.
if (srcBitmask & ARY_FLAG) {
data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
}
// Use source `arity` if one is not provided.
if (data[9] == null) {
data[9] = source[9];
}
// Use source `func` and merge bitmasks.
data[0] = source[0];
data[1] = newBitmask;
return data;
}
/**
* A specialized version of `_.pick` which picks `object` properties specified
* by `props`.
*
* @private
* @param {Object} object The source object.
* @param {string[]} props The property names to pick.
* @returns {Object} Returns the new object.
*/
function pickByArray(object, props) {
object = toObject(object);
var index = -1,
length = props.length,
result = {};
while (++index < length) {
var key = props[index];
if (key in object) {
result[key] = object[key];
}
}
return result;
}
/**
* A specialized version of `_.pick` which picks `object` properties `predicate`
* returns truthy for.
*
* @private
* @param {Object} object The source object.
* @param {Function} predicate The function invoked per iteration.
* @returns {Object} Returns the new object.
*/
function pickByCallback(object, predicate) {
var result = {};
baseForIn(object, function(value, key, object) {
if (predicate(value, key, object)) {
result[key] = value;
}
});
return result;
}
/**
* Reorder `array` according to the specified indexes where the element at
* the first index is assigned as the first element, the element at
* the second index is assigned as the second element, and so on.
*
* @private
* @param {Array} array The array to reorder.
* @param {Array} indexes The arranged array indexes.
* @returns {Array} Returns `array`.
*/
function reorder(array, indexes) {
var arrLength = array.length,
length = nativeMin(indexes.length, arrLength),
oldArray = arrayCopy(array);
while (length--) {
var index = indexes[length];
array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
}
return array;
}
/**
* Sets metadata for `func`.
*
* **Note:** If this function becomes hot, i.e. is invoked a lot in a short
* period of time, it will trip its breaker and transition to an identity function
* to avoid garbage collection pauses in V8. See [V8 issue 2070](https://code.google.com/p/v8/issues/detail?id=2070)
* for more details.
*
* @private
* @param {Function} func The function to associate metadata with.
* @param {*} data The metadata.
* @returns {Function} Returns `func`.
*/
var setData = (function() {
var count = 0,
lastCalled = 0;
return function(key, value) {
var stamp = now(),
remaining = HOT_SPAN - (stamp - lastCalled);
lastCalled = stamp;
if (remaining > 0) {
if (++count >= HOT_COUNT) {
return key;
}
} else {
count = 0;
}
return baseSetData(key, value);
};
}());
/**
* A fallback implementation of `_.isPlainObject` which checks if `value`
* is an object created by the `Object` constructor or has a `[[Prototype]]`
* of `null`.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
*/
function shimIsPlainObject(value) {
var Ctor,
support = lodash.support;
// Exit early for non `Object` objects.
if (!(isObjectLike(value) && objToString.call(value) == objectTag) ||
(!hasOwnProperty.call(value, 'constructor') &&
(Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) {
return false;
}
// IE < 9 iterates inherited properties before own properties. If the first
// iterated property is an object's own property then there are no inherited
// enumerable properties.
var result;
// In most environments an object's own properties are iterated before
// its inherited properties. If the last iterated property is an object's
// own property then there are no inherited enumerable properties.
baseForIn(value, function(subValue, key) {
result = key;
});
return result === undefined || hasOwnProperty.call(value, result);
}
/**
* A fallback implementation of `Object.keys` which creates an array of the
* own enumerable property names of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function shimKeys(object) {
var props = keysIn(object),
propsLength = props.length,
length = propsLength && object.length;
var allowIndexes = !!length && isLength(length) &&
(isArray(object) || isArguments(object));
var index = -1,
result = [];
while (++index < propsLength) {
var key = props[index];
if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {
result.push(key);
}
}
return result;
}
/**
* Converts `value` to an array-like object if it's not one.
*
* @private
* @param {*} value The value to process.
* @returns {Array|Object} Returns the array-like object.
*/
function toIterable(value) {
if (value == null) {
return [];
}
if (!isArrayLike(value)) {
return values(value);
}
return isObject(value) ? value : Object(value);
}
/**
* Converts `value` to an object if it's not one.
*
* @private
* @param {*} value The value to process.
* @returns {Object} Returns the object.
*/
function toObject(value) {
return isObject(value) ? value : Object(value);
}
/**
* Converts `value` to property path array if it's not one.
*
* @private
* @param {*} value The value to process.
* @returns {Array} Returns the property path array.
*/
function toPath(value) {
if (isArray(value)) {
return value;
}
var result = [];
baseToString(value).replace(rePropName, function(match, number, quote, string) {
result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
});
return result;
}
/**
* Creates a clone of `wrapper`.
*
* @private
* @param {Object} wrapper The wrapper to clone.
* @returns {Object} Returns the cloned wrapper.
*/
function wrapperClone(wrapper) {
return wrapper instanceof LazyWrapper
? wrapper.clone()
: new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__, arrayCopy(wrapper.__actions__));
}
/*------------------------------------------------------------------------*/
/**
* Creates an array of elements split into groups the length of `size`.
* If `collection` can't be split evenly, the final chunk will be the remaining
* elements.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to process.
* @param {number} [size=1] The length of each chunk.
* @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
* @returns {Array} Returns the new array containing chunks.
* @example
*
* _.chunk(['a', 'b', 'c', 'd'], 2);
* // => [['a', 'b'], ['c', 'd']]
*
* _.chunk(['a', 'b', 'c', 'd'], 3);
* // => [['a', 'b', 'c'], ['d']]
*/
function chunk(array, size, guard) {
if (guard ? isIterateeCall(array, size, guard) : size == null) {
size = 1;
} else {
size = nativeMax(+size || 1, 1);
}
var index = 0,
length = array ? array.length : 0,
resIndex = -1,
result = Array(ceil(length / size));
while (index < length) {
result[++resIndex] = baseSlice(array, index, (index += size));
}
return result;
}
/**
* Creates an array with all falsey values removed. The values `false`, `null`,
* `0`, `""`, `undefined`, and `NaN` are falsey.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to compact.
* @returns {Array} Returns the new array of filtered values.
* @example
*
* _.compact([0, 1, false, 2, '', 3]);
* // => [1, 2, 3]
*/
function compact(array) {
var index = -1,
length = array ? array.length : 0,
resIndex = -1,
result = [];
while (++index < length) {
var value = array[index];
if (value) {
result[++resIndex] = value;
}
}
return result;
}
/**
* Creates an array of unique `array` values not included in the other
* provided arrays using [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
* for equality comparisons.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to inspect.
* @param {...Array} [values] The arrays of values to exclude.
* @returns {Array} Returns the new array of filtered values.
* @example
*
* _.difference([1, 2, 3], [4, 2]);
* // => [1, 3]
*/
var difference = restParam(function(array, values) {
return isArrayLike(array)
? baseDifference(array, baseFlatten(values, false, true))
: [];
});
/**
* Creates a slice of `array` with `n` elements dropped from the beginning.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to query.
* @param {number} [n=1] The number of elements to drop.
* @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
* @returns {Array} Returns the slice of `array`.
* @example
*
* _.drop([1, 2, 3]);
* // => [2, 3]
*
* _.drop([1, 2, 3], 2);
* // => [3]
*
* _.drop([1, 2, 3], 5);
* // => []
*
* _.drop([1, 2, 3], 0);
* // => [1, 2, 3]
*/
function drop(array, n, guard) {
var length = array ? array.length : 0;
if (!length) {
return [];
}
if (guard ? isIterateeCall(array, n, guard) : n == null) {
n = 1;
}
return baseSlice(array, n < 0 ? 0 : n);
}
/**
* Creates a slice of `array` with `n` elements dropped from the end.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to query.
* @param {number} [n=1] The number of elements to drop.
* @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
* @returns {Array} Returns the slice of `array`.
* @example
*
* _.dropRight([1, 2, 3]);
* // => [1, 2]
*
* _.dropRight([1, 2, 3], 2);
* // => [1]
*
* _.dropRight([1, 2, 3], 5);
* // => []
*
* _.dropRight([1, 2, 3], 0);
* // => [1, 2, 3]
*/
function dropRight(array, n, guard) {
var length = array ? array.length : 0;
if (!length) {
return [];
}
if (guard ? isIterateeCall(array, n, guard) : n == null) {
n = 1;
}
n = length - (+n || 0);
return baseSlice(array, 0, n < 0 ? 0 : n);
}
/**
* Creates a slice of `array` excluding elements dropped from the end.
* Elements are dropped until `predicate` returns falsey. The predicate is
* bound to `thisArg` and invoked with three arguments: (value, index, array).
*
* If a property name is provided for `predicate` the created `_.property`
* style callback returns the property value of the given element.
*
* If a value is also provided for `thisArg` the created `_.matchesProperty`
* style callback returns `true` for elements that have a matching property
* value, else `false`.
*
* If an object is provided for `predicate` the created `_.matches` style
* callback returns `true` for elements that match the properties of the given
* object, else `false`.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to query.
* @param {Function|Object|string} [predicate=_.identity] The function invoked
* per iteration.
* @param {*} [thisArg] The `this` binding of `predicate`.
* @returns {Array} Returns the slice of `array`.
* @example
*
* _.dropRightWhile([1, 2, 3], function(n) {
* return n > 1;
* });
* // => [1]
*
* var users = [
* { 'user': 'barney', 'active': true },
* { 'user': 'fred', 'active': false },
* { 'user': 'pebbles', 'active': false }
* ];
*
* // using the `_.matches` callback shorthand
* _.pluck(_.dropRightWhile(users, { 'user': 'pebbles', 'active': false }), 'user');
* // => ['barney', 'fred']
*
* // using the `_.matchesProperty` callback shorthand
* _.pluck(_.dropRightWhile(users, 'active', false), 'user');
* // => ['barney']
*
* // using the `_.property` callback shorthand
* _.pluck(_.dropRightWhile(users, 'active'), 'user');
* // => ['barney', 'fred', 'pebbles']
*/
function dropRightWhile(array, predicate, thisArg) {
return (array && array.length)
? baseWhile(array, getCallback(predicate, thisArg, 3), true, true)
: [];
}
/**
* Creates a slice of `array` excluding elements dropped from the beginning.
* Elements are dropped until `predicate` returns falsey. The predicate is
* bound to `thisArg` and invoked with three arguments: (value, index, array).
*
* If a property name is provided for `predicate` the created `_.property`
* style callback returns the property value of the given element.
*
* If a value is also provided for `thisArg` the created `_.matchesProperty`
* style callback returns `true` for elements that have a matching property
* value, else `false`.
*
* If an object is provided for `predicate` the created `_.matches` style
* callback returns `true` for elements that have the properties of the given
* object, else `false`.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to query.
* @param {Function|Object|string} [predicate=_.identity] The function invoked
* per iteration.
* @param {*} [thisArg] The `this` binding of `predicate`.
* @returns {Array} Returns the slice of `array`.
* @example
*
* _.dropWhile([1, 2, 3], function(n) {
* return n < 3;
* });
* // => [3]
*
* var users = [
* { 'user': 'barney', 'active': false },
* { 'user': 'fred', 'active': false },
* { 'user': 'pebbles', 'active': true }
* ];
*
* // using the `_.matches` callback shorthand
* _.pluck(_.dropWhile(users, { 'user': 'barney', 'active': false }), 'user');
* // => ['fred', 'pebbles']
*
* // using the `_.matchesProperty` callback shorthand
* _.pluck(_.dropWhile(users, 'active', false), 'user');
* // => ['pebbles']
*
* // using the `_.property` callback shorthand
* _.pluck(_.dropWhile(users, 'active'), 'user');
* // => ['barney', 'fred', 'pebbles']
*/
function dropWhile(array, predicate, thisArg) {
return (array && array.length)
? baseWhile(array, getCallback(predicate, thisArg, 3), true)
: [];
}
/**
* Fills elements of `array` with `value` from `start` up to, but not
* including, `end`.
*
* **Note:** This method mutates `array`.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to fill.
* @param {*} value The value to fill `array` with.
* @param {number} [start=0] The start position.
* @param {number} [end=array.length] The end position.
* @returns {Array} Returns `array`.
* @example
*
* var array = [1, 2, 3];
*
* _.fill(array, 'a');
* console.log(array);
* // => ['a', 'a', 'a']
*
* _.fill(Array(3), 2);
* // => [2, 2, 2]
*
* _.fill([4, 6, 8], '*', 1, 2);
* // => [4, '*', 8]
*/
function fill(array, value, start, end) {
var length = array ? array.length : 0;
if (!length) {
return [];
}
if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
start = 0;
end = length;
}
return baseFill(array, value, start, end);
}
/**
* This method is like `_.find` except that it returns the index of the first
* element `predicate` returns truthy for instead of the element itself.
*
* If a property name is provided for `predicate` the created `_.property`
* style callback returns the property value of the given element.
*
* If a value is also provided for `thisArg` the created `_.matchesProperty`
* style callback returns `true` for elements that have a matching property
* value, else `false`.
*
* If an object is provided for `predicate` the created `_.matches` style
* callback returns `true` for elements that have the properties of the given
* object, else `false`.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to search.
* @param {Function|Object|string} [predicate=_.identity] The function invoked
* per iteration.
* @param {*} [thisArg] The `this` binding of `predicate`.
* @returns {number} Returns the index of the found element, else `-1`.
* @example
*
* var users = [
* { 'user': 'barney', 'active': false },
* { 'user': 'fred', 'active': false },
* { 'user': 'pebbles', 'active': true }
* ];
*
* _.findIndex(users, function(chr) {
* return chr.user == 'barney';
* });
* // => 0
*
* // using the `_.matches` callback shorthand
* _.findIndex(users, { 'user': 'fred', 'active': false });
* // => 1
*
* // using the `_.matchesProperty` callback shorthand
* _.findIndex(users, 'active', false);
* // => 0
*
* // using the `_.property` callback shorthand
* _.findIndex(users, 'active');
* // => 2
*/
var findIndex = createFindIndex();
/**
* This method is like `_.findIndex` except that it iterates over elements
* of `collection` from right to left.
*
* If a property name is provided for `predicate` the created `_.property`
* style callback returns the property value of the given element.
*
* If a value is also provided for `thisArg` the created `_.matchesProperty`
* style callback returns `true` for elements that have a matching property
* value, else `false`.
*
* If an object is provided for `predicate` the created `_.matches` style
* callback returns `true` for elements that have the properties of the given
* object, else `false`.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to search.
* @param {Function|Object|string} [predicate=_.identity] The function invoked
* per iteration.
* @param {*} [thisArg] The `this` binding of `predicate`.
* @returns {number} Returns the index of the found element, else `-1`.
* @example
*
* var users = [
* { 'user': 'barney', 'active': true },
* { 'user': 'fred', 'active': false },
* { 'user': 'pebbles', 'active': false }
* ];
*
* _.findLastIndex(users, function(chr) {
* return chr.user == 'pebbles';
* });
* // => 2
*
* // using the `_.matches` callback shorthand
* _.findLastIndex(users, { 'user': 'barney', 'active': true });
* // => 0
*
* // using the `_.matchesProperty` callback shorthand
* _.findLastIndex(users, 'active', false);
* // => 2
*
* // using the `_.property` callback shorthand
* _.findLastIndex(users, 'active');
* // => 0
*/
var findLastIndex = createFindIndex(true);
/**
* Gets the first element of `array`.
*
* @static
* @memberOf _
* @alias head
* @category Array
* @param {Array} array The array to query.
* @returns {*} Returns the first element of `array`.
* @example
*
* _.first([1, 2, 3]);
* // => 1
*
* _.first([]);
* // => undefined
*/
function first(array) {
return array ? array[0] : undefined;
}
/**
* Flattens a nested array. If `isDeep` is `true` the array is recursively
* flattened, otherwise it is only flattened a single level.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to flatten.
* @param {boolean} [isDeep] Specify a deep flatten.
* @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
* @returns {Array} Returns the new flattened array.
* @example
*
* _.flatten([1, [2, 3, [4]]]);
* // => [1, 2, 3, [4]]
*
* // using `isDeep`
* _.flatten([1, [2, 3, [4]]], true);
* // => [1, 2, 3, 4]
*/
function flatten(array, isDeep, guard) {
var length = array ? array.length : 0;
if (guard && isIterateeCall(array, isDeep, guard)) {
isDeep = false;
}
return length ? baseFlatten(array, isDeep) : [];
}
/**
* Recursively flattens a nested array.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to recursively flatten.
* @returns {Array} Returns the new flattened array.
* @example
*
* _.flattenDeep([1, [2, 3, [4]]]);
* // => [1, 2, 3, 4]
*/
function flattenDeep(array) {
var length = array ? array.length : 0;
return length ? baseFlatten(array, true) : [];
}
/**
* Gets the index at which the first occurrence of `value` is found in `array`
* using [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
* for equality comparisons. If `fromIndex` is negative, it is used as the offset
* from the end of `array`. If `array` is sorted providing `true` for `fromIndex`
* performs a faster binary search.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to search.
* @param {*} value The value to search for.
* @param {boolean|number} [fromIndex=0] The index to search from or `true`
* to perform a binary search on a sorted array.
* @returns {number} Returns the index of the matched value, else `-1`.
* @example
*
* _.indexOf([1, 2, 1, 2], 2);
* // => 1
*
* // using `fromIndex`
* _.indexOf([1, 2, 1, 2], 2, 2);
* // => 3
*
* // performing a binary search
* _.indexOf([1, 1, 2, 2], 2, true);
* // => 2
*/
function indexOf(array, value, fromIndex) {
var length = array ? array.length : 0;
if (!length) {
return -1;
}
if (typeof fromIndex == 'number') {
fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : fromIndex;
} else if (fromIndex) {
var index = binaryIndex(array, value),
other = array[index];
if (value === value ? (value === other) : (other !== other)) {
return index;
}
return -1;
}
return baseIndexOf(array, value, fromIndex || 0);
}
/**
* Gets all but the last element of `array`.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to query.
* @returns {Array} Returns the slice of `array`.
* @example
*
* _.initial([1, 2, 3]);
* // => [1, 2]
*/
function initial(array) {
return dropRight(array, 1);
}
/**
* Creates an array of unique values that are included in all of the provided
* arrays using [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
* for equality comparisons.
*
* @static
* @memberOf _
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
* @returns {Array} Returns the new array of shared values.
* @example
* _.intersection([1, 2], [4, 2], [2, 1]);
* // => [2]
*/
var intersection = restParam(function(arrays) {
var othLength = arrays.length,
othIndex = othLength,
caches = Array(length),
indexOf = getIndexOf(),
isCommon = indexOf == baseIndexOf,
result = [];
while (othIndex--) {
var value = arrays[othIndex] = isArrayLike(value = arrays[othIndex]) ? value : [];
caches[othIndex] = (isCommon && value.length >= 120) ? createCache(othIndex && value) : null;
}
var array = arrays[0],
index = -1,
length = array ? array.length : 0,
seen = caches[0];
outer:
while (++index < length) {
value = array[index];
if ((seen ? cacheIndexOf(seen, value) : indexOf(result, value, 0)) < 0) {
var othIndex = othLength;
while (--othIndex) {
var cache = caches[othIndex];
if ((cache ? cacheIndexOf(cache, value) : indexOf(arrays[othIndex], value, 0)) < 0) {
continue outer;
}
}
if (seen) {
seen.push(value);
}
result.push(value);
}
}
return result;
});
/**
* Gets the last element of `array`.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to query.
* @returns {*} Returns the last element of `array`.
* @example
*
* _.last([1, 2, 3]);
* // => 3
*/
function last(array) {
var length = array ? array.length : 0;
return length ? array[length - 1] : undefined;
}
/**
* This method is like `_.indexOf` except that it iterates over elements of
* `array` from right to left.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to search.
* @param {*} value The value to search for.
* @param {boolean|number} [fromIndex=array.length-1] The index to search from
* or `true` to perform a binary search on a sorted array.
* @returns {number} Returns the index of the matched value, else `-1`.
* @example
*
* _.lastIndexOf([1, 2, 1, 2], 2);
* // => 3
*
* // using `fromIndex`
* _.lastIndexOf([1, 2, 1, 2], 2, 2);
* // => 1
*
* // performing a binary search
* _.lastIndexOf([1, 1, 2, 2], 2, true);
* // => 3
*/
function lastIndexOf(array, value, fromIndex) {
var length = array ? array.length : 0;
if (!length) {
return -1;
}
var index = length;
if (typeof fromIndex == 'number') {
index = (fromIndex < 0 ? nativeMax(length + fromIndex, 0) : nativeMin(fromIndex || 0, length - 1)) + 1;
} else if (fromIndex) {
index = binaryIndex(array, value, true) - 1;
var other = array[index];
if (value === value ? (value === other) : (other !== other)) {
return index;
}
return -1;
}
if (value !== value) {
return indexOfNaN(array, index, true);
}
while (index--) {
if (array[index] === value) {
return index;
}
}
return -1;
}
/**
* Removes all provided values from `array` using
* [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
* for equality comparisons.
*
* **Note:** Unlike `_.without`, this method mutates `array`.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to modify.
* @param {...*} [values] The values to remove.
* @returns {Array} Returns `array`.
* @example
*
* var array = [1, 2, 3, 1, 2, 3];
*
* _.pull(array, 2, 3);
* console.log(array);
* // => [1, 1]
*/
function pull() {
var args = arguments,
array = args[0];
if (!(array && array.length)) {
return array;
}
var index = 0,
indexOf = getIndexOf(),
length = args.length;
while (++index < length) {
var fromIndex = 0,
value = args[index];
while ((fromIndex = indexOf(array, value, fromIndex)) > -1) {
splice.call(array, fromIndex, 1);
}
}
return array;
}
/**
* Removes elements from `array` corresponding to the given indexes and returns
* an array of the removed elements. Indexes may be specified as an array of
* indexes or as individual arguments.
*
* **Note:** Unlike `_.at`, this method mutates `array`.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to modify.
* @param {...(number|number[])} [indexes] The indexes of elements to remove,
* specified as individual indexes or arrays of indexes.
* @returns {Array} Returns the new array of removed elements.
* @example
*
* var array = [5, 10, 15, 20];
* var evens = _.pullAt(array, 1, 3);
*
* console.log(array);
* // => [5, 15]
*
* console.log(evens);
* // => [10, 20]
*/
var pullAt = restParam(function(array, indexes) {
indexes = baseFlatten(indexes);
var result = baseAt(array, indexes);
basePullAt(array, indexes.sort(baseCompareAscending));
return result;
});
/**
* Removes all elements from `array` that `predicate` returns truthy for
* and returns an array of the removed elements. The predicate is bound to
* `thisArg` and invoked with three arguments: (value, index, array).
*
* If a property name is provided for `predicate` the created `_.property`
* style callback returns the property value of the given element.
*
* If a value is also provided for `thisArg` the created `_.matchesProperty`
* style callback returns `true` for elements that have a matching property
* value, else `false`.
*
* If an object is provided for `predicate` the created `_.matches` style
* callback returns `true` for elements that have the properties of the given
* object, else `false`.
*
* **Note:** Unlike `_.filter`, this method mutates `array`.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to modify.
* @param {Function|Object|string} [predicate=_.identity] The function invoked
* per iteration.
* @param {*} [thisArg] The `this` binding of `predicate`.
* @returns {Array} Returns the new array of removed elements.
* @example
*
* var array = [1, 2, 3, 4];
* var evens = _.remove(array, function(n) {
* return n % 2 == 0;
* });
*
* console.log(array);
* // => [1, 3]
*
* console.log(evens);
* // => [2, 4]
*/
function remove(array, predicate, thisArg) {
var result = [];
if (!(array && array.length)) {
return result;
}
var index = -1,
indexes = [],
length = array.length;
predicate = getCallback(predicate, thisArg, 3);
while (++index < length) {
var value = array[index];
if (predicate(value, index, array)) {
result.push(value);
indexes.push(index);
}
}
basePullAt(array, indexes);
return result;
}
/**
* Gets all but the first element of `array`.
*
* @static
* @memberOf _
* @alias tail
* @category Array
* @param {Array} array The array to query.
* @returns {Array} Returns the slice of `array`.
* @example
*
* _.rest([1, 2, 3]);
* // => [2, 3]
*/
function rest(array) {
return drop(array, 1);
}
/**
* Creates a slice of `array` from `start` up to, but not including, `end`.
*
* **Note:** This method is used instead of `Array#slice` to support node
* lists in IE < 9 and to ensure dense arrays are returned.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to slice.
* @param {number} [start=0] The start position.
* @param {number} [end=array.length] The end position.
* @returns {Array} Returns the slice of `array`.
*/
function slice(array, start, end) {
var length = array ? array.length : 0;
if (!length) {
return [];
}
if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
start = 0;
end = length;
}
return baseSlice(array, start, end);
}
/**
* Uses a binary search to determine the lowest index at which `value` should
* be inserted into `array` in order to maintain its sort order. If an iteratee
* function is provided it is invoked for `value` and each element of `array`
* to compute their sort ranking. The iteratee is bound to `thisArg` and
* invoked with one argument; (value).
*
* If a property name is provided for `iteratee` the created `_.property`
* style callback returns the property value of the given element.
*
* If a value is also provided for `thisArg` the created `_.matchesProperty`
* style callback returns `true` for elements that have a matching property
* value, else `false`.
*
* If an object is provided for `iteratee` the created `_.matches` style
* callback returns `true` for elements that have the properties of the given
* object, else `false`.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The sorted array to inspect.
* @param {*} value The value to evaluate.
* @param {Function|Object|string} [iteratee=_.identity] The function invoked
* per iteration.
* @param {*} [thisArg] The `this` binding of `iteratee`.
* @returns {number} Returns the index at which `value` should be inserted
* into `array`.
* @example
*
* _.sortedIndex([30, 50], 40);
* // => 1
*
* _.sortedIndex([4, 4, 5, 5], 5);
* // => 2
*
* var dict = { 'data': { 'thirty': 30, 'forty': 40, 'fifty': 50 } };
*
* // using an iteratee function
* _.sortedIndex(['thirty', 'fifty'], 'forty', function(word) {
* return this.data[word];
* }, dict);
* // => 1
*
* // using the `_.property` callback shorthand
* _.sortedIndex([{ 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x');
* // => 1
*/
var sortedIndex = createSortedIndex();
/**
* This method is like `_.sortedIndex` except that it returns the highest
* index at which `value` should be inserted into `array` in order to
* maintain its sort order.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The sorted array to inspect.
* @param {*} value The value to evaluate.
* @param {Function|Object|string} [iteratee=_.identity] The function invoked
* per iteration.
* @param {*} [thisArg] The `this` binding of `iteratee`.
* @returns {number} Returns the index at which `value` should be inserted
* into `array`.
* @example
*
* _.sortedLastIndex([4, 4, 5, 5], 5);
* // => 4
*/
var sortedLastIndex = createSortedIndex(true);
/**
* Creates a slice of `array` with `n` elements taken from the beginning.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to query.
* @param {number} [n=1] The number of elements to take.
* @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
* @returns {Array} Returns the slice of `array`.
* @example
*
* _.take([1, 2, 3]);
* // => [1]
*
* _.take([1, 2, 3], 2);
* // => [1, 2]
*
* _.take([1, 2, 3], 5);
* // => [1, 2, 3]
*
* _.take([1, 2, 3], 0);
* // => []
*/
function take(array, n, guard) {
var length = array ? array.length : 0;
if (!length) {
return [];
}
if (guard ? isIterateeCall(array, n, guard) : n == null) {
n = 1;
}
return baseSlice(array, 0, n < 0 ? 0 : n);
}
/**
* Creates a slice of `array` with `n` elements taken from the end.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to query.
* @param {number} [n=1] The number of elements to take.
* @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
* @returns {Array} Returns the slice of `array`.
* @example
*
* _.takeRight([1, 2, 3]);
* // => [3]
*
* _.takeRight([1, 2, 3], 2);
* // => [2, 3]
*
* _.takeRight([1, 2, 3], 5);
* // => [1, 2, 3]
*
* _.takeRight([1, 2, 3], 0);
* // => []
*/
function takeRight(array, n, guard) {
var length = array ? array.length : 0;
if (!length) {
return [];
}
if (guard ? isIterateeCall(array, n, guard) : n == null) {
n = 1;
}
n = length - (+n || 0);
return baseSlice(array, n < 0 ? 0 : n);
}
/**
* Creates a slice of `array` with elements taken from the end. Elements are
* taken until `predicate` returns falsey. The predicate is bound to `thisArg`
* and invoked with three arguments: (value, index, array).
*
* If a property name is provided for `predicate` the created `_.property`
* style callback returns the property value of the given element.
*
* If a value is also provided for `thisArg` the created `_.matchesProperty`
* style callback returns `true` for elements that have a matching property
* value, else `false`.
*
* If an object is provided for `predicate` the created `_.matches` style
* callback returns `true` for elements that have the properties of the given
* object, else `false`.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to query.
* @param {Function|Object|string} [predicate=_.identity] The function invoked
* per iteration.
* @param {*} [thisArg] The `this` binding of `predicate`.
* @returns {Array} Returns the slice of `array`.
* @example
*
* _.takeRightWhile([1, 2, 3], function(n) {
* return n > 1;
* });
* // => [2, 3]
*
* var users = [
* { 'user': 'barney', 'active': true },
* { 'user': 'fred', 'active': false },
* { 'user': 'pebbles', 'active': false }
* ];
*
* // using the `_.matches` callback shorthand
* _.pluck(_.takeRightWhile(users, { 'user': 'pebbles', 'active': false }), 'user');
* // => ['pebbles']
*
* // using the `_.matchesProperty` callback shorthand
* _.pluck(_.takeRightWhile(users, 'active', false), 'user');
* // => ['fred', 'pebbles']
*
* // using the `_.property` callback shorthand
* _.pluck(_.takeRightWhile(users, 'active'), 'user');
* // => []
*/
function takeRightWhile(array, predicate, thisArg) {
return (array && array.length)
? baseWhile(array, getCallback(predicate, thisArg, 3), false, true)
: [];
}
/**
* Creates a slice of `array` with elements taken from the beginning. Elements
* are taken until `predicate` returns falsey. The predicate is bound to
* `thisArg` and invoked with three arguments: (value, index, array).
*
* If a property name is provided for `predicate` the created `_.property`
* style callback returns the property value of the given element.
*
* If a value is also provided for `thisArg` the created `_.matchesProperty`
* style callback returns `true` for elements that have a matching property
* value, else `false`.
*
* If an object is provided for `predicate` the created `_.matches` style
* callback returns `true` for elements that have the properties of the given
* object, else `false`.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to query.
* @param {Function|Object|string} [predicate=_.identity] The function invoked
* per iteration.
* @param {*} [thisArg] The `this` binding of `predicate`.
* @returns {Array} Returns the slice of `array`.
* @example
*
* _.takeWhile([1, 2, 3], function(n) {
* return n < 3;
* });
* // => [1, 2]
*
* var users = [
* { 'user': 'barney', 'active': false },
* { 'user': 'fred', 'active': false},
* { 'user': 'pebbles', 'active': true }
* ];
*
* // using the `_.matches` callback shorthand
* _.pluck(_.takeWhile(users, { 'user': 'barney', 'active': false }), 'user');
* // => ['barney']
*
* // using the `_.matchesProperty` callback shorthand
* _.pluck(_.takeWhile(users, 'active', false), 'user');
* // => ['barney', 'fred']
*
* // using the `_.property` callback shorthand
* _.pluck(_.takeWhile(users, 'active'), 'user');
* // => []
*/
function takeWhile(array, predicate, thisArg) {
return (array && array.length)
? baseWhile(array, getCallback(predicate, thisArg, 3))
: [];
}
/**
* Creates an array of unique values, in order, from all of the provided arrays
* using [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
* for equality comparisons.
*
* @static
* @memberOf _
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
* @returns {Array} Returns the new array of combined values.
* @example
*
* _.union([1, 2], [4, 2], [2, 1]);
* // => [1, 2, 4]
*/
var union = restParam(function(arrays) {
return baseUniq(baseFlatten(arrays, false, true));
});
/**
* Creates a duplicate-free version of an array, using
* [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
* for equality comparisons, in which only the first occurence of each element
* is kept. Providing `true` for `isSorted` performs a faster search algorithm
* for sorted arrays. If an iteratee function is provided it is invoked for
* each element in the array to generate the criterion by which uniqueness
* is computed. The `iteratee` is bound to `thisArg` and invoked with three
* arguments: (value, index, array).
*
* If a property name is provided for `iteratee` the created `_.property`
* style callback returns the property value of the given element.
*
* If a value is also provided for `thisArg` the created `_.matchesProperty`
* style callback returns `true` for elements that have a matching property
* value, else `false`.
*
* If an object is provided for `iteratee` the created `_.matches` style
* callback returns `true` for elements that have the properties of the given
* object, else `false`.
*
* @static
* @memberOf _
* @alias unique
* @category Array
* @param {Array} array The array to inspect.
* @param {boolean} [isSorted] Specify the array is sorted.
* @param {Function|Object|string} [iteratee] The function invoked per iteration.
* @param {*} [thisArg] The `this` binding of `iteratee`.
* @returns {Array} Returns the new duplicate-value-free array.
* @example
*
* _.uniq([2, 1, 2]);
* // => [2, 1]
*
* // using `isSorted`
* _.uniq([1, 1, 2], true);
* // => [1, 2]
*
* // using an iteratee function
* _.uniq([1, 2.5, 1.5, 2], function(n) {
* return this.floor(n);
* }, Math);
* // => [1, 2.5]
*
* // using the `_.property` callback shorthand
* _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
* // => [{ 'x': 1 }, { 'x': 2 }]
*/
function uniq(array, isSorted, iteratee, thisArg) {
var length = array ? array.length : 0;
if (!length) {
return [];
}
if (isSorted != null && typeof isSorted != 'boolean') {
thisArg = iteratee;
iteratee = isIterateeCall(array, isSorted, thisArg) ? null : isSorted;
isSorted = false;
}
var callback = getCallback();
if (!(iteratee == null && callback === baseCallback)) {
iteratee = callback(iteratee, thisArg, 3);
}
return (isSorted && getIndexOf() == baseIndexOf)
? sortedUniq(array, iteratee)
: baseUniq(array, iteratee);
}
/**
* This method is like `_.zip` except that it accepts an array of grouped
* elements and creates an array regrouping the elements to their pre-zip
* configuration.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array of grouped elements to process.
* @returns {Array} Returns the new array of regrouped elements.
* @example
*
* var zipped = _.zip(['fred', 'barney'], [30, 40], [true, false]);
* // => [['fred', 30, true], ['barney', 40, false]]
*
* _.unzip(zipped);
* // => [['fred', 'barney'], [30, 40], [true, false]]
*/
function unzip(array) {
if (!(array && array.length)) {
return [];
}
var index = -1,
length = 0;
array = arrayFilter(array, function(group) {
if (isArrayLike(group)) {
length = nativeMax(group.length, length);
return true;
}
});
var result = Array(length);
while (++index < length) {
result[index] = arrayMap(array, baseProperty(index));
}
return result;
}
/**
* This method is like `_.unzip` except that it accepts an iteratee to specify
* how regrouped values should be combined. The `iteratee` is bound to `thisArg`
* and invoked with four arguments: (accumulator, value, index, group).
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array of grouped elements to process.
* @param {Function} [iteratee] The function to combine regrouped values.
* @param {*} [thisArg] The `this` binding of `iteratee`.
* @returns {Array} Returns the new array of regrouped elements.
* @example
*
* var zipped = _.zip([1, 2], [10, 20], [100, 200]);
* // => [[1, 10, 100], [2, 20, 200]]
*
* _.unzipWith(zipped, _.add);
* // => [3, 30, 300]
*/
function unzipWith(array, iteratee, thisArg) {
var length = array ? array.length : 0;
if (!length) {
return [];
}
var result = unzip(array);
if (iteratee == null) {
return result;
}
iteratee = bindCallback(iteratee, thisArg, 4);
return arrayMap(result, function(group) {
return arrayReduce(group, iteratee, undefined, true);
});
}
/**
* Creates an array excluding all provided values using
* [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
* for equality comparisons.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to filter.
* @param {...*} [values] The values to exclude.
* @returns {Array} Returns the new array of filtered values.
* @example
*
* _.without([1, 2, 1, 3], 1, 2);
* // => [3]
*/
var without = restParam(function(array, values) {
return isArrayLike(array)
? baseDifference(array, values)
: [];
});
/**
* Creates an array of unique values that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
* of the provided arrays.
*
* @static
* @memberOf _
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
* @returns {Array} Returns the new array of values.
* @example
*
* _.xor([1, 2], [4, 2]);
* // => [1, 4]
*/
function xor() {
var index = -1,
length = arguments.length;
while (++index < length) {
var array = arguments[index];
if (isArrayLike(array)) {
var result = result
? baseDifference(result, array).concat(baseDifference(array, result))
: array;
}
}
return result ? baseUniq(result) : [];
}
/**
* Creates an array of grouped elements, the first of which contains the first
* elements of the given arrays, the second of which contains the second elements
* of the given arrays, and so on.
*
* @static
* @memberOf _
* @category Array
* @param {...Array} [arrays] The arrays to process.
* @returns {Array} Returns the new array of grouped elements.
* @example
*
* _.zip(['fred', 'barney'], [30, 40], [true, false]);
* // => [['fred', 30, true], ['barney', 40, false]]
*/
var zip = restParam(unzip);
/**
* The inverse of `_.pairs`; this method returns an object composed from arrays
* of property names and values. Provide either a single two dimensional array,
* e.g. `[[key1, value1], [key2, value2]]` or two arrays, one of property names
* and one of corresponding values.
*
* @static
* @memberOf _
* @alias object
* @category Array
* @param {Array} props The property names.
* @param {Array} [values=[]] The property values.
* @returns {Object} Returns the new object.
* @example
*
* _.zipObject([['fred', 30], ['barney', 40]]);
* // => { 'fred': 30, 'barney': 40 }
*
* _.zipObject(['fred', 'barney'], [30, 40]);
* // => { 'fred': 30, 'barney': 40 }
*/
function zipObject(props, values) {
var index = -1,
length = props ? props.length : 0,
result = {};
if (length && !values && !isArray(props[0])) {
values = [];
}
while (++index < length) {
var key = props[index];
if (values) {
result[key] = values[index];
} else if (key) {
result[key[0]] = key[1];
}
}
return result;
}
/**
* This method is like `_.zip` except that it accepts an iteratee to specify
* how grouped values should be combined. The `iteratee` is bound to `thisArg`
* and invoked with four arguments: (accumulator, value, index, group).
*
* @static
* @memberOf _
* @category Array
* @param {...Array} [arrays] The arrays to process.
* @param {Function} [iteratee] The function to combine grouped values.
* @param {*} [thisArg] The `this` binding of `iteratee`.
* @returns {Array} Returns the new array of grouped elements.
* @example
*
* _.zipWith([1, 2], [10, 20], [100, 200], _.add);
* // => [111, 222]
*/
var zipWith = restParam(function(arrays) {
var length = arrays.length,
iteratee = length > 2 ? arrays[length - 2] : undefined,
thisArg = length > 1 ? arrays[length - 1] : undefined;
if (length > 2 && typeof iteratee == 'function') {
length -= 2;
} else {
iteratee = (length > 1 && typeof thisArg == 'function') ? (--length, thisArg) : undefined;
thisArg = undefined;
}
arrays.length = length;
return unzipWith(arrays, iteratee, thisArg);
});
/*------------------------------------------------------------------------*/
/**
* Creates a `lodash` object that wraps `value` with explicit method
* chaining enabled.
*
* @static
* @memberOf _
* @category Chain
* @param {*} value The value to wrap.
* @returns {Object} Returns the new `lodash` wrapper instance.
* @example
*
* var users = [
* { 'user': 'barney', 'age': 36 },
* { 'user': 'fred', 'age': 40 },
* { 'user': 'pebbles', 'age': 1 }
* ];
*
* var youngest = _.chain(users)
* .sortBy('age')
* .map(function(chr) {
* return chr.user + ' is ' + chr.age;
* })
* .first()
* .value();
* // => 'pebbles is 1'
*/
function chain(value) {
var result = lodash(value);
result.__chain__ = true;
return result;
}
/**
* This method invokes `interceptor` and returns `value`. The interceptor is
* bound to `thisArg` and invoked with one argument; (value). The purpose of
* this method is to "tap into" a method chain in order to perform operations
* on intermediate results within the chain.
*
* @static
* @memberOf _
* @category Chain
* @param {*} value The value to provide to `interceptor`.
* @param {Function} interceptor The function to invoke.
* @param {*} [thisArg] The `this` binding of `interceptor`.
* @returns {*} Returns `value`.
* @example
*
* _([1, 2, 3])
* .tap(function(array) {
* array.pop();
* })
* .reverse()
* .value();
* // => [2, 1]
*/
function tap(value, interceptor, thisArg) {
interceptor.call(thisArg, value);
return value;
}
/**
* This method is like `_.tap` except that it returns the result of `interceptor`.
*
* @static
* @memberOf _
* @category Chain
* @param {*} value The value to provide to `interceptor`.
* @param {Function} interceptor The function to invoke.
* @param {*} [thisArg] The `this` binding of `interceptor`.
* @returns {*} Returns the result of `interceptor`.
* @example
*
* _(' abc ')
* .chain()
* .trim()
* .thru(function(value) {
* return [value];
* })
* .value();
* // => ['abc']
*/
function thru(value, interceptor, thisArg) {
return interceptor.call(thisArg, value);
}
/**
* Enables explicit method chaining on the wrapper object.
*
* @name chain
* @memberOf _
* @category Chain
* @returns {Object} Returns the new `lodash` wrapper instance.
* @example
*
* var users = [
* { 'user': 'barney', 'age': 36 },
* { 'user': 'fred', 'age': 40 }
* ];
*
* // without explicit chaining
* _(users).first();
* // => { 'user': 'barney', 'age': 36 }
*
* // with explicit chaining
* _(users).chain()
* .first()
* .pick('user')
* .value();
* // => { 'user': 'barney' }
*/
function wrapperChain() {
return chain(this);
}
/**
* Executes the chained sequence and returns the wrapped result.
*
* @name commit
* @memberOf _
* @category Chain
* @returns {Object} Returns the new `lodash` wrapper instance.
* @example
*
* var array = [1, 2];
* var wrapper = _(array).push(3);
*
* console.log(array);
* // => [1, 2]
*
* wrapper = wrapper.commit();
* console.log(array);
* // => [1, 2, 3]
*
* wrapper.last();
* // => 3
*
* console.log(array);
* // => [1, 2, 3]
*/
function wrapperCommit() {
return new LodashWrapper(this.value(), this.__chain__);
}
/**
* Creates a clone of the chained sequence planting `value` as the wrapped value.
*
* @name plant
* @memberOf _
* @category Chain
* @returns {Object} Returns the new `lodash` wrapper instance.
* @example
*
* var array = [1, 2];
* var wrapper = _(array).map(function(value) {
* return Math.pow(value, 2);
* });
*
* var other = [3, 4];
* var otherWrapper = wrapper.plant(other);
*
* otherWrapper.value();
* // => [9, 16]
*
* wrapper.value();
* // => [1, 4]
*/
function wrapperPlant(value) {
var result,
parent = this;
while (parent instanceof baseLodash) {
var clone = wrapperClone(parent);
if (result) {
previous.__wrapped__ = clone;
} else {
result = clone;
}
var previous = clone;
parent = parent.__wrapped__;
}
previous.__wrapped__ = value;
return result;
}
/**
* Reverses the wrapped array so the first element becomes the last, the
* second element becomes the second to last, and so on.
*
* **Note:** This method mutates the wrapped array.
*
* @name reverse
* @memberOf _
* @category Chain
* @returns {Object} Returns the new reversed `lodash` wrapper instance.
* @example
*
* var array = [1, 2, 3];
*
* _(array).reverse().value()
* // => [3, 2, 1]
*
* console.log(array);
* // => [3, 2, 1]
*/
function wrapperReverse() {
var value = this.__wrapped__;
if (value instanceof LazyWrapper) {
if (this.__actions__.length) {
value = new LazyWrapper(this);
}
return new LodashWrapper(value.reverse(), this.__chain__);
}
return this.thru(function(value) {
return value.reverse();
});
}
/**
* Produces the result of coercing the unwrapped value to a string.
*
* @name toString
* @memberOf _
* @category Chain
* @returns {string} Returns the coerced string value.
* @example
*
* _([1, 2, 3]).toString();
* // => '1,2,3'
*/
function wrapperToString() {
return (this.value() + '');
}
/**
* Executes the chained sequence to extract the unwrapped value.
*
* @name value
* @memberOf _
* @alias run, toJSON, valueOf
* @category Chain
* @returns {*} Returns the resolved unwrapped value.
* @example
*
* _([1, 2, 3]).value();
* // => [1, 2, 3]
*/
function wrapperValue() {
return baseWrapperValue(this.__wrapped__, this.__actions__);
}
/*------------------------------------------------------------------------*/
/**
* Creates an array of elements corresponding to the given keys, or indexes,
* of `collection`. Keys may be specified as individual arguments or as arrays
* of keys.
*
* @static
* @memberOf _
* @category Collection
* @param {Array|Object|string} collection The collection to iterate over.
* @param {...(number|number[]|string|string[])} [props] The property names
* or indexes of elements to pick, specified individually or in arrays.
* @returns {Array} Returns the new array of picked elements.
* @example
*
* _.at(['a', 'b', 'c'], [0, 2]);
* // => ['a', 'c']
*
* _.at(['barney', 'fred', 'pebbles'], 0, 2);
* // => ['barney', 'pebbles']
*/
var at = restParam(function(collection, props) {
return baseAt(collection, baseFlatten(props));
});
/**
* Creates an object composed of keys generated from the results of running
* each element of `collection` through `iteratee`. The corresponding value
* of each key is the number of times the key was returned by `iteratee`.
* The `iteratee` is bound to `thisArg` and invoked with three arguments:
* (value, index|key, collection).
*
* If a property name is provided for `iteratee` the created `_.property`
* style callback returns the property value of the given element.
*
* If a value is also provided for `thisArg` the created `_.matchesProperty`
* style callback returns `true` for elements that have a matching property
* value, else `false`.
*
* If an object is provided for `iteratee` the created `_.matches` style
* callback returns `true` for elements that have the properties of the given
* object, else `false`.
*
* @static
* @memberOf _
* @category Collection
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function|Object|string} [iteratee=_.identity] The function invoked
* per iteration.
* @param {*} [thisArg] The `this` binding of `iteratee`.
* @returns {Object} Returns the composed aggregate object.
* @example
*
* _.countBy([4.3, 6.1, 6.4], function(n) {
* return Math.floor(n);
* });
* // => { '4': 1, '6': 2 }
*
* _.countBy([4.3, 6.1, 6.4], function(n) {
* return this.floor(n);
* }, Math);
* // => { '4': 1, '6': 2 }
*
* _.countBy(['one', 'two', 'three'], 'length');
* // => { '3': 2, '5': 1 }
*/
var countBy = createAggregator(function(result, value, key) {
hasOwnProperty.call(result, key) ? ++result[key] : (result[key] = 1);
});
/**
* Checks if `predicate` returns truthy for **all** elements of `collection`.
* The predicate is bound to `thisArg` and invoked with three arguments:
* (value, index|key, collection).
*
* If a property name is provided for `predicate` the created `_.property`
* style callback returns the property value of the given element.
*
* If a value is also provided for `thisArg` the created `_.matchesProperty`
* style callback returns `true` for elements that have a matching property
* value, else `false`.
*
* If an object is provided for `predicate` the created `_.matches` style
* callback returns `true` for elements that have the properties of the given
* object, else `false`.
*
* @static
* @memberOf _
* @alias all
* @category Collection
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function|Object|string} [predicate=_.identity] The function invoked
* per iteration.
* @param {*} [thisArg] The `this` binding of `predicate`.
* @returns {boolean} Returns `true` if all elements pass the predicate check,
* else `false`.
* @example
*
* _.every([true, 1, null, 'yes'], Boolean);
* // => false
*
* var users = [
* { 'user': 'barney', 'active': false },
* { 'user': 'fred', 'active': false }
* ];
*
* // using the `_.matches` callback shorthand
* _.every(users, { 'user': 'barney', 'active': false });
* // => false
*
* // using the `_.matchesProperty` callback shorthand
* _.every(users, 'active', false);
* // => true
*
* // using the `_.property` callback shorthand
* _.every(users, 'active');
* // => false
*/
function every(collection, predicate, thisArg) {
var func = isArray(collection) ? arrayEvery : baseEvery;
if (thisArg && isIterateeCall(collection, predicate, thisArg)) {
predicate = null;
}
if (typeof predicate != 'function' || thisArg !== undefined) {
predicate = getCallback(predicate, thisArg, 3);
}
return func(collection, predicate);
}
/**
* Iterates over elements of `collection`, returning an array of all elements
* `predicate` returns truthy for. The predicate is bound to `thisArg` and
* invoked with three arguments: (value, index|key, collection).
*
* If a property name is provided for `predicate` the created `_.property`
* style callback returns the property value of the given element.
*
* If a value is also provided for `thisArg` the created `_.matchesProperty`
* style callback returns `true` for elements that have a matching property
* value, else `false`.
*
* If an object is provided for `predicate` the created `_.matches` style
* callback returns `true` for elements that have the properties of the given
* object, else `false`.
*
* @static
* @memberOf _
* @alias select
* @category Collection
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function|Object|string} [predicate=_.identity] The function invoked
* per iteration.
* @param {*} [thisArg] The `this` binding of `predicate`.
* @returns {Array} Returns the new filtered array.
* @example
*
* _.filter([4, 5, 6], function(n) {
* return n % 2 == 0;
* });
* // => [4, 6]
*
* var users = [
* { 'user': 'barney', 'age': 36, 'active': true },
* { 'user': 'fred', 'age': 40, 'active': false }
* ];
*
* // using the `_.matches` callback shorthand
* _.pluck(_.filter(users, { 'age': 36, 'active': true }), 'user');
* // => ['barney']
*
* // using the `_.matchesProperty` callback shorthand
* _.pluck(_.filter(users, 'active', false), 'user');
* // => ['fred']
*
* // using the `_.property` callback shorthand
* _.pluck(_.filter(users, 'active'), 'user');
* // => ['barney']
*/
function filter(collection, predicate, thisArg) {
var func = isArray(collection) ? arrayFilter : baseFilter;
predicate = getCallback(predicate, thisArg, 3);
return func(collection, predicate);
}
/**
* Iterates over elements of `collection`, returning the first element
* `predicate` returns truthy for. The predicate is bound to `thisArg` and
* invoked with three arguments: (value, index|key, collection).
*
* If a property name is provided for `predicate` the created `_.property`
* style callback returns the property value of the given element.
*
* If a value is also provided for `thisArg` the created `_.matchesProperty`
* style callback returns `true` for elements that have a matching property
* value, else `false`.
*
* If an object is provided for `predicate` the created `_.matches` style
* callback returns `true` for elements that have the properties of the given
* object, else `false`.
*
* @static
* @memberOf _
* @alias detect
* @category Collection
* @param {Array|Object|string} collection The collection to search.
* @param {Function|Object|string} [predicate=_.identity] The function invoked
* per iteration.
* @param {*} [thisArg] The `this` binding of `predicate`.
* @returns {*} Returns the matched element, else `undefined`.
* @example
*
* var users = [
* { 'user': 'barney', 'age': 36, 'active': true },
* { 'user': 'fred', 'age': 40, 'active': false },
* { 'user': 'pebbles', 'age': 1, 'active': true }
* ];
*
* _.result(_.find(users, function(chr) {
* return chr.age < 40;
* }), 'user');
* // => 'barney'
*
* // using the `_.matches` callback shorthand
* _.result(_.find(users, { 'age': 1, 'active': true }), 'user');
* // => 'pebbles'
*
* // using the `_.matchesProperty` callback shorthand
* _.result(_.find(users, 'active', false), 'user');
* // => 'fred'
*
* // using the `_.property` callback shorthand
* _.result(_.find(users, 'active'), 'user');
* // => 'barney'
*/
var find = createFind(baseEach);
/**
* This method is like `_.find` except that it iterates over elements of
* `collection` from right to left.
*
* @static
* @memberOf _
* @category Collection
* @param {Array|Object|string} collection The collection to search.
* @param {Function|Object|string} [predicate=_.identity] The function invoked
* per iteration.
* @param {*} [thisArg] The `this` binding of `predicate`.
* @returns {*} Returns the matched element, else `undefined`.
* @example
*
* _.findLast([1, 2, 3, 4], function(n) {
* return n % 2 == 1;
* });
* // => 3
*/
var findLast = createFind(baseEachRight, true);
/**
* Performs a deep comparison between each element in `collection` and the
* source object, returning the first element that has equivalent property
* values.
*
* **Note:** This method supports comparing arrays, booleans, `Date` objects,
* numbers, `Object` objects, regexes, and strings. Objects are compared by
* their own, not inherited, enumerable properties. For comparing a single
* own or inherited property value see `_.matchesProperty`.
*
* @static
* @memberOf _
* @category Collection
* @param {Array|Object|string} collection The collection to search.
* @param {Object} source The object of property values to match.
* @returns {*} Returns the matched element, else `undefined`.
* @example
*
* var users = [
* { 'user': 'barney', 'age': 36, 'active': true },
* { 'user': 'fred', 'age': 40, 'active': false }
* ];
*
* _.result(_.findWhere(users, { 'age': 36, 'active': true }), 'user');
* // => 'barney'
*
* _.result(_.findWhere(users, { 'age': 40, 'active': false }), 'user');
* // => 'fred'
*/
function findWhere(collection, source) {
return find(collection, baseMatches(source));
}
/**
* Iterates over elements of `collection` invoking `iteratee` for each element.
* The `iteratee` is bound to `thisArg` and invoked with three arguments:
* (value, index|key, collection). Iteratee functions may exit iteration early
* by explicitly returning `false`.
*
* **Note:** As with other "Collections" methods, objects with a "length" property
* are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn`
* may be used for object iteration.
*
* @static
* @memberOf _
* @alias each
* @category Collection
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @param {*} [thisArg] The `this` binding of `iteratee`.
* @returns {Array|Object|string} Returns `collection`.
* @example
*
* _([1, 2]).forEach(function(n) {
* console.log(n);
* }).value();
* // => logs each value from left to right and returns the array
*
* _.forEach({ 'a': 1, 'b': 2 }, function(n, key) {
* console.log(n, key);
* });
* // => logs each value-key pair and returns the object (iteration order is not guaranteed)
*/
var forEach = createForEach(arrayEach, baseEach);
/**
* This method is like `_.forEach` except that it iterates over elements of
* `collection` from right to left.
*
* @static
* @memberOf _
* @alias eachRight
* @category Collection
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @param {*} [thisArg] The `this` binding of `iteratee`.
* @returns {Array|Object|string} Returns `collection`.
* @example
*
* _([1, 2]).forEachRight(function(n) {
* console.log(n);
* }).value();
* // => logs each value from right to left and returns the array
*/
var forEachRight = createForEach(arrayEachRight, baseEachRight);
/**
* Creates an object composed of keys generated from the results of running
* each element of `collection` through `iteratee`. The corresponding value
* of each key is an array of the elements responsible for generating the key.
* The `iteratee` is bound to `thisArg` and invoked with three arguments:
* (value, index|key, collection).
*
* If a property name is provided for `iteratee` the created `_.property`
* style callback returns the property value of the given element.
*
* If a value is also provided for `thisArg` the created `_.matchesProperty`
* style callback returns `true` for elements that have a matching property
* value, else `false`.
*
* If an object is provided for `iteratee` the created `_.matches` style
* callback returns `true` for elements that have the properties of the given
* object, else `false`.
*
* @static
* @memberOf _
* @category Collection
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function|Object|string} [iteratee=_.identity] The function invoked
* per iteration.
* @param {*} [thisArg] The `this` binding of `iteratee`.
* @returns {Object} Returns the composed aggregate object.
* @example
*
* _.groupBy([4.2, 6.1, 6.4], function(n) {
* return Math.floor(n);
* });
* // => { '4': [4.2], '6': [6.1, 6.4] }
*
* _.groupBy([4.2, 6.1, 6.4], function(n) {
* return this.floor(n);
* }, Math);
* // => { '4': [4.2], '6': [6.1, 6.4] }
*
* // using the `_.property` callback shorthand
* _.groupBy(['one', 'two', 'three'], 'length');
* // => { '3': ['one', 'two'], '5': ['three'] }
*/
var groupBy = createAggregator(function(result, value, key) {
if (hasOwnProperty.call(result, key)) {
result[key].push(value);
} else {
result[key] = [value];
}
});
/**
* Checks if `value` is in `collection` using
* [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
* for equality comparisons. If `fromIndex` is negative, it is used as the offset
* from the end of `collection`.
*
* @static
* @memberOf _
* @alias contains, include
* @category Collection
* @param {Array|Object|string} collection The collection to search.
* @param {*} target The value to search for.
* @param {number} [fromIndex=0] The index to search from.
* @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`.
* @returns {boolean} Returns `true` if a matching element is found, else `false`.
* @example
*
* _.includes([1, 2, 3], 1);
* // => true
*
* _.includes([1, 2, 3], 1, 2);
* // => false
*
* _.includes({ 'user': 'fred', 'age': 40 }, 'fred');
* // => true
*
* _.includes('pebbles', 'eb');
* // => true
*/
function includes(collection, target, fromIndex, guard) {
var length = collection ? getLength(collection) : 0;
if (!isLength(length)) {
collection = values(collection);
length = collection.length;
}
if (!length) {
return false;
}
if (typeof fromIndex != 'number' || (guard && isIterateeCall(target, fromIndex, guard))) {
fromIndex = 0;
} else {
fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0);
}
return (typeof collection == 'string' || !isArray(collection) && isString(collection))
? (fromIndex < length && collection.indexOf(target, fromIndex) > -1)
: (getIndexOf(collection, target, fromIndex) > -1);
}
/**
* Creates an object composed of keys generated from the results of running
* each element of `collection` through `iteratee`. The corresponding value
* of each key is the last element responsible for generating the key. The
* iteratee function is bound to `thisArg` and invoked with three arguments:
* (value, index|key, collection).
*
* If a property name is provided for `iteratee` the created `_.property`
* style callback returns the property value of the given element.
*
* If a value is also provided for `thisArg` the created `_.matchesProperty`
* style callback returns `true` for elements that have a matching property
* value, else `false`.
*
* If an object is provided for `iteratee` the created `_.matches` style
* callback returns `true` for elements that have the properties of the given
* object, else `false`.
*
* @static
* @memberOf _
* @category Collection
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function|Object|string} [iteratee=_.identity] The function invoked
* per iteration.
* @param {*} [thisArg] The `this` binding of `iteratee`.
* @returns {Object} Returns the composed aggregate object.
* @example
*
* var keyData = [
* { 'dir': 'left', 'code': 97 },
* { 'dir': 'right', 'code': 100 }
* ];
*
* _.indexBy(keyData, 'dir');
* // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
*
* _.indexBy(keyData, function(object) {
* return String.fromCharCode(object.code);
* });
* // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
*
* _.indexBy(keyData, function(object) {
* return this.fromCharCode(object.code);
* }, String);
* // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
*/
var indexBy = createAggregator(function(result, value, key) {
result[key] = value;
});
/**
* Invokes the method at `path` of each element in `collection`, returning
* an array of the results of each invoked method. Any additional arguments
* are provided to each invoked method. If `methodName` is a function it is
* invoked for, and `this` bound to, each element in `collection`.
*
* @static
* @memberOf _
* @category Collection
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Array|Function|string} path The path of the method to invoke or
* the function invoked per iteration.
* @param {...*} [args] The arguments to invoke the method with.
* @returns {Array} Returns the array of results.
* @example
*
* _.invoke([[5, 1, 7], [3, 2, 1]], 'sort');
* // => [[1, 5, 7], [1, 2, 3]]
*
* _.invoke([123, 456], String.prototype.split, '');
* // => [['1', '2', '3'], ['4', '5', '6']]
*/
var invoke = restParam(function(collection, path, args) {
var index = -1,
isFunc = typeof path == 'function',
isProp = isKey(path),
result = isArrayLike(collection) ? Array(collection.length) : [];
baseEach(collection, function(value) {
var func = isFunc ? path : ((isProp && value != null) ? value[path] : null);
result[++index] = func ? func.apply(value, args) : invokePath(value, path, args);
});
return result;
});
/**
* Creates an array of values by running each element in `collection` through
* `iteratee`. The `iteratee` is bound to `thisArg` and invoked with three
* arguments: (value, index|key, collection).
*
* If a property name is provided for `iteratee` the created `_.property`
* style callback returns the property value of the given element.
*
* If a value is also provided for `thisArg` the created `_.matchesProperty`
* style callback returns `true` for elements that have a matching property
* value, else `false`.
*
* If an object is provided for `iteratee` the created `_.matches` style
* callback returns `true` for elements that have the properties of the given
* object, else `false`.
*
* Many lodash methods are guarded to work as iteratees for methods like
* `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
*
* The guarded methods are:
* `ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`,
* `drop`, `dropRight`, `every`, `fill`, `flatten`, `invert`, `max`, `min`,
* `parseInt`, `slice`, `sortBy`, `take`, `takeRight`, `template`, `trim`,
* `trimLeft`, `trimRight`, `trunc`, `random`, `range`, `sample`, `some`,
* `sum`, `uniq`, and `words`
*
* @static
* @memberOf _
* @alias collect
* @category Collection
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function|Object|string} [iteratee=_.identity] The function invoked
* per iteration.
* @param {*} [thisArg] The `this` binding of `iteratee`.
* @returns {Array} Returns the new mapped array.
* @example
*
* function timesThree(n) {
* return n * 3;
* }
*
* _.map([1, 2], timesThree);
* // => [3, 6]
*
* _.map({ 'a': 1, 'b': 2 }, timesThree);
* // => [3, 6] (iteration order is not guaranteed)
*
* var users = [
* { 'user': 'barney' },
* { 'user': 'fred' }
* ];
*
* // using the `_.property` callback shorthand
* _.map(users, 'user');
* // => ['barney', 'fred']
*/
function map(collection, iteratee, thisArg) {
var func = isArray(collection) ? arrayMap : baseMap;
iteratee = getCallback(iteratee, thisArg, 3);
return func(collection, iteratee);
}
/**
* Creates an array of elements split into two groups, the first of which
* contains elements `predicate` returns truthy for, while the second of which
* contains elements `predicate` returns falsey for. The predicate is bound
* to `thisArg` and invoked with three arguments: (value, index|key, collection).
*
* If a property name is provided for `predicate` the created `_.property`
* style callback returns the property value of the given element.
*
* If a value is also provided for `thisArg` the created `_.matchesProperty`
* style callback returns `true` for elements that have a matching property
* value, else `false`.
*
* If an object is provided for `predicate` the created `_.matches` style
* callback returns `true` for elements that have the properties of the given
* object, else `false`.
*
* @static
* @memberOf _
* @category Collection
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function|Object|string} [predicate=_.identity] The function invoked
* per iteration.
* @param {*} [thisArg] The `this` binding of `predicate`.
* @returns {Array} Returns the array of grouped elements.
* @example
*
* _.partition([1, 2, 3], function(n) {
* return n % 2;
* });
* // => [[1, 3], [2]]
*
* _.partition([1.2, 2.3, 3.4], function(n) {
* return this.floor(n) % 2;
* }, Math);
* // => [[1.2, 3.4], [2.3]]
*
* var users = [
* { 'user': 'barney', 'age': 36, 'active': false },
* { 'user': 'fred', 'age': 40, 'active': true },
* { 'user': 'pebbles', 'age': 1, 'active': false }
* ];
*
* var mapper = function(array) {
* return _.pluck(array, 'user');
* };
*
* // using the `_.matches` callback shorthand
* _.map(_.partition(users, { 'age': 1, 'active': false }), mapper);
* // => [['pebbles'], ['barney', 'fred']]
*
* // using the `_.matchesProperty` callback shorthand
* _.map(_.partition(users, 'active', false), mapper);
* // => [['barney', 'pebbles'], ['fred']]
*
* // using the `_.property` callback shorthand
* _.map(_.partition(users, 'active'), mapper);
* // => [['fred'], ['barney', 'pebbles']]
*/
var partition = createAggregator(function(result, value, key) {
result[key ? 0 : 1].push(value);
}, function() { return [[], []]; });
/**
* Gets the property value of `path` from all elements in `collection`.
*
* @static
* @memberOf _
* @category Collection
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Array|string} path The path of the property to pluck.
* @returns {Array} Returns the property values.
* @example
*
* var users = [
* { 'user': 'barney', 'age': 36 },
* { 'user': 'fred', 'age': 40 }
* ];
*
* _.pluck(users, 'user');
* // => ['barney', 'fred']
*
* var userIndex = _.indexBy(users, 'user');
* _.pluck(userIndex, 'age');
* // => [36, 40] (iteration order is not guaranteed)
*/
function pluck(collection, path) {
return map(collection, property(path));
}
/**
* Reduces `collection` to a value which is the accumulated result of running
* each element in `collection` through `iteratee`, where each successive
* invocation is supplied the return value of the previous. If `accumulator`
* is not provided the first element of `collection` is used as the initial
* value. The `iteratee` is bound to `thisArg` and invoked with four arguments:
* (accumulator, value, index|key, collection).
*
* Many lodash methods are guarded to work as iteratees for methods like
* `_.reduce`, `_.reduceRight`, and `_.transform`.
*
* The guarded methods are:
* `assign`, `defaults`, `includes`, `merge`, `sortByAll`, and `sortByOrder`
*
* @static
* @memberOf _
* @alias foldl, inject
* @category Collection
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @param {*} [accumulator] The initial value.
* @param {*} [thisArg] The `this` binding of `iteratee`.
* @returns {*} Returns the accumulated value.
* @example
*
* _.reduce([1, 2], function(total, n) {
* return total + n;
* });
* // => 3
*
* _.reduce({ 'a': 1, 'b': 2 }, function(result, n, key) {
* result[key] = n * 3;
* return result;
* }, {});
* // => { 'a': 3, 'b': 6 } (iteration order is not guaranteed)
*/
var reduce = createReduce(arrayReduce, baseEach);
/**
* This method is like `_.reduce` except that it iterates over elements of
* `collection` from right to left.
*
* @static
* @memberOf _
* @alias foldr
* @category Collection
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @param {*} [accumulator] The initial value.
* @param {*} [thisArg] The `this` binding of `iteratee`.
* @returns {*} Returns the accumulated value.
* @example
*
* var array = [[0, 1], [2, 3], [4, 5]];
*
* _.reduceRight(array, function(flattened, other) {
* return flattened.concat(other);
* }, []);
* // => [4, 5, 2, 3, 0, 1]
*/
var reduceRight = createReduce(arrayReduceRight, baseEachRight);
/**
* The opposite of `_.filter`; this method returns the elements of `collection`
* that `predicate` does **not** return truthy for.
*
* @static
* @memberOf _
* @category Collection
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function|Object|string} [predicate=_.identity] The function invoked
* per iteration.
* @param {*} [thisArg] The `this` binding of `predicate`.
* @returns {Array} Returns the new filtered array.
* @example
*
* _.reject([1, 2, 3, 4], function(n) {
* return n % 2 == 0;
* });
* // => [1, 3]
*
* var users = [
* { 'user': 'barney', 'age': 36, 'active': false },
* { 'user': 'fred', 'age': 40, 'active': true }
* ];
*
* // using the `_.matches` callback shorthand
* _.pluck(_.reject(users, { 'age': 40, 'active': true }), 'user');
* // => ['barney']
*
* // using the `_.matchesProperty` callback shorthand
* _.pluck(_.reject(users, 'active', false), 'user');
* // => ['fred']
*
* // using the `_.property` callback shorthand
* _.pluck(_.reject(users, 'active'), 'user');
* // => ['barney']
*/
function reject(collection, predicate, thisArg) {
var func = isArray(collection) ? arrayFilter : baseFilter;
predicate = getCallback(predicate, thisArg, 3);
return func(collection, function(value, index, collection) {
return !predicate(value, index, collection);
});
}
/**
* Gets a random element or `n` random elements from a collection.
*
* @static
* @memberOf _
* @category Collection
* @param {Array|Object|string} collection The collection to sample.
* @param {number} [n] The number of elements to sample.
* @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
* @returns {*} Returns the random sample(s).
* @example
*
* _.sample([1, 2, 3, 4]);
* // => 2
*
* _.sample([1, 2, 3, 4], 2);
* // => [3, 1]
*/
function sample(collection, n, guard) {
if (guard ? isIterateeCall(collection, n, guard) : n == null) {
collection = toIterable(collection);
var length = collection.length;
return length > 0 ? collection[baseRandom(0, length - 1)] : undefined;
}
var index = -1,
result = toArray(collection),
length = result.length,
lastIndex = length - 1;
n = nativeMin(n < 0 ? 0 : (+n || 0), length);
while (++index < n) {
var rand = baseRandom(index, lastIndex),
value = result[rand];
result[rand] = result[index];
result[index] = value;
}
result.length = n;
return result;
}
/**
* Creates an array of shuffled values, using a version of the
* [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
*
* @static
* @memberOf _
* @category Collection
* @param {Array|Object|string} collection The collection to shuffle.
* @returns {Array} Returns the new shuffled array.
* @example
*
* _.shuffle([1, 2, 3, 4]);
* // => [4, 1, 3, 2]
*/
function shuffle(collection) {
return sample(collection, POSITIVE_INFINITY);
}
/**
* Gets the size of `collection` by returning its length for array-like
* values or the number of own enumerable properties for objects.
*
* @static
* @memberOf _
* @category Collection
* @param {Array|Object|string} collection The collection to inspect.
* @returns {number} Returns the size of `collection`.
* @example
*
* _.size([1, 2, 3]);
* // => 3
*
* _.size({ 'a': 1, 'b': 2 });
* // => 2
*
* _.size('pebbles');
* // => 7
*/
function size(collection) {
var length = collection ? getLength(collection) : 0;
return isLength(length) ? length : keys(collection).length;
}
/**
* Checks if `predicate` returns truthy for **any** element of `collection`.
* The function returns as soon as it finds a passing value and does not iterate
* over the entire collection. The predicate is bound to `thisArg` and invoked
* with three arguments: (value, index|key, collection).
*
* If a property name is provided for `predicate` the created `_.property`
* style callback returns the property value of the given element.
*
* If a value is also provided for `thisArg` the created `_.matchesProperty`
* style callback returns `true` for elements that have a matching property
* value, else `false`.
*
* If an object is provided for `predicate` the created `_.matches` style
* callback returns `true` for elements that have the properties of the given
* object, else `false`.
*
* @static
* @memberOf _
* @alias any
* @category Collection
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function|Object|string} [predicate=_.identity] The function invoked
* per iteration.
* @param {*} [thisArg] The `this` binding of `predicate`.
* @returns {boolean} Returns `true` if any element passes the predicate check,
* else `false`.
* @example
*
* _.some([null, 0, 'yes', false], Boolean);
* // => true
*
* var users = [
* { 'user': 'barney', 'active': true },
* { 'user': 'fred', 'active': false }
* ];
*
* // using the `_.matches` callback shorthand
* _.some(users, { 'user': 'barney', 'active': false });
* // => false
*
* // using the `_.matchesProperty` callback shorthand
* _.some(users, 'active', false);
* // => true
*
* // using the `_.property` callback shorthand
* _.some(users, 'active');
* // => true
*/
function some(collection, predicate, thisArg) {
var func = isArray(collection) ? arraySome : baseSome;
if (thisArg && isIterateeCall(collection, predicate, thisArg)) {
predicate = null;
}
if (typeof predicate != 'function' || thisArg !== undefined) {
predicate = getCallback(predicate, thisArg, 3);
}
return func(collection, predicate);
}
/**
* Creates an array of elements, sorted in ascending order by the results of
* running each element in a collection through `iteratee`. This method performs
* a stable sort, that is, it preserves the original sort order of equal elements.
* The `iteratee` is bound to `thisArg` and invoked with three arguments:
* (value, index|key, collection).
*
* If a property name is provided for `iteratee` the created `_.property`
* style callback returns the property value of the given element.
*
* If a value is also provided for `thisArg` the created `_.matchesProperty`
* style callback returns `true` for elements that have a matching property
* value, else `false`.
*
* If an object is provided for `iteratee` the created `_.matches` style
* callback returns `true` for elements that have the properties of the given
* object, else `false`.
*
* @static
* @memberOf _
* @category Collection
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function|Object|string} [iteratee=_.identity] The function invoked
* per iteration.
* @param {*} [thisArg] The `this` binding of `iteratee`.
* @returns {Array} Returns the new sorted array.
* @example
*
* _.sortBy([1, 2, 3], function(n) {
* return Math.sin(n);
* });
* // => [3, 1, 2]
*
* _.sortBy([1, 2, 3], function(n) {
* return this.sin(n);
* }, Math);
* // => [3, 1, 2]
*
* var users = [
* { 'user': 'fred' },
* { 'user': 'pebbles' },
* { 'user': 'barney' }
* ];
*
* // using the `_.property` callback shorthand
* _.pluck(_.sortBy(users, 'user'), 'user');
* // => ['barney', 'fred', 'pebbles']
*/
function sortBy(collection, iteratee, thisArg) {
if (collection == null) {
return [];
}
if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {
iteratee = null;
}
var index = -1;
iteratee = getCallback(iteratee, thisArg, 3);
var result = baseMap(collection, function(value, key, collection) {
return { 'criteria': iteratee(value, key, collection), 'index': ++index, 'value': value };
});
return baseSortBy(result, compareAscending);
}
/**
* This method is like `_.sortBy` except that it can sort by multiple iteratees
* or property names.
*
* If a property name is provided for an iteratee the created `_.property`
* style callback returns the property value of the given element.
*
* If an object is provided for an iteratee the created `_.matches` style
* callback returns `true` for elements that have the properties of the given
* object, else `false`.
*
* @static
* @memberOf _
* @category Collection
* @param {Array|Object|string} collection The collection to iterate over.
* @param {...(Function|Function[]|Object|Object[]|string|string[])} iteratees
* The iteratees to sort by, specified as individual values or arrays of values.
* @returns {Array} Returns the new sorted array.
* @example
*
* var users = [
* { 'user': 'fred', 'age': 48 },
* { 'user': 'barney', 'age': 36 },
* { 'user': 'fred', 'age': 42 },
* { 'user': 'barney', 'age': 34 }
* ];
*
* _.map(_.sortByAll(users, ['user', 'age']), _.values);
* // => [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]]
*
* _.map(_.sortByAll(users, 'user', function(chr) {
* return Math.floor(chr.age / 10);
* }), _.values);
* // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
*/
var sortByAll = restParam(function(collection, iteratees) {
if (collection == null) {
return [];
}
var guard = iteratees[2];
if (guard && isIterateeCall(iteratees[0], iteratees[1], guard)) {
iteratees.length = 1;
}
return baseSortByOrder(collection, baseFlatten(iteratees), []);
});
/**
* This method is like `_.sortByAll` except that it allows specifying the
* sort orders of the iteratees to sort by. A truthy value in `orders` will
* sort the corresponding property name in ascending order while a falsey
* value will sort it in descending order.
*
* If a property name is provided for an iteratee the created `_.property`
* style callback returns the property value of the given element.
*
* If an object is provided for an iteratee the created `_.matches` style
* callback returns `true` for elements that have the properties of the given
* object, else `false`.
*
* @static
* @memberOf _
* @category Collection
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
* @param {boolean[]} orders The sort orders of `iteratees`.
* @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`.
* @returns {Array} Returns the new sorted array.
* @example
*
* var users = [
* { 'user': 'fred', 'age': 48 },
* { 'user': 'barney', 'age': 34 },
* { 'user': 'fred', 'age': 42 },
* { 'user': 'barney', 'age': 36 }
* ];
*
* // sort by `user` in ascending order and by `age` in descending order
* _.map(_.sortByOrder(users, ['user', 'age'], [true, false]), _.values);
* // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
*/
function sortByOrder(collection, iteratees, orders, guard) {
if (collection == null) {
return [];
}
if (guard && isIterateeCall(iteratees, orders, guard)) {
orders = null;
}
if (!isArray(iteratees)) {
iteratees = iteratees == null ? [] : [iteratees];
}
if (!isArray(orders)) {
orders = orders == null ? [] : [orders];
}
return baseSortByOrder(collection, iteratees, orders);
}
/**
* Performs a deep comparison between each element in `collection` and the
* source object, returning an array of all elements that have equivalent
* property values.
*
* **Note:** This method supports comparing arrays, booleans, `Date` objects,
* numbers, `Object` objects, regexes, and strings. Objects are compared by
* their own, not inherited, enumerable properties. For comparing a single
* own or inherited property value see `_.matchesProperty`.
*
* @static
* @memberOf _
* @category Collection
* @param {Array|Object|string} collection The collection to search.
* @param {Object} source The object of property values to match.
* @returns {Array} Returns the new filtered array.
* @example
*
* var users = [
* { 'user': 'barney', 'age': 36, 'active': false, 'pets': ['hoppy'] },
* { 'user': 'fred', 'age': 40, 'active': true, 'pets': ['baby puss', 'dino'] }
* ];
*
* _.pluck(_.where(users, { 'age': 36, 'active': false }), 'user');
* // => ['barney']
*
* _.pluck(_.where(users, { 'pets': ['dino'] }), 'user');
* // => ['fred']
*/
function where(collection, source) {
return filter(collection, baseMatches(source));
}
/*------------------------------------------------------------------------*/
/**
* Gets the number of milliseconds that have elapsed since the Unix epoch
* (1 January 1970 00:00:00 UTC).
*
* @static
* @memberOf _
* @category Date
* @example
*
* _.defer(function(stamp) {
* console.log(_.now() - stamp);
* }, _.now());
* // => logs the number of milliseconds it took for the deferred function to be invoked
*/
var now = nativeNow || function() {
return new Date().getTime();
};
/*------------------------------------------------------------------------*/
/**
* The opposite of `_.before`; this method creates a function that invokes
* `func` once it is called `n` or more times.
*
* @static
* @memberOf _
* @category Function
* @param {number} n The number of calls before `func` is invoked.
* @param {Function} func The function to restrict.
* @returns {Function} Returns the new restricted function.
* @example
*
* var saves = ['profile', 'settings'];
*
* var done = _.after(saves.length, function() {
* console.log('done saving!');
* });
*
* _.forEach(saves, function(type) {
* asyncSave({ 'type': type, 'complete': done });
* });
* // => logs 'done saving!' after the two async saves have completed
*/
function after(n, func) {
if (typeof func != 'function') {
if (typeof n == 'function') {
var temp = n;
n = func;
func = temp;
} else {
throw new TypeError(FUNC_ERROR_TEXT);
}
}
n = nativeIsFinite(n = +n) ? n : 0;
return function() {
if (--n < 1) {
return func.apply(this, arguments);
}
};
}
/**
* Creates a function that accepts up to `n` arguments ignoring any
* additional arguments.
*
* @static
* @memberOf _
* @category Function
* @param {Function} func The function to cap arguments for.
* @param {number} [n=func.length] The arity cap.
* @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
* @returns {Function} Returns the new function.
* @example
*
* _.map(['6', '8', '10'], _.ary(parseInt, 1));
* // => [6, 8, 10]
*/
function ary(func, n, guard) {
if (guard && isIterateeCall(func, n, guard)) {
n = null;
}
n = (func && n == null) ? func.length : nativeMax(+n || 0, 0);
return createWrapper(func, ARY_FLAG, null, null, null, null, n);
}
/**
* Creates a function that invokes `func`, with the `this` binding and arguments
* of the created function, while it is called less than `n` times. Subsequent
* calls to the created function return the result of the last `func` invocation.
*
* @static
* @memberOf _
* @category Function
* @param {number} n The number of calls at which `func` is no longer invoked.
* @param {Function} func The function to restrict.
* @returns {Function} Returns the new restricted function.
* @example
*
* jQuery('#add').on('click', _.before(5, addContactToList));
* // => allows adding up to 4 contacts to the list
*/
function before(n, func) {
var result;
if (typeof func != 'function') {
if (typeof n == 'function') {
var temp = n;
n = func;
func = temp;
} else {
throw new TypeError(FUNC_ERROR_TEXT);
}
}
return function() {
if (--n > 0) {
result = func.apply(this, arguments);
}
if (n <= 1) {
func = null;
}
return result;
};
}
/**
* Creates a function that invokes `func` with the `this` binding of `thisArg`
* and prepends any additional `_.bind` arguments to those provided to the
* bound function.
*
* The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
* may be used as a placeholder for partially applied arguments.
*
* **Note:** Unlike native `Function#bind` this method does not set the "length"
* property of bound functions.
*
* @static
* @memberOf _
* @category Function
* @param {Function} func The function to bind.
* @param {*} thisArg The `this` binding of `func`.
* @param {...*} [partials] The arguments to be partially applied.
* @returns {Function} Returns the new bound function.
* @example
*
* var greet = function(greeting, punctuation) {
* return greeting + ' ' + this.user + punctuation;
* };
*
* var object = { 'user': 'fred' };
*
* var bound = _.bind(greet, object, 'hi');
* bound('!');
* // => 'hi fred!'
*
* // using placeholders
* var bound = _.bind(greet, object, _, '!');
* bound('hi');
* // => 'hi fred!'
*/
var bind = restParam(function(func, thisArg, partials) {
var bitmask = BIND_FLAG;
if (partials.length) {
var holders = replaceHolders(partials, bind.placeholder);
bitmask |= PARTIAL_FLAG;
}
return createWrapper(func, bitmask, thisArg, partials, holders);
});
/**
* Binds methods of an object to the object itself, overwriting the existing
* method. Method names may be specified as individual arguments or as arrays
* of method names. If no method names are provided all enumerable function
* properties, own and inherited, of `object` are bound.
*
* **Note:** This method does not set the "length" property of bound functions.
*
* @static
* @memberOf _
* @category Function
* @param {Object} object The object to bind and assign the bound methods to.
* @param {...(string|string[])} [methodNames] The object method names to bind,
* specified as individual method names or arrays of method names.
* @returns {Object} Returns `object`.
* @example
*
* var view = {
* 'label': 'docs',
* 'onClick': function() {
* console.log('clicked ' + this.label);
* }
* };
*
* _.bindAll(view);
* jQuery('#docs').on('click', view.onClick);
* // => logs 'clicked docs' when the element is clicked
*/
var bindAll = restParam(function(object, methodNames) {
methodNames = methodNames.length ? baseFlatten(methodNames) : functions(object);
var index = -1,
length = methodNames.length;
while (++index < length) {
var key = methodNames[index];
object[key] = createWrapper(object[key], BIND_FLAG, object);
}
return object;
});
/**
* Creates a function that invokes the method at `object[key]` and prepends
* any additional `_.bindKey` arguments to those provided to the bound function.
*
* This method differs from `_.bind` by allowing bound functions to reference
* methods that may be redefined or don't yet exist.
* See [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
* for more details.
*
* The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
* builds, may be used as a placeholder for partially applied arguments.
*
* @static
* @memberOf _
* @category Function
* @param {Object} object The object the method belongs to.
* @param {string} key The key of the method.
* @param {...*} [partials] The arguments to be partially applied.
* @returns {Function} Returns the new bound function.
* @example
*
* var object = {
* 'user': 'fred',
* 'greet': function(greeting, punctuation) {
* return greeting + ' ' + this.user + punctuation;
* }
* };
*
* var bound = _.bindKey(object, 'greet', 'hi');
* bound('!');
* // => 'hi fred!'
*
* object.greet = function(greeting, punctuation) {
* return greeting + 'ya ' + this.user + punctuation;
* };
*
* bound('!');
* // => 'hiya fred!'
*
* // using placeholders
* var bound = _.bindKey(object, 'greet', _, '!');
* bound('hi');
* // => 'hiya fred!'
*/
var bindKey = restParam(function(object, key, partials) {
var bitmask = BIND_FLAG | BIND_KEY_FLAG;
if (partials.length) {
var holders = replaceHolders(partials, bindKey.placeholder);
bitmask |= PARTIAL_FLAG;
}
return createWrapper(key, bitmask, object, partials, holders);
});
/**
* Creates a function that accepts one or more arguments of `func` that when
* called either invokes `func` returning its result, if all `func` arguments
* have been provided, or returns a function that accepts one or more of the
* remaining `func` arguments, and so on. The arity of `func` may be specified
* if `func.length` is not sufficient.
*
* The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
* may be used as a placeholder for provided arguments.
*
* **Note:** This method does not set the "length" property of curried functions.
*
* @static
* @memberOf _
* @category Function
* @param {Function} func The function to curry.
* @param {number} [arity=func.length] The arity of `func`.
* @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
* @returns {Function} Returns the new curried function.
* @example
*
* var abc = function(a, b, c) {
* return [a, b, c];
* };
*
* var curried = _.curry(abc);
*
* curried(1)(2)(3);
* // => [1, 2, 3]
*
* curried(1, 2)(3);
* // => [1, 2, 3]
*
* curried(1, 2, 3);
* // => [1, 2, 3]
*
* // using placeholders
* curried(1)(_, 3)(2);
* // => [1, 2, 3]
*/
var curry = createCurry(CURRY_FLAG);
/**
* This method is like `_.curry` except that arguments are applied to `func`
* in the manner of `_.partialRight` instead of `_.partial`.
*
* The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
* builds, may be used as a placeholder for provided arguments.
*
* **Note:** This method does not set the "length" property of curried functions.
*
* @static
* @memberOf _
* @category Function
* @param {Function} func The function to curry.
* @param {number} [arity=func.length] The arity of `func`.
* @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
* @returns {Function} Returns the new curried function.
* @example
*
* var abc = function(a, b, c) {
* return [a, b, c];
* };
*
* var curried = _.curryRight(abc);
*
* curried(3)(2)(1);
* // => [1, 2, 3]
*
* curried(2, 3)(1);
* // => [1, 2, 3]
*
* curried(1, 2, 3);
* // => [1, 2, 3]
*
* // using placeholders
* curried(3)(1, _)(2);
* // => [1, 2, 3]
*/
var curryRight = createCurry(CURRY_RIGHT_FLAG);
/**
* Creates a debounced function that delays invoking `func` until after `wait`
* milliseconds have elapsed since the last time the debounced function was
* invoked. The debounced function comes with a `cancel` method to cancel
* delayed invocations. Provide an options object to indicate that `func`
* should be invoked on the leading and/or trailing edge of the `wait` timeout.
* Subsequent calls to the debounced function return the result of the last
* `func` invocation.
*
* **Note:** If `leading` and `trailing` options are `true`, `func` is invoked
* on the trailing edge of the timeout only if the the debounced function is
* invoked more than once during the `wait` timeout.
*
* See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)
* for details over the differences between `_.debounce` and `_.throttle`.
*
* @static
* @memberOf _
* @category Function
* @param {Function} func The function to debounce.
* @param {number} [wait=0] The number of milliseconds to delay.
* @param {Object} [options] The options object.
* @param {boolean} [options.leading=false] Specify invoking on the leading
* edge of the timeout.
* @param {number} [options.maxWait] The maximum time `func` is allowed to be
* delayed before it is invoked.
* @param {boolean} [options.trailing=true] Specify invoking on the trailing
* edge of the timeout.
* @returns {Function} Returns the new debounced function.
* @example
*
* // avoid costly calculations while the window size is in flux
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
*
* // invoke `sendMail` when the click event is fired, debouncing subsequent calls
* jQuery('#postbox').on('click', _.debounce(sendMail, 300, {
* 'leading': true,
* 'trailing': false
* }));
*
* // ensure `batchLog` is invoked once after 1 second of debounced calls
* var source = new EventSource('/stream');
* jQuery(source).on('message', _.debounce(batchLog, 250, {
* 'maxWait': 1000
* }));
*
* // cancel a debounced call
* var todoChanges = _.debounce(batchLog, 1000);
* Object.observe(models.todo, todoChanges);
*
* Object.observe(models, function(changes) {
* if (_.find(changes, { 'user': 'todo', 'type': 'delete'})) {
* todoChanges.cancel();
* }
* }, ['delete']);
*
* // ...at some point `models.todo` is changed
* models.todo.completed = true;
*
* // ...before 1 second has passed `models.todo` is deleted
* // which cancels the debounced `todoChanges` call
* delete models.todo;
*/
function debounce(func, wait, options) {
var args,
maxTimeoutId,
result,
stamp,
thisArg,
timeoutId,
trailingCall,
lastCalled = 0,
maxWait = false,
trailing = true;
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
wait = wait < 0 ? 0 : (+wait || 0);
if (options === true) {
var leading = true;
trailing = false;
} else if (isObject(options)) {
leading = options.leading;
maxWait = 'maxWait' in options && nativeMax(+options.maxWait || 0, wait);
trailing = 'trailing' in options ? options.trailing : trailing;
}
function cancel() {
if (timeoutId) {
clearTimeout(timeoutId);
}
if (maxTimeoutId) {
clearTimeout(maxTimeoutId);
}
maxTimeoutId = timeoutId = trailingCall = undefined;
}
function delayed() {
var remaining = wait - (now() - stamp);
if (remaining <= 0 || remaining > wait) {
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);
}
}
function maxDelayed() {
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;
}
}
}
function debounced() {
args = arguments;
stamp = now();
thisArg = this;
trailingCall = trailing && (timeoutId || !leading);
if (maxWait === false) {
var leadingCall = leading && !timeoutId;
} else {
if (!maxTimeoutId && !leading) {
lastCalled = stamp;
}
var remaining = maxWait - (stamp - lastCalled),
isCalled = remaining <= 0 || remaining > maxWait;
if (isCalled) {
if (maxTimeoutId) {
maxTimeoutId = clearTimeout(maxTimeoutId);
}
lastCalled = stamp;
result = func.apply(thisArg, args);
}
else if (!maxTimeoutId) {
maxTimeoutId = setTimeout(maxDelayed, remaining);
}
}
if (isCalled && timeoutId) {
timeoutId = clearTimeout(timeoutId);
}
else if (!timeoutId && wait !== maxWait) {
timeoutId = setTimeout(delayed, wait);
}
if (leadingCall) {
isCalled = true;
result = func.apply(thisArg, args);
}
if (isCalled && !timeoutId && !maxTimeoutId) {
args = thisArg = null;
}
return result;
}
debounced.cancel = cancel;
return debounced;
}
/**
* Defers invoking the `func` until the current call stack has cleared. Any
* additional arguments are provided to `func` when it is invoked.
*
* @static
* @memberOf _
* @category Function
* @param {Function} func The function to defer.
* @param {...*} [args] The arguments to invoke the function with.
* @returns {number} Returns the timer id.
* @example
*
* _.defer(function(text) {
* console.log(text);
* }, 'deferred');
* // logs 'deferred' after one or more milliseconds
*/
var defer = restParam(function(func, args) {
return baseDelay(func, 1, args);
});
/**
* Invokes `func` after `wait` milliseconds. Any additional arguments are
* provided to `func` when it is invoked.
*
* @static
* @memberOf _
* @category Function
* @param {Function} func The function to delay.
* @param {number} wait The number of milliseconds to delay invocation.
* @param {...*} [args] The arguments to invoke the function with.
* @returns {number} Returns the timer id.
* @example
*
* _.delay(function(text) {
* console.log(text);
* }, 1000, 'later');
* // => logs 'later' after one second
*/
var delay = restParam(function(func, wait, args) {
return baseDelay(func, wait, args);
});
/**
* Creates a function that returns the result of invoking the provided
* functions with the `this` binding of the created function, where each
* successive invocation is supplied the return value of the previous.
*
* @static
* @memberOf _
* @category Function
* @param {...Function} [funcs] Functions to invoke.
* @returns {Function} Returns the new function.
* @example
*
* function square(n) {
* return n * n;
* }
*
* var addSquare = _.flow(_.add, square);
* addSquare(1, 2);
* // => 9
*/
var flow = createFlow();
/**
* This method is like `_.flow` except that it creates a function that
* invokes the provided functions from right to left.
*
* @static
* @memberOf _
* @alias backflow, compose
* @category Function
* @param {...Function} [funcs] Functions to invoke.
* @returns {Function} Returns the new function.
* @example
*
* function square(n) {
* return n * n;
* }
*
* var addSquare = _.flowRight(square, _.add);
* addSquare(1, 2);
* // => 9
*/
var flowRight = createFlow(true);
/**
* Creates a function that memoizes the result of `func`. If `resolver` is
* provided it determines the cache key for storing the result based on the
* arguments provided to the memoized function. By default, the first argument
* provided to the memoized function is coerced to a string and used as the
* cache key. The `func` is invoked with the `this` binding of the memoized
* function.
*
* **Note:** The cache is exposed as the `cache` property on the memoized
* function. Its creation may be customized by replacing the `_.memoize.Cache`
* constructor with one whose instances implement the [`Map`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-map-prototype-object)
* method interface of `get`, `has`, and `set`.
*
* @static
* @memberOf _
* @category Function
* @param {Function} func The function to have its output memoized.
* @param {Function} [resolver] The function to resolve the cache key.
* @returns {Function} Returns the new memoizing function.
* @example
*
* var upperCase = _.memoize(function(string) {
* return string.toUpperCase();
* });
*
* upperCase('fred');
* // => 'FRED'
*
* // modifying the result cache
* upperCase.cache.set('fred', 'BARNEY');
* upperCase('fred');
* // => 'BARNEY'
*
* // replacing `_.memoize.Cache`
* var object = { 'user': 'fred' };
* var other = { 'user': 'barney' };
* var identity = _.memoize(_.identity);
*
* identity(object);
* // => { 'user': 'fred' }
* identity(other);
* // => { 'user': 'fred' }
*
* _.memoize.Cache = WeakMap;
* var identity = _.memoize(_.identity);
*
* identity(object);
* // => { 'user': 'fred' }
* identity(other);
* // => { 'user': 'barney' }
*/
function memoize(func, resolver) {
if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
throw new TypeError(FUNC_ERROR_TEXT);
}
var memoized = function() {
var args = arguments,
key = resolver ? resolver.apply(this, args) : args[0],
cache = memoized.cache;
if (cache.has(key)) {
return cache.get(key);
}
var result = func.apply(this, args);
memoized.cache = cache.set(key, result);
return result;
};
memoized.cache = new memoize.Cache;
return memoized;
}
/**
* Creates a function that negates the result of the predicate `func`. The
* `func` predicate is invoked with the `this` binding and arguments of the
* created function.
*
* @static
* @memberOf _
* @category Function
* @param {Function} predicate The predicate to negate.
* @returns {Function} Returns the new function.
* @example
*
* function isEven(n) {
* return n % 2 == 0;
* }
*
* _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
* // => [1, 3, 5]
*/
function negate(predicate) {
if (typeof predicate != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
return function() {
return !predicate.apply(this, arguments);
};
}
/**
* Creates a function that is restricted to invoking `func` once. Repeat calls
* to the function return the value of the first call. The `func` is invoked
* with the `this` binding and arguments of the created function.
*
* @static
* @memberOf _
* @category Function
* @param {Function} func The function to restrict.
* @returns {Function} Returns the new restricted function.
* @example
*
* var initialize = _.once(createApplication);
* initialize();
* initialize();
* // `initialize` invokes `createApplication` once
*/
function once(func) {
return before(2, func);
}
/**
* Creates a function that invokes `func` with `partial` arguments prepended
* to those provided to the new function. This method is like `_.bind` except
* it does **not** alter the `this` binding.
*
* The `_.partial.placeholder` value, which defaults to `_` in monolithic
* builds, may be used as a placeholder for partially applied arguments.
*
* **Note:** This method does not set the "length" property of partially
* applied functions.
*
* @static
* @memberOf _
* @category Function
* @param {Function} func The function to partially apply arguments to.
* @param {...*} [partials] The arguments to be partially applied.
* @returns {Function} Returns the new partially applied function.
* @example
*
* var greet = function(greeting, name) {
* return greeting + ' ' + name;
* };
*
* var sayHelloTo = _.partial(greet, 'hello');
* sayHelloTo('fred');
* // => 'hello fred'
*
* // using placeholders
* var greetFred = _.partial(greet, _, 'fred');
* greetFred('hi');
* // => 'hi fred'
*/
var partial = createPartial(PARTIAL_FLAG);
/**
* This method is like `_.partial` except that partially applied arguments
* are appended to those provided to the new function.
*
* The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
* builds, may be used as a placeholder for partially applied arguments.
*
* **Note:** This method does not set the "length" property of partially
* applied functions.
*
* @static
* @memberOf _
* @category Function
* @param {Function} func The function to partially apply arguments to.
* @param {...*} [partials] The arguments to be partially applied.
* @returns {Function} Returns the new partially applied function.
* @example
*
* var greet = function(greeting, name) {
* return greeting + ' ' + name;
* };
*
* var greetFred = _.partialRight(greet, 'fred');
* greetFred('hi');
* // => 'hi fred'
*
* // using placeholders
* var sayHelloTo = _.partialRight(greet, 'hello', _);
* sayHelloTo('fred');
* // => 'hello fred'
*/
var partialRight = createPartial(PARTIAL_RIGHT_FLAG);
/**
* Creates a function that invokes `func` with arguments arranged according
* to the specified indexes where the argument value at the first index is
* provided as the first argument, the argument value at the second index is
* provided as the second argument, and so on.
*
* @static
* @memberOf _
* @category Function
* @param {Function} func The function to rearrange arguments for.
* @param {...(number|number[])} indexes The arranged argument indexes,
* specified as individual indexes or arrays of indexes.
* @returns {Function} Returns the new function.
* @example
*
* var rearged = _.rearg(function(a, b, c) {
* return [a, b, c];
* }, 2, 0, 1);
*
* rearged('b', 'c', 'a')
* // => ['a', 'b', 'c']
*
* var map = _.rearg(_.map, [1, 0]);
* map(function(n) {
* return n * 3;
* }, [1, 2, 3]);
* // => [3, 6, 9]
*/
var rearg = restParam(function(func, indexes) {
return createWrapper(func, REARG_FLAG, null, null, null, baseFlatten(indexes));
});
/**
* Creates a function that invokes `func` with the `this` binding of the
* created function and arguments from `start` and beyond provided as an array.
*
* **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters).
*
* @static
* @memberOf _
* @category Function
* @param {Function} func The function to apply a rest parameter to.
* @param {number} [start=func.length-1] The start position of the rest parameter.
* @returns {Function} Returns the new function.
* @example
*
* var say = _.restParam(function(what, names) {
* return what + ' ' + _.initial(names).join(', ') +
* (_.size(names) > 1 ? ', & ' : '') + _.last(names);
* });
*
* say('hello', 'fred', 'barney', 'pebbles');
* // => 'hello fred, barney, & pebbles'
*/
function restParam(func, start) {
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0);
return function() {
var args = arguments,
index = -1,
length = nativeMax(args.length - start, 0),
rest = Array(length);
while (++index < length) {
rest[index] = args[start + index];
}
switch (start) {
case 0: return func.call(this, rest);
case 1: return func.call(this, args[0], rest);
case 2: return func.call(this, args[0], args[1], rest);
}
var otherArgs = Array(start + 1);
index = -1;
while (++index < start) {
otherArgs[index] = args[index];
}
otherArgs[start] = rest;
return func.apply(this, otherArgs);
};
}
/**
* Creates a function that invokes `func` with the `this` binding of the created
* function and an array of arguments much like [`Function#apply`](https://es5.github.io/#x15.3.4.3).
*
* **Note:** This method is based on the [spread operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator).
*
* @static
* @memberOf _
* @category Function
* @param {Function} func The function to spread arguments over.
* @returns {Function} Returns the new function.
* @example
*
* var say = _.spread(function(who, what) {
* return who + ' says ' + what;
* });
*
* say(['fred', 'hello']);
* // => 'fred says hello'
*
* // with a Promise
* var numbers = Promise.all([
* Promise.resolve(40),
* Promise.resolve(36)
* ]);
*
* numbers.then(_.spread(function(x, y) {
* return x + y;
* }));
* // => a Promise of 76
*/
function spread(func) {
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
return function(array) {
return func.apply(this, array);
};
}
/**
* Creates a throttled function that only invokes `func` at most once per
* every `wait` milliseconds. The throttled function comes with a `cancel`
* method to cancel delayed invocations. Provide an options object to indicate
* that `func` should be invoked on the leading and/or trailing edge of the
* `wait` timeout. Subsequent calls to the throttled function return the
* result of the last `func` call.
*
* **Note:** If `leading` and `trailing` options are `true`, `func` is invoked
* on the trailing edge of the timeout only if the the throttled function is
* invoked more than once during the `wait` timeout.
*
* See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)
* for details over the differences between `_.throttle` and `_.debounce`.
*
* @static
* @memberOf _
* @category Function
* @param {Function} func The function to throttle.
* @param {number} [wait=0] The number of milliseconds to throttle invocations to.
* @param {Object} [options] The options object.
* @param {boolean} [options.leading=true] Specify invoking on the leading
* edge of the timeout.
* @param {boolean} [options.trailing=true] Specify invoking on the trailing
* edge of the timeout.
* @returns {Function} Returns the new throttled function.
* @example
*
* // avoid excessively updating the position while scrolling
* jQuery(window).on('scroll', _.throttle(updatePosition, 100));
*
* // invoke `renewToken` when the click event is fired, but not more than once every 5 minutes
* jQuery('.interactive').on('click', _.throttle(renewToken, 300000, {
* 'trailing': false
* }));
*
* // cancel a trailing throttled call
* jQuery(window).on('popstate', throttled.cancel);
*/
function throttle(func, wait, options) {
var leading = true,
trailing = true;
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
if (options === false) {
leading = false;
} else if (isObject(options)) {
leading = 'leading' in options ? !!options.leading : leading;
trailing = 'trailing' in options ? !!options.trailing : trailing;
}
debounceOptions.leading = leading;
debounceOptions.maxWait = +wait;
debounceOptions.trailing = trailing;
return debounce(func, wait, debounceOptions);
}
/**
* Creates a function that provides `value` to the wrapper function as its
* first argument. Any additional arguments provided to the function are
* appended to those provided to the wrapper function. The wrapper is invoked
* with the `this` binding of the created function.
*
* @static
* @memberOf _
* @category Function
* @param {*} value The value to wrap.
* @param {Function} wrapper The wrapper function.
* @returns {Function} Returns the new function.
* @example
*
* var p = _.wrap(_.escape, function(func, text) {
* return '<p>' + func(text) + '</p>';
* });
*
* p('fred, barney, & pebbles');
* // => '<p>fred, barney, & pebbles</p>'
*/
function wrap(value, wrapper) {
wrapper = wrapper == null ? identity : wrapper;
return createWrapper(wrapper, PARTIAL_FLAG, null, [value], []);
}
/*------------------------------------------------------------------------*/
/**
* Creates a clone of `value`. If `isDeep` is `true` nested objects are cloned,
* otherwise they are assigned by reference. If `customizer` is provided it is
* invoked to produce the cloned values. If `customizer` returns `undefined`
* cloning is handled by the method instead. The `customizer` is bound to
* `thisArg` and invoked with two argument; (value [, index|key, object]).
*
* **Note:** This method is loosely based on the
* [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm).
* The enumerable properties of `arguments` objects and objects created by
* constructors other than `Object` are cloned to plain `Object` objects. An
* empty object is returned for uncloneable values such as functions, DOM nodes,
* Maps, Sets, and WeakMaps.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to clone.
* @param {boolean} [isDeep] Specify a deep clone.
* @param {Function} [customizer] The function to customize cloning values.
* @param {*} [thisArg] The `this` binding of `customizer`.
* @returns {*} Returns the cloned value.
* @example
*
* var users = [
* { 'user': 'barney' },
* { 'user': 'fred' }
* ];
*
* var shallow = _.clone(users);
* shallow[0] === users[0];
* // => true
*
* var deep = _.clone(users, true);
* deep[0] === users[0];
* // => false
*
* // using a customizer callback
* var el = _.clone(document.body, function(value) {
* if (_.isElement(value)) {
* return value.cloneNode(false);
* }
* });
*
* el === document.body
* // => false
* el.nodeName
* // => BODY
* el.childNodes.length;
* // => 0
*/
function clone(value, isDeep, customizer, thisArg) {
if (isDeep && typeof isDeep != 'boolean' && isIterateeCall(value, isDeep, customizer)) {
isDeep = false;
}
else if (typeof isDeep == 'function') {
thisArg = customizer;
customizer = isDeep;
isDeep = false;
}
return typeof customizer == 'function'
? baseClone(value, isDeep, bindCallback(customizer, thisArg, 1))
: baseClone(value, isDeep);
}
/**
* Creates a deep clone of `value`. If `customizer` is provided it is invoked
* to produce the cloned values. If `customizer` returns `undefined` cloning
* is handled by the method instead. The `customizer` is bound to `thisArg`
* and invoked with two argument; (value [, index|key, object]).
*
* **Note:** This method is loosely based on the
* [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm).
* The enumerable properties of `arguments` objects and objects created by
* constructors other than `Object` are cloned to plain `Object` objects. An
* empty object is returned for uncloneable values such as functions, DOM nodes,
* Maps, Sets, and WeakMaps.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to deep clone.
* @param {Function} [customizer] The function to customize cloning values.
* @param {*} [thisArg] The `this` binding of `customizer`.
* @returns {*} Returns the deep cloned value.
* @example
*
* var users = [
* { 'user': 'barney' },
* { 'user': 'fred' }
* ];
*
* var deep = _.cloneDeep(users);
* deep[0] === users[0];
* // => false
*
* // using a customizer callback
* var el = _.cloneDeep(document.body, function(value) {
* if (_.isElement(value)) {
* return value.cloneNode(true);
* }
* });
*
* el === document.body
* // => false
* el.nodeName
* // => BODY
* el.childNodes.length;
* // => 20
*/
function cloneDeep(value, customizer, thisArg) {
return typeof customizer == 'function'
? baseClone(value, true, bindCallback(customizer, thisArg, 1))
: baseClone(value, true);
}
/**
* Checks if `value` is greater than `other`.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if `value` is greater than `other`, else `false`.
* @example
*
* _.gt(3, 1);
* // => true
*
* _.gt(3, 3);
* // => false
*
* _.gt(1, 3);
* // => false
*/
function gt(value, other) {
return value > other;
}
/**
* Checks if `value` is greater than or equal to `other`.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if `value` is greater than or equal to `other`, else `false`.
* @example
*
* _.gte(3, 1);
* // => true
*
* _.gte(3, 3);
* // => true
*
* _.gte(1, 3);
* // => false
*/
function gte(value, other) {
return value >= other;
}
/**
* Checks if `value` is classified as an `arguments` object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isArguments(function() { return arguments; }());
* // => true
*
* _.isArguments([1, 2, 3]);
* // => false
*/
function isArguments(value) {
return isObjectLike(value) && isArrayLike(value) && objToString.call(value) == argsTag;
}
/**
* Checks if `value` is classified as an `Array` object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isArray([1, 2, 3]);
* // => true
*
* _.isArray(function() { return arguments; }());
* // => false
*/
var isArray = nativeIsArray || function(value) {
return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;
};
/**
* Checks if `value` is classified as a boolean primitive or object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isBoolean(false);
* // => true
*
* _.isBoolean(null);
* // => false
*/
function isBoolean(value) {
return value === true || value === false || (isObjectLike(value) && objToString.call(value) == boolTag);
}
/**
* Checks if `value` is classified as a `Date` object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isDate(new Date);
* // => true
*
* _.isDate('Mon April 23 2012');
* // => false
*/
function isDate(value) {
return isObjectLike(value) && objToString.call(value) == dateTag;
}
/**
* Checks if `value` is a DOM element.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
* @example
*
* _.isElement(document.body);
* // => true
*
* _.isElement('<body>');
* // => false
*/
function isElement(value) {
return !!value && value.nodeType === 1 && isObjectLike(value) &&
(objToString.call(value).indexOf('Element') > -1);
}
// Fallback for environments without DOM support.
if (!support.dom) {
isElement = function(value) {
return !!value && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value);
};
}
/**
* Checks if `value` is empty. A value is considered empty unless it is an
* `arguments` object, array, string, or jQuery-like collection with a length
* greater than `0` or an object with own enumerable properties.
*
* @static
* @memberOf _
* @category Lang
* @param {Array|Object|string} value The value to inspect.
* @returns {boolean} Returns `true` if `value` is empty, else `false`.
* @example
*
* _.isEmpty(null);
* // => true
*
* _.isEmpty(true);
* // => true
*
* _.isEmpty(1);
* // => true
*
* _.isEmpty([1, 2, 3]);
* // => false
*
* _.isEmpty({ 'a': 1 });
* // => false
*/
function isEmpty(value) {
if (value == null) {
return true;
}
if (isArrayLike(value) && (isArray(value) || isString(value) || isArguments(value) ||
(isObjectLike(value) && isFunction(value.splice)))) {
return !value.length;
}
return !keys(value).length;
}
/**
* Performs a deep comparison between two values to determine if they are
* equivalent. If `customizer` is provided it is invoked to compare values.
* If `customizer` returns `undefined` comparisons are handled by the method
* instead. The `customizer` is bound to `thisArg` and invoked with three
* arguments: (value, other [, index|key]).
*
* **Note:** This method supports comparing arrays, booleans, `Date` objects,
* numbers, `Object` objects, regexes, and strings. Objects are compared by
* their own, not inherited, enumerable properties. Functions and DOM nodes
* are **not** supported. Provide a customizer function to extend support
* for comparing other values.
*
* @static
* @memberOf _
* @alias eq
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @param {Function} [customizer] The function to customize value comparisons.
* @param {*} [thisArg] The `this` binding of `customizer`.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* var object = { 'user': 'fred' };
* var other = { 'user': 'fred' };
*
* object == other;
* // => false
*
* _.isEqual(object, other);
* // => true
*
* // using a customizer callback
* var array = ['hello', 'goodbye'];
* var other = ['hi', 'goodbye'];
*
* _.isEqual(array, other, function(value, other) {
* if (_.every([value, other], RegExp.prototype.test, /^h(?:i|ello)$/)) {
* return true;
* }
* });
* // => true
*/
function isEqual(value, other, customizer, thisArg) {
customizer = typeof customizer == 'function' ? bindCallback(customizer, thisArg, 3) : undefined;
var result = customizer ? customizer(value, other) : undefined;
return result === undefined ? baseIsEqual(value, other, customizer) : !!result;
}
/**
* Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
* `SyntaxError`, `TypeError`, or `URIError` object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an error object, else `false`.
* @example
*
* _.isError(new Error);
* // => true
*
* _.isError(Error);
* // => false
*/
function isError(value) {
return isObjectLike(value) && typeof value.message == 'string' && objToString.call(value) == errorTag;
}
/**
* Checks if `value` is a finite primitive number.
*
* **Note:** This method is based on [`Number.isFinite`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isfinite).
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
* @example
*
* _.isFinite(10);
* // => true
*
* _.isFinite('10');
* // => false
*
* _.isFinite(true);
* // => false
*
* _.isFinite(Object(10));
* // => false
*
* _.isFinite(Infinity);
* // => false
*/
var isFinite = nativeNumIsFinite || function(value) {
return typeof value == 'number' && nativeIsFinite(value);
};
/**
* Checks if `value` is classified as a `Function` object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isFunction(_);
* // => true
*
* _.isFunction(/abc/);
* // => false
*/
var isFunction = !(baseIsFunction(/x/) || (Uint8Array && !baseIsFunction(Uint8Array))) ? baseIsFunction : function(value) {
// The use of `Object#toString` avoids issues with the `typeof` operator
// in older versions of Chrome and Safari which return 'function' for regexes
// and Safari 8 equivalents which return 'object' for typed array constructors.
return objToString.call(value) == funcTag;
};
/**
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(1);
* // => false
*/
function isObject(value) {
// Avoid a V8 JIT bug in Chrome 19-20.
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
var type = typeof value;
return !!value && (type == 'object' || type == 'function');
}
/**
* Performs a deep comparison between `object` and `source` to determine if
* `object` contains equivalent property values. If `customizer` is provided
* it is invoked to compare values. If `customizer` returns `undefined`
* comparisons are handled by the method instead. The `customizer` is bound
* to `thisArg` and invoked with three arguments: (value, other, index|key).
*
* **Note:** This method supports comparing properties of arrays, booleans,
* `Date` objects, numbers, `Object` objects, regexes, and strings. Functions
* and DOM nodes are **not** supported. Provide a customizer function to extend
* support for comparing other values.
*
* @static
* @memberOf _
* @category Lang
* @param {Object} object The object to inspect.
* @param {Object} source The object of property values to match.
* @param {Function} [customizer] The function to customize value comparisons.
* @param {*} [thisArg] The `this` binding of `customizer`.
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
* @example
*
* var object = { 'user': 'fred', 'age': 40 };
*
* _.isMatch(object, { 'age': 40 });
* // => true
*
* _.isMatch(object, { 'age': 36 });
* // => false
*
* // using a customizer callback
* var object = { 'greeting': 'hello' };
* var source = { 'greeting': 'hi' };
*
* _.isMatch(object, source, function(value, other) {
* return _.every([value, other], RegExp.prototype.test, /^h(?:i|ello)$/) || undefined;
* });
* // => true
*/
function isMatch(object, source, customizer, thisArg) {
customizer = typeof customizer == 'function' ? bindCallback(customizer, thisArg, 3) : undefined;
return baseIsMatch(object, getMatchData(source), customizer);
}
/**
* Checks if `value` is `NaN`.
*
* **Note:** This method is not the same as [`isNaN`](https://es5.github.io/#x15.1.2.4)
* which returns `true` for `undefined` and other non-numeric values.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
* @example
*
* _.isNaN(NaN);
* // => true
*
* _.isNaN(new Number(NaN));
* // => true
*
* isNaN(undefined);
* // => true
*
* _.isNaN(undefined);
* // => false
*/
function isNaN(value) {
// An `NaN` primitive is the only value that is not equal to itself.
// Perform the `toStringTag` check first to avoid errors with some host objects in IE.
return isNumber(value) && value != +value;
}
/**
* Checks if `value` is a native function.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a native function, else `false`.
* @example
*
* _.isNative(Array.prototype.push);
* // => true
*
* _.isNative(_);
* // => false
*/
function isNative(value) {
if (value == null) {
return false;
}
if (objToString.call(value) == funcTag) {
return reIsNative.test(fnToString.call(value));
}
return isObjectLike(value) && reIsHostCtor.test(value);
}
/**
* Checks if `value` is `null`.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is `null`, else `false`.
* @example
*
* _.isNull(null);
* // => true
*
* _.isNull(void 0);
* // => false
*/
function isNull(value) {
return value === null;
}
/**
* Checks if `value` is classified as a `Number` primitive or object.
*
* **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are classified
* as numbers, use the `_.isFinite` method.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isNumber(8.4);
* // => true
*
* _.isNumber(NaN);
* // => true
*
* _.isNumber('8.4');
* // => false
*/
function isNumber(value) {
return typeof value == 'number' || (isObjectLike(value) && objToString.call(value) == numberTag);
}
/**
* Checks if `value` is a plain object, that is, an object created by the
* `Object` constructor or one with a `[[Prototype]]` of `null`.
*
* **Note:** This method assumes objects created by the `Object` constructor
* have no inherited enumerable properties.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
* @example
*
* function Foo() {
* this.a = 1;
* }
*
* _.isPlainObject(new Foo);
* // => false
*
* _.isPlainObject([1, 2, 3]);
* // => false
*
* _.isPlainObject({ 'x': 0, 'y': 0 });
* // => true
*
* _.isPlainObject(Object.create(null));
* // => true
*/
var isPlainObject = !getPrototypeOf ? shimIsPlainObject : function(value) {
if (!(value && objToString.call(value) == objectTag)) {
return false;
}
var valueOf = getNative(value, 'valueOf'),
objProto = valueOf && (objProto = getPrototypeOf(valueOf)) && getPrototypeOf(objProto);
return objProto
? (value == objProto || getPrototypeOf(value) == objProto)
: shimIsPlainObject(value);
};
/**
* Checks if `value` is classified as a `RegExp` object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isRegExp(/abc/);
* // => true
*
* _.isRegExp('/abc/');
* // => false
*/
function isRegExp(value) {
return isObjectLike(value) && objToString.call(value) == regexpTag;
}
/**
* Checks if `value` is classified as a `String` primitive or object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isString('abc');
* // => true
*
* _.isString(1);
* // => false
*/
function isString(value) {
return typeof value == 'string' || (isObjectLike(value) && objToString.call(value) == stringTag);
}
/**
* Checks if `value` is classified as a typed array.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isTypedArray(new Uint8Array);
* // => true
*
* _.isTypedArray([]);
* // => false
*/
function isTypedArray(value) {
return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)];
}
/**
* Checks if `value` is `undefined`.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
* @example
*
* _.isUndefined(void 0);
* // => true
*
* _.isUndefined(null);
* // => false
*/
function isUndefined(value) {
return value === undefined;
}
/**
* Checks if `value` is less than `other`.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if `value` is less than `other`, else `false`.
* @example
*
* _.lt(1, 3);
* // => true
*
* _.lt(3, 3);
* // => false
*
* _.lt(3, 1);
* // => false
*/
function lt(value, other) {
return value < other;
}
/**
* Checks if `value` is less than or equal to `other`.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if `value` is less than or equal to `other`, else `false`.
* @example
*
* _.lte(1, 3);
* // => true
*
* _.lte(3, 3);
* // => true
*
* _.lte(3, 1);
* // => false
*/
function lte(value, other) {
return value <= other;
}
/**
* Converts `value` to an array.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to convert.
* @returns {Array} Returns the converted array.
* @example
*
* (function() {
* return _.toArray(arguments).slice(1);
* }(1, 2, 3));
* // => [2, 3]
*/
function toArray(value) {
var length = value ? getLength(value) : 0;
if (!isLength(length)) {
return values(value);
}
if (!length) {
return [];
}
return arrayCopy(value);
}
/**
* Converts `value` to a plain object flattening inherited enumerable
* properties of `value` to own properties of the plain object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to convert.
* @returns {Object} Returns the converted plain object.
* @example
*
* function Foo() {
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.assign({ 'a': 1 }, new Foo);
* // => { 'a': 1, 'b': 2 }
*
* _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
* // => { 'a': 1, 'b': 2, 'c': 3 }
*/
function toPlainObject(value) {
return baseCopy(value, keysIn(value));
}
/*------------------------------------------------------------------------*/
/**
* Assigns own enumerable properties of source object(s) to the destination
* object. Subsequent sources overwrite property assignments of previous sources.
* If `customizer` is provided it is invoked to produce the assigned values.
* The `customizer` is bound to `thisArg` and invoked with five arguments:
* (objectValue, sourceValue, key, object, source).
*
* **Note:** This method mutates `object` and is based on
* [`Object.assign`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign).
*
* @static
* @memberOf _
* @alias extend
* @category Object
* @param {Object} object The destination object.
* @param {...Object} [sources] The source objects.
* @param {Function} [customizer] The function to customize assigned values.
* @param {*} [thisArg] The `this` binding of `customizer`.
* @returns {Object} Returns `object`.
* @example
*
* _.assign({ 'user': 'barney' }, { 'age': 40 }, { 'user': 'fred' });
* // => { 'user': 'fred', 'age': 40 }
*
* // using a customizer callback
* var defaults = _.partialRight(_.assign, function(value, other) {
* return _.isUndefined(value) ? other : value;
* });
*
* defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });
* // => { 'user': 'barney', 'age': 36 }
*/
var assign = createAssigner(function(object, source, customizer) {
return customizer
? assignWith(object, source, customizer)
: baseAssign(object, source);
});
/**
* Creates an object that inherits from the given `prototype` object. If a
* `properties` object is provided its own enumerable properties are assigned
* to the created object.
*
* @static
* @memberOf _
* @category Object
* @param {Object} prototype The object to inherit from.
* @param {Object} [properties] The properties to assign to the object.
* @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
* @returns {Object} Returns the new object.
* @example
*
* function Shape() {
* this.x = 0;
* this.y = 0;
* }
*
* function Circle() {
* Shape.call(this);
* }
*
* Circle.prototype = _.create(Shape.prototype, {
* 'constructor': Circle
* });
*
* var circle = new Circle;
* circle instanceof Circle;
* // => true
*
* circle instanceof Shape;
* // => true
*/
function create(prototype, properties, guard) {
var result = baseCreate(prototype);
if (guard && isIterateeCall(prototype, properties, guard)) {
properties = null;
}
return properties ? baseAssign(result, properties) : result;
}
/**
* Assigns own enumerable properties of source object(s) to the destination
* object for all destination properties that resolve to `undefined`. Once a
* property is set, additional values of the same property are ignored.
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The destination object.
* @param {...Object} [sources] The source objects.
* @returns {Object} Returns `object`.
* @example
*
* _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });
* // => { 'user': 'barney', 'age': 36 }
*/
var defaults = restParam(function(args) {
var object = args[0];
if (object == null) {
return object;
}
args.push(assignDefaults);
return assign.apply(undefined, args);
});
/**
* This method is like `_.find` except that it returns the key of the first
* element `predicate` returns truthy for instead of the element itself.
*
* If a property name is provided for `predicate` the created `_.property`
* style callback returns the property value of the given element.
*
* If a value is also provided for `thisArg` the created `_.matchesProperty`
* style callback returns `true` for elements that have a matching property
* value, else `false`.
*
* If an object is provided for `predicate` the created `_.matches` style
* callback returns `true` for elements that have the properties of the given
* object, else `false`.
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The object to search.
* @param {Function|Object|string} [predicate=_.identity] The function invoked
* per iteration.
* @param {*} [thisArg] The `this` binding of `predicate`.
* @returns {string|undefined} Returns the key of the matched element, else `undefined`.
* @example
*
* var users = {
* 'barney': { 'age': 36, 'active': true },
* 'fred': { 'age': 40, 'active': false },
* 'pebbles': { 'age': 1, 'active': true }
* };
*
* _.findKey(users, function(chr) {
* return chr.age < 40;
* });
* // => 'barney' (iteration order is not guaranteed)
*
* // using the `_.matches` callback shorthand
* _.findKey(users, { 'age': 1, 'active': true });
* // => 'pebbles'
*
* // using the `_.matchesProperty` callback shorthand
* _.findKey(users, 'active', false);
* // => 'fred'
*
* // using the `_.property` callback shorthand
* _.findKey(users, 'active');
* // => 'barney'
*/
var findKey = createFindKey(baseForOwn);
/**
* This method is like `_.findKey` except that it iterates over elements of
* a collection in the opposite order.
*
* If a property name is provided for `predicate` the created `_.property`
* style callback returns the property value of the given element.
*
* If a value is also provided for `thisArg` the created `_.matchesProperty`
* style callback returns `true` for elements that have a matching property
* value, else `false`.
*
* If an object is provided for `predicate` the created `_.matches` style
* callback returns `true` for elements that have the properties of the given
* object, else `false`.
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The object to search.
* @param {Function|Object|string} [predicate=_.identity] The function invoked
* per iteration.
* @param {*} [thisArg] The `this` binding of `predicate`.
* @returns {string|undefined} Returns the key of the matched element, else `undefined`.
* @example
*
* var users = {
* 'barney': { 'age': 36, 'active': true },
* 'fred': { 'age': 40, 'active': false },
* 'pebbles': { 'age': 1, 'active': true }
* };
*
* _.findLastKey(users, function(chr) {
* return chr.age < 40;
* });
* // => returns `pebbles` assuming `_.findKey` returns `barney`
*
* // using the `_.matches` callback shorthand
* _.findLastKey(users, { 'age': 36, 'active': true });
* // => 'barney'
*
* // using the `_.matchesProperty` callback shorthand
* _.findLastKey(users, 'active', false);
* // => 'fred'
*
* // using the `_.property` callback shorthand
* _.findLastKey(users, 'active');
* // => 'pebbles'
*/
var findLastKey = createFindKey(baseForOwnRight);
/**
* Iterates over own and inherited enumerable properties of an object invoking
* `iteratee` for each property. The `iteratee` is bound to `thisArg` and invoked
* with three arguments: (value, key, object). Iteratee functions may exit
* iteration early by explicitly returning `false`.
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The object to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @param {*} [thisArg] The `this` binding of `iteratee`.
* @returns {Object} Returns `object`.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.forIn(new Foo, function(value, key) {
* console.log(key);
* });
* // => logs 'a', 'b', and 'c' (iteration order is not guaranteed)
*/
var forIn = createForIn(baseFor);
/**
* This method is like `_.forIn` except that it iterates over properties of
* `object` in the opposite order.
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The object to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @param {*} [thisArg] The `this` binding of `iteratee`.
* @returns {Object} Returns `object`.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.forInRight(new Foo, function(value, key) {
* console.log(key);
* });
* // => logs 'c', 'b', and 'a' assuming `_.forIn ` logs 'a', 'b', and 'c'
*/
var forInRight = createForIn(baseForRight);
/**
* Iterates over own enumerable properties of an object invoking `iteratee`
* for each property. The `iteratee` is bound to `thisArg` and invoked with
* three arguments: (value, key, object). Iteratee functions may exit iteration
* early by explicitly returning `false`.
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The object to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @param {*} [thisArg] The `this` binding of `iteratee`.
* @returns {Object} Returns `object`.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.forOwn(new Foo, function(value, key) {
* console.log(key);
* });
* // => logs 'a' and 'b' (iteration order is not guaranteed)
*/
var forOwn = createForOwn(baseForOwn);
/**
* This method is like `_.forOwn` except that it iterates over properties of
* `object` in the opposite order.
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The object to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @param {*} [thisArg] The `this` binding of `iteratee`.
* @returns {Object} Returns `object`.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.forOwnRight(new Foo, function(value, key) {
* console.log(key);
* });
* // => logs 'b' and 'a' assuming `_.forOwn` logs 'a' and 'b'
*/
var forOwnRight = createForOwn(baseForOwnRight);
/**
* Creates an array of function property names from all enumerable properties,
* own and inherited, of `object`.
*
* @static
* @memberOf _
* @alias methods
* @category Object
* @param {Object} object The object to inspect.
* @returns {Array} Returns the new array of property names.
* @example
*
* _.functions(_);
* // => ['after', 'ary', 'assign', ...]
*/
function functions(object) {
return baseFunctions(object, keysIn(object));
}
/**
* Gets the property value at `path` of `object`. If the resolved value is
* `undefined` the `defaultValue` is used in its place.
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path of the property to get.
* @param {*} [defaultValue] The value returned if the resolved value is `undefined`.
* @returns {*} Returns the resolved value.
* @example
*
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
*
* _.get(object, 'a[0].b.c');
* // => 3
*
* _.get(object, ['a', '0', 'b', 'c']);
* // => 3
*
* _.get(object, 'a.b.c', 'default');
* // => 'default'
*/
function get(object, path, defaultValue) {
var result = object == null ? undefined : baseGet(object, toPath(path), path + '');
return result === undefined ? defaultValue : result;
}
/**
* Checks if `path` is a direct property.
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path to check.
* @returns {boolean} Returns `true` if `path` is a direct property, else `false`.
* @example
*
* var object = { 'a': { 'b': { 'c': 3 } } };
*
* _.has(object, 'a');
* // => true
*
* _.has(object, 'a.b.c');
* // => true
*
* _.has(object, ['a', 'b', 'c']);
* // => true
*/
function has(object, path) {
if (object == null) {
return false;
}
var result = hasOwnProperty.call(object, path);
if (!result && !isKey(path)) {
path = toPath(path);
object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
if (object == null) {
return false;
}
path = last(path);
result = hasOwnProperty.call(object, path);
}
return result || (isLength(object.length) && isIndex(path, object.length) &&
(isArray(object) || isArguments(object)));
}
/**
* Creates an object composed of the inverted keys and values of `object`.
* If `object` contains duplicate values, subsequent values overwrite property
* assignments of previous values unless `multiValue` is `true`.
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The object to invert.
* @param {boolean} [multiValue] Allow multiple values per key.
* @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
* @returns {Object} Returns the new inverted object.
* @example
*
* var object = { 'a': 1, 'b': 2, 'c': 1 };
*
* _.invert(object);
* // => { '1': 'c', '2': 'b' }
*
* // with `multiValue`
* _.invert(object, true);
* // => { '1': ['a', 'c'], '2': ['b'] }
*/
function invert(object, multiValue, guard) {
if (guard && isIterateeCall(object, multiValue, guard)) {
multiValue = null;
}
var index = -1,
props = keys(object),
length = props.length,
result = {};
while (++index < length) {
var key = props[index],
value = object[key];
if (multiValue) {
if (hasOwnProperty.call(result, value)) {
result[value].push(key);
} else {
result[value] = [key];
}
}
else {
result[value] = key;
}
}
return result;
}
/**
* Creates an array of the own enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects. See the
* [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.keys)
* for more details.
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.keys(new Foo);
* // => ['a', 'b'] (iteration order is not guaranteed)
*
* _.keys('hi');
* // => ['0', '1']
*/
var keys = !nativeKeys ? shimKeys : function(object) {
var Ctor = object == null ? null : object.constructor;
if ((typeof Ctor == 'function' && Ctor.prototype === object) ||
(typeof object != 'function' && isArrayLike(object))) {
return shimKeys(object);
}
return isObject(object) ? nativeKeys(object) : [];
};
/**
* Creates an array of the own and inherited enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects.
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.keysIn(new Foo);
* // => ['a', 'b', 'c'] (iteration order is not guaranteed)
*/
function keysIn(object) {
if (object == null) {
return [];
}
if (!isObject(object)) {
object = Object(object);
}
var length = object.length;
length = (length && isLength(length) &&
(isArray(object) || isArguments(object)) && length) || 0;
var Ctor = object.constructor,
index = -1,
isProto = typeof Ctor == 'function' && Ctor.prototype === object,
result = Array(length),
skipIndexes = length > 0;
while (++index < length) {
result[index] = (index + '');
}
for (var key in object) {
if (!(skipIndexes && isIndex(key, length)) &&
!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
result.push(key);
}
}
return result;
}
/**
* The opposite of `_.mapValues`; this method creates an object with the
* same values as `object` and keys generated by running each own enumerable
* property of `object` through `iteratee`.
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The object to iterate over.
* @param {Function|Object|string} [iteratee=_.identity] The function invoked
* per iteration.
* @param {*} [thisArg] The `this` binding of `iteratee`.
* @returns {Object} Returns the new mapped object.
* @example
*
* _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
* return key + value;
* });
* // => { 'a1': 1, 'b2': 2 }
*/
var mapKeys = createObjectMapper(true);
/**
* Creates an object with the same keys as `object` and values generated by
* running each own enumerable property of `object` through `iteratee`. The
* iteratee function is bound to `thisArg` and invoked with three arguments:
* (value, key, object).
*
* If a property name is provided for `iteratee` the created `_.property`
* style callback returns the property value of the given element.
*
* If a value is also provided for `thisArg` the created `_.matchesProperty`
* style callback returns `true` for elements that have a matching property
* value, else `false`.
*
* If an object is provided for `iteratee` the created `_.matches` style
* callback returns `true` for elements that have the properties of the given
* object, else `false`.
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The object to iterate over.
* @param {Function|Object|string} [iteratee=_.identity] The function invoked
* per iteration.
* @param {*} [thisArg] The `this` binding of `iteratee`.
* @returns {Object} Returns the new mapped object.
* @example
*
* _.mapValues({ 'a': 1, 'b': 2 }, function(n) {
* return n * 3;
* });
* // => { 'a': 3, 'b': 6 }
*
* var users = {
* 'fred': { 'user': 'fred', 'age': 40 },
* 'pebbles': { 'user': 'pebbles', 'age': 1 }
* };
*
* // using the `_.property` callback shorthand
* _.mapValues(users, 'age');
* // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
*/
var mapValues = createObjectMapper();
/**
* Recursively merges own enumerable properties of the source object(s), that
* don't resolve to `undefined` into the destination object. Subsequent sources
* overwrite property assignments of previous sources. If `customizer` is
* provided it is invoked to produce the merged values of the destination and
* source properties. If `customizer` returns `undefined` merging is handled
* by the method instead. The `customizer` is bound to `thisArg` and invoked
* with five arguments: (objectValue, sourceValue, key, object, source).
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The destination object.
* @param {...Object} [sources] The source objects.
* @param {Function} [customizer] The function to customize assigned values.
* @param {*} [thisArg] The `this` binding of `customizer`.
* @returns {Object} Returns `object`.
* @example
*
* var users = {
* 'data': [{ 'user': 'barney' }, { 'user': 'fred' }]
* };
*
* var ages = {
* 'data': [{ 'age': 36 }, { 'age': 40 }]
* };
*
* _.merge(users, ages);
* // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] }
*
* // using a customizer callback
* var object = {
* 'fruits': ['apple'],
* 'vegetables': ['beet']
* };
*
* var other = {
* 'fruits': ['banana'],
* 'vegetables': ['carrot']
* };
*
* _.merge(object, other, function(a, b) {
* if (_.isArray(a)) {
* return a.concat(b);
* }
* });
* // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] }
*/
var merge = createAssigner(baseMerge);
/**
* The opposite of `_.pick`; this method creates an object composed of the
* own and inherited enumerable properties of `object` that are not omitted.
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The source object.
* @param {Function|...(string|string[])} [predicate] The function invoked per
* iteration or property names to omit, specified as individual property
* names or arrays of property names.
* @param {*} [thisArg] The `this` binding of `predicate`.
* @returns {Object} Returns the new object.
* @example
*
* var object = { 'user': 'fred', 'age': 40 };
*
* _.omit(object, 'age');
* // => { 'user': 'fred' }
*
* _.omit(object, _.isNumber);
* // => { 'user': 'fred' }
*/
var omit = restParam(function(object, props) {
if (object == null) {
return {};
}
if (typeof props[0] != 'function') {
var props = arrayMap(baseFlatten(props), String);
return pickByArray(object, baseDifference(keysIn(object), props));
}
var predicate = bindCallback(props[0], props[1], 3);
return pickByCallback(object, function(value, key, object) {
return !predicate(value, key, object);
});
});
/**
* Creates a two dimensional array of the key-value pairs for `object`,
* e.g. `[[key1, value1], [key2, value2]]`.
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the new array of key-value pairs.
* @example
*
* _.pairs({ 'barney': 36, 'fred': 40 });
* // => [['barney', 36], ['fred', 40]] (iteration order is not guaranteed)
*/
function pairs(object) {
object = toObject(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;
}
/**
* Creates an object composed of the picked `object` properties. Property
* names may be specified as individual arguments or as arrays of property
* names. If `predicate` is provided it is invoked for each property of `object`
* picking the properties `predicate` returns truthy for. The predicate is
* bound to `thisArg` and invoked with three arguments: (value, key, object).
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The source object.
* @param {Function|...(string|string[])} [predicate] The function invoked per
* iteration or property names to pick, specified as individual property
* names or arrays of property names.
* @param {*} [thisArg] The `this` binding of `predicate`.
* @returns {Object} Returns the new object.
* @example
*
* var object = { 'user': 'fred', 'age': 40 };
*
* _.pick(object, 'user');
* // => { 'user': 'fred' }
*
* _.pick(object, _.isString);
* // => { 'user': 'fred' }
*/
var pick = restParam(function(object, props) {
if (object == null) {
return {};
}
return typeof props[0] == 'function'
? pickByCallback(object, bindCallback(props[0], props[1], 3))
: pickByArray(object, baseFlatten(props));
});
/**
* This method is like `_.get` except that if the resolved value is a function
* it is invoked with the `this` binding of its parent object and its result
* is returned.
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path of the property to resolve.
* @param {*} [defaultValue] The value returned if the resolved value is `undefined`.
* @returns {*} Returns the resolved value.
* @example
*
* var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
*
* _.result(object, 'a[0].b.c1');
* // => 3
*
* _.result(object, 'a[0].b.c2');
* // => 4
*
* _.result(object, 'a.b.c', 'default');
* // => 'default'
*
* _.result(object, 'a.b.c', _.constant('default'));
* // => 'default'
*/
function result(object, path, defaultValue) {
var result = object == null ? undefined : object[path];
if (result === undefined) {
if (object != null && !isKey(path, object)) {
path = toPath(path);
object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
result = object == null ? undefined : object[last(path)];
}
result = result === undefined ? defaultValue : result;
}
return isFunction(result) ? result.call(object) : result;
}
/**
* Sets the property value of `path` on `object`. If a portion of `path`
* does not exist it is created.
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The object to augment.
* @param {Array|string} path The path of the property to set.
* @param {*} value The value to set.
* @returns {Object} Returns `object`.
* @example
*
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
*
* _.set(object, 'a[0].b.c', 4);
* console.log(object.a[0].b.c);
* // => 4
*
* _.set(object, 'x[0].y.z', 5);
* console.log(object.x[0].y.z);
* // => 5
*/
function set(object, path, value) {
if (object == null) {
return object;
}
var pathKey = (path + '');
path = (object[pathKey] != null || isKey(path, object)) ? [pathKey] : toPath(path);
var index = -1,
length = path.length,
lastIndex = length - 1,
nested = object;
while (nested != null && ++index < length) {
var key = path[index];
if (isObject(nested)) {
if (index == lastIndex) {
nested[key] = value;
} else if (nested[key] == null) {
nested[key] = isIndex(path[index + 1]) ? [] : {};
}
}
nested = nested[key];
}
return object;
}
/**
* An alternative to `_.reduce`; this method transforms `object` to a new
* `accumulator` object which is the result of running each of its own enumerable
* properties through `iteratee`, with each invocation potentially mutating
* the `accumulator` object. The `iteratee` is bound to `thisArg` and invoked
* with four arguments: (accumulator, value, key, object). Iteratee functions
* may exit iteration early by explicitly returning `false`.
*
* @static
* @memberOf _
* @category Object
* @param {Array|Object} object The object to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @param {*} [accumulator] The custom accumulator value.
* @param {*} [thisArg] The `this` binding of `iteratee`.
* @returns {*} Returns the accumulated value.
* @example
*
* _.transform([2, 3, 4], function(result, n) {
* result.push(n *= n);
* return n % 2 == 0;
* });
* // => [4, 9]
*
* _.transform({ 'a': 1, 'b': 2 }, function(result, n, key) {
* result[key] = n * 3;
* });
* // => { 'a': 3, 'b': 6 }
*/
function transform(object, iteratee, accumulator, thisArg) {
var isArr = isArray(object) || isTypedArray(object);
iteratee = getCallback(iteratee, thisArg, 4);
if (accumulator == null) {
if (isArr || isObject(object)) {
var Ctor = object.constructor;
if (isArr) {
accumulator = isArray(object) ? new Ctor : [];
} else {
accumulator = baseCreate(isFunction(Ctor) ? Ctor.prototype : null);
}
} else {
accumulator = {};
}
}
(isArr ? arrayEach : baseForOwn)(object, function(value, index, object) {
return iteratee(accumulator, value, index, object);
});
return accumulator;
}
/**
* Creates an array of the own enumerable property values of `object`.
*
* **Note:** Non-object values are coerced to objects.
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property values.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.values(new Foo);
* // => [1, 2] (iteration order is not guaranteed)
*
* _.values('hi');
* // => ['h', 'i']
*/
function values(object) {
return baseValues(object, keys(object));
}
/**
* Creates an array of the own and inherited enumerable property values
* of `object`.
*
* **Note:** Non-object values are coerced to objects.
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property values.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.valuesIn(new Foo);
* // => [1, 2, 3] (iteration order is not guaranteed)
*/
function valuesIn(object) {
return baseValues(object, keysIn(object));
}
/*------------------------------------------------------------------------*/
/**
* Checks if `n` is between `start` and up to but not including, `end`. If
* `end` is not specified it is set to `start` with `start` then set to `0`.
*
* @static
* @memberOf _
* @category Number
* @param {number} n The number to check.
* @param {number} [start=0] The start of the range.
* @param {number} end The end of the range.
* @returns {boolean} Returns `true` if `n` is in the range, else `false`.
* @example
*
* _.inRange(3, 2, 4);
* // => true
*
* _.inRange(4, 8);
* // => true
*
* _.inRange(4, 2);
* // => false
*
* _.inRange(2, 2);
* // => false
*
* _.inRange(1.2, 2);
* // => true
*
* _.inRange(5.2, 4);
* // => false
*/
function inRange(value, start, end) {
start = +start || 0;
if (typeof end === 'undefined') {
end = start;
start = 0;
} else {
end = +end || 0;
}
return value >= nativeMin(start, end) && value < nativeMax(start, end);
}
/**
* Produces a random number between `min` and `max` (inclusive). If only one
* argument is provided a number between `0` and the given number is returned.
* If `floating` is `true`, or either `min` or `max` are floats, a floating-point
* number is returned instead of an integer.
*
* @static
* @memberOf _
* @category Number
* @param {number} [min=0] The minimum possible value.
* @param {number} [max=1] The maximum possible value.
* @param {boolean} [floating] Specify returning a floating-point number.
* @returns {number} Returns the random number.
* @example
*
* _.random(0, 5);
* // => an integer between 0 and 5
*
* _.random(5);
* // => also an integer between 0 and 5
*
* _.random(5, true);
* // => a floating-point number between 0 and 5
*
* _.random(1.2, 5.2);
* // => a floating-point number between 1.2 and 5.2
*/
function random(min, max, floating) {
if (floating && isIterateeCall(min, max, floating)) {
max = floating = null;
}
var noMin = min == null,
noMax = max == null;
if (floating == null) {
if (noMax && typeof min == 'boolean') {
floating = min;
min = 1;
}
else if (typeof max == 'boolean') {
floating = max;
noMax = true;
}
}
if (noMin && noMax) {
max = 1;
noMax = false;
}
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);
}
/*------------------------------------------------------------------------*/
/**
* Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
*
* @static
* @memberOf _
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the camel cased string.
* @example
*
* _.camelCase('Foo Bar');
* // => 'fooBar'
*
* _.camelCase('--foo-bar');
* // => 'fooBar'
*
* _.camelCase('__foo_bar__');
* // => 'fooBar'
*/
var camelCase = createCompounder(function(result, word, index) {
word = word.toLowerCase();
return result + (index ? (word.charAt(0).toUpperCase() + word.slice(1)) : word);
});
/**
* Capitalizes the first character of `string`.
*
* @static
* @memberOf _
* @category String
* @param {string} [string=''] The string to capitalize.
* @returns {string} Returns the capitalized string.
* @example
*
* _.capitalize('fred');
* // => 'Fred'
*/
function capitalize(string) {
string = baseToString(string);
return string && (string.charAt(0).toUpperCase() + string.slice(1));
}
/**
* Deburrs `string` by converting [latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
* to basic latin letters and removing [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
*
* @static
* @memberOf _
* @category String
* @param {string} [string=''] The string to deburr.
* @returns {string} Returns the deburred string.
* @example
*
* _.deburr('déjà vu');
* // => 'deja vu'
*/
function deburr(string) {
string = baseToString(string);
return string && string.replace(reLatin1, deburrLetter).replace(reComboMark, '');
}
/**
* Checks if `string` ends with the given target string.
*
* @static
* @memberOf _
* @category String
* @param {string} [string=''] The string to search.
* @param {string} [target] The string to search for.
* @param {number} [position=string.length] The position to search from.
* @returns {boolean} Returns `true` if `string` ends with `target`, else `false`.
* @example
*
* _.endsWith('abc', 'c');
* // => true
*
* _.endsWith('abc', 'b');
* // => false
*
* _.endsWith('abc', 'b', 2);
* // => true
*/
function endsWith(string, target, position) {
string = baseToString(string);
target = (target + '');
var length = string.length;
position = position === undefined
? length
: nativeMin(position < 0 ? 0 : (+position || 0), length);
position -= target.length;
return position >= 0 && string.indexOf(target, position) == position;
}
/**
* Converts the characters "&", "<", ">", '"', "'", and "\`", in `string` to
* their corresponding HTML entities.
*
* **Note:** No other characters are escaped. To escape additional characters
* use a third-party library like [_he_](https://mths.be/he).
*
* Though the ">" character is escaped for symmetry, characters like
* ">" and "/" don't need escaping in HTML and have no special meaning
* unless they're part of a tag or unquoted attribute value.
* See [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
* (under "semi-related fun fact") for more details.
*
* Backticks are escaped because in Internet Explorer < 9, they can break out
* of attribute values or HTML comments. See [#59](https://html5sec.org/#59),
* [#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and
* [#133](https://html5sec.org/#133) of the [HTML5 Security Cheatsheet](https://html5sec.org/)
* for more details.
*
* When working with HTML you should always [quote attribute values](http://wonko.com/post/html-escaping)
* to reduce XSS vectors.
*
* @static
* @memberOf _
* @category String
* @param {string} [string=''] The string to escape.
* @returns {string} Returns the escaped string.
* @example
*
* _.escape('fred, barney, & pebbles');
* // => 'fred, barney, & pebbles'
*/
function escape(string) {
// Reset `lastIndex` because in IE < 9 `String#replace` does not.
string = baseToString(string);
return (string && reHasUnescapedHtml.test(string))
? string.replace(reUnescapedHtml, escapeHtmlChar)
: string;
}
/**
* Escapes the `RegExp` special characters "\", "/", "^", "$", ".", "|", "?",
* "*", "+", "(", ")", "[", "]", "{" and "}" in `string`.
*
* @static
* @memberOf _
* @category String
* @param {string} [string=''] The string to escape.
* @returns {string} Returns the escaped string.
* @example
*
* _.escapeRegExp('[lodash](https://lodash.com/)');
* // => '\[lodash\]\(https:\/\/lodash\.com\/\)'
*/
function escapeRegExp(string) {
string = baseToString(string);
return (string && reHasRegExpChars.test(string))
? string.replace(reRegExpChars, '\\$&')
: string;
}
/**
* Converts `string` to [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
*
* @static
* @memberOf _
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the kebab cased string.
* @example
*
* _.kebabCase('Foo Bar');
* // => 'foo-bar'
*
* _.kebabCase('fooBar');
* // => 'foo-bar'
*
* _.kebabCase('__foo_bar__');
* // => 'foo-bar'
*/
var kebabCase = createCompounder(function(result, word, index) {
return result + (index ? '-' : '') + word.toLowerCase();
});
/**
* Pads `string` on the left and right sides if it's shorter than `length`.
* Padding characters are truncated if they can't be evenly divided by `length`.
*
* @static
* @memberOf _
* @category String
* @param {string} [string=''] The string to pad.
* @param {number} [length=0] The padding length.
* @param {string} [chars=' '] The string used as padding.
* @returns {string} Returns the padded string.
* @example
*
* _.pad('abc', 8);
* // => ' abc '
*
* _.pad('abc', 8, '_-');
* // => '_-abc_-_'
*
* _.pad('abc', 3);
* // => 'abc'
*/
function pad(string, length, chars) {
string = baseToString(string);
length = +length;
var strLength = string.length;
if (strLength >= length || !nativeIsFinite(length)) {
return string;
}
var mid = (length - strLength) / 2,
leftLength = floor(mid),
rightLength = ceil(mid);
chars = createPadding('', rightLength, chars);
return chars.slice(0, leftLength) + string + chars;
}
/**
* Pads `string` on the left side if it's shorter than `length`. Padding
* characters are truncated if they exceed `length`.
*
* @static
* @memberOf _
* @category String
* @param {string} [string=''] The string to pad.
* @param {number} [length=0] The padding length.
* @param {string} [chars=' '] The string used as padding.
* @returns {string} Returns the padded string.
* @example
*
* _.padLeft('abc', 6);
* // => ' abc'
*
* _.padLeft('abc', 6, '_-');
* // => '_-_abc'
*
* _.padLeft('abc', 3);
* // => 'abc'
*/
var padLeft = createPadDir();
/**
* Pads `string` on the right side if it's shorter than `length`. Padding
* characters are truncated if they exceed `length`.
*
* @static
* @memberOf _
* @category String
* @param {string} [string=''] The string to pad.
* @param {number} [length=0] The padding length.
* @param {string} [chars=' '] The string used as padding.
* @returns {string} Returns the padded string.
* @example
*
* _.padRight('abc', 6);
* // => 'abc '
*
* _.padRight('abc', 6, '_-');
* // => 'abc_-_'
*
* _.padRight('abc', 3);
* // => 'abc'
*/
var padRight = createPadDir(true);
/**
* Converts `string` to an integer of the specified radix. If `radix` is
* `undefined` or `0`, a `radix` of `10` is used unless `value` is a hexadecimal,
* in which case a `radix` of `16` is used.
*
* **Note:** This method aligns with the [ES5 implementation](https://es5.github.io/#E)
* of `parseInt`.
*
* @static
* @memberOf _
* @category String
* @param {string} string The string to convert.
* @param {number} [radix] The radix to interpret `value` by.
* @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
* @returns {number} Returns the converted integer.
* @example
*
* _.parseInt('08');
* // => 8
*
* _.map(['6', '08', '10'], _.parseInt);
* // => [6, 8, 10]
*/
function parseInt(string, radix, guard) {
if (guard && isIterateeCall(string, radix, guard)) {
radix = 0;
}
return nativeParseInt(string, radix);
}
// Fallback for environments with pre-ES5 implementations.
if (nativeParseInt(whitespace + '08') != 8) {
parseInt = function(string, radix, guard) {
// Firefox < 21 and Opera < 15 follow ES3 for `parseInt`.
// Chrome fails to trim leading <BOM> whitespace characters.
// See https://code.google.com/p/v8/issues/detail?id=3109 for more details.
if (guard ? isIterateeCall(string, radix, guard) : radix == null) {
radix = 0;
} else if (radix) {
radix = +radix;
}
string = trim(string);
return nativeParseInt(string, radix || (reHasHexPrefix.test(string) ? 16 : 10));
};
}
/**
* Repeats the given string `n` times.
*
* @static
* @memberOf _
* @category String
* @param {string} [string=''] The string to repeat.
* @param {number} [n=0] The number of times to repeat the string.
* @returns {string} Returns the repeated string.
* @example
*
* _.repeat('*', 3);
* // => '***'
*
* _.repeat('abc', 2);
* // => 'abcabc'
*
* _.repeat('abc', 0);
* // => ''
*/
function repeat(string, n) {
var result = '';
string = baseToString(string);
n = +n;
if (n < 1 || !string || !nativeIsFinite(n)) {
return result;
}
// Leverage the exponentiation by squaring algorithm for a faster repeat.
// See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
do {
if (n % 2) {
result += string;
}
n = floor(n / 2);
string += string;
} while (n);
return result;
}
/**
* Converts `string` to [snake case](https://en.wikipedia.org/wiki/Snake_case).
*
* @static
* @memberOf _
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the snake cased string.
* @example
*
* _.snakeCase('Foo Bar');
* // => 'foo_bar'
*
* _.snakeCase('fooBar');
* // => 'foo_bar'
*
* _.snakeCase('--foo-bar');
* // => 'foo_bar'
*/
var snakeCase = createCompounder(function(result, word, index) {
return result + (index ? '_' : '') + word.toLowerCase();
});
/**
* Converts `string` to [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
*
* @static
* @memberOf _
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the start cased string.
* @example
*
* _.startCase('--foo-bar');
* // => 'Foo Bar'
*
* _.startCase('fooBar');
* // => 'Foo Bar'
*
* _.startCase('__foo_bar__');
* // => 'Foo Bar'
*/
var startCase = createCompounder(function(result, word, index) {
return result + (index ? ' ' : '') + (word.charAt(0).toUpperCase() + word.slice(1));
});
/**
* Checks if `string` starts with the given target string.
*
* @static
* @memberOf _
* @category String
* @param {string} [string=''] The string to search.
* @param {string} [target] The string to search for.
* @param {number} [position=0] The position to search from.
* @returns {boolean} Returns `true` if `string` starts with `target`, else `false`.
* @example
*
* _.startsWith('abc', 'a');
* // => true
*
* _.startsWith('abc', 'b');
* // => false
*
* _.startsWith('abc', 'b', 1);
* // => true
*/
function startsWith(string, target, position) {
string = baseToString(string);
position = position == null
? 0
: nativeMin(position < 0 ? 0 : (+position || 0), string.length);
return string.lastIndexOf(target, position) == position;
}
/**
* Creates a compiled template function that can interpolate data properties
* in "interpolate" delimiters, HTML-escape interpolated data properties in
* "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
* properties may be accessed as free variables in the template. If a setting
* object is provided it takes precedence over `_.templateSettings` values.
*
* **Note:** In the development build `_.template` utilizes
* [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
* for easier debugging.
*
* For more information on precompiling templates see
* [lodash's custom builds documentation](https://lodash.com/custom-builds).
*
* For more information on Chrome extension sandboxes see
* [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
*
* @static
* @memberOf _
* @category String
* @param {string} [string=''] The template string.
* @param {Object} [options] The options object.
* @param {RegExp} [options.escape] The HTML "escape" delimiter.
* @param {RegExp} [options.evaluate] The "evaluate" delimiter.
* @param {Object} [options.imports] An object to import into the template as free variables.
* @param {RegExp} [options.interpolate] The "interpolate" delimiter.
* @param {string} [options.sourceURL] The sourceURL of the template's compiled source.
* @param {string} [options.variable] The data object variable name.
* @param- {Object} [otherOptions] Enables the legacy `options` param signature.
* @returns {Function} Returns the compiled template function.
* @example
*
* // using the "interpolate" delimiter to create a compiled template
* var compiled = _.template('hello <%= user %>!');
* compiled({ 'user': 'fred' });
* // => 'hello fred!'
*
* // using the HTML "escape" delimiter to escape data property values
* var compiled = _.template('<b><%- value %></b>');
* compiled({ 'value': '<script>' });
* // => '<b><script></b>'
*
* // using the "evaluate" delimiter to execute JavaScript and generate HTML
* var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
* compiled({ 'users': ['fred', 'barney'] });
* // => '<li>fred</li><li>barney</li>'
*
* // using the internal `print` function in "evaluate" delimiters
* var compiled = _.template('<% print("hello " + user); %>!');
* compiled({ 'user': 'barney' });
* // => 'hello barney!'
*
* // using the ES delimiter as an alternative to the default "interpolate" delimiter
* var compiled = _.template('hello ${ user }!');
* compiled({ 'user': 'pebbles' });
* // => 'hello pebbles!'
*
* // using custom template delimiters
* _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
* var compiled = _.template('hello {{ user }}!');
* compiled({ 'user': 'mustache' });
* // => 'hello mustache!'
*
* // using backslashes to treat delimiters as plain text
* var compiled = _.template('<%= "\\<%- value %\\>" %>');
* compiled({ 'value': 'ignored' });
* // => '<%- value %>'
*
* // using the `imports` option to import `jQuery` as `jq`
* var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
* var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
* compiled({ 'users': ['fred', 'barney'] });
* // => '<li>fred</li><li>barney</li>'
*
* // using the `sourceURL` option to specify a custom sourceURL for the template
* var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
* compiled(data);
* // => find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector
*
* // using the `variable` option to ensure a with-statement isn't used in the compiled template
* var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
* compiled.source;
* // => function(data) {
* // var __t, __p = '';
* // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
* // return __p;
* // }
*
* // using the `source` property to inline compiled templates for meaningful
* // line numbers in error messages and a stack trace
* fs.writeFileSync(path.join(cwd, 'jst.js'), '\
* var JST = {\
* "main": ' + _.template(mainText).source + '\
* };\
* ');
*/
function template(string, options, otherOptions) {
// Based on John Resig's `tmpl` implementation (http://ejohn.org/blog/javascript-micro-templating/)
// and Laura Doktorova's doT.js (https://github.com/olado/doT).
var settings = lodash.templateSettings;
if (otherOptions && isIterateeCall(string, options, otherOptions)) {
options = otherOptions = null;
}
string = baseToString(string);
options = assignWith(baseAssign({}, otherOptions || options), settings, assignOwnDefaults);
var imports = assignWith(baseAssign({}, options.imports), settings.imports, assignOwnDefaults),
importsKeys = keys(imports),
importsValues = baseValues(imports, importsKeys);
var isEscaping,
isEvaluating,
index = 0,
interpolate = options.interpolate || reNoMatch,
source = "__p += '";
// Compile the regexp to match each delimiter.
var reDelimiters = RegExp(
(options.escape || reNoMatch).source + '|' +
interpolate.source + '|' +
(interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
(options.evaluate || reNoMatch).source + '|$'
, 'g');
// Use a sourceURL for easier debugging.
var sourceURL = '//# sourceURL=' +
('sourceURL' in options
? options.sourceURL
: ('lodash.templateSources[' + (++templateCounter) + ']')
) + '\n';
string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
interpolateValue || (interpolateValue = esTemplateValue);
// Escape characters that can't be included in string literals.
source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
// Replace delimiters with snippets.
if (escapeValue) {
isEscaping = true;
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;
// The JS engine embedded in Adobe products requires returning the `match`
// string in order to produce the correct `offset` value.
return match;
});
source += "';\n";
// If `variable` is not specified wrap a with-statement around the generated
// code to add the data object to the top of the scope chain.
var variable = options.variable;
if (!variable) {
source = 'with (obj) {\n' + source + '\n}\n';
}
// Cleanup code by stripping empty strings.
source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
.replace(reEmptyStringMiddle, '$1')
.replace(reEmptyStringTrailing, '$1;');
// Frame code as the function body.
source = 'function(' + (variable || 'obj') + ') {\n' +
(variable
? ''
: 'obj || (obj = {});\n'
) +
"var __t, __p = ''" +
(isEscaping
? ', __e = _.escape'
: ''
) +
(isEvaluating
? ', __j = Array.prototype.join;\n' +
"function print() { __p += __j.call(arguments, '') }\n"
: ';\n'
) +
source +
'return __p\n}';
var result = attempt(function() {
return Function(importsKeys, sourceURL + 'return ' + source).apply(undefined, importsValues);
});
// Provide the compiled function's source by its `toString` method or
// the `source` property as a convenience for inlining compiled templates.
result.source = source;
if (isError(result)) {
throw result;
}
return result;
}
/**
* Removes leading and trailing whitespace or specified characters from `string`.
*
* @static
* @memberOf _
* @category String
* @param {string} [string=''] The string to trim.
* @param {string} [chars=whitespace] The characters to trim.
* @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
* @returns {string} Returns the trimmed string.
* @example
*
* _.trim(' abc ');
* // => 'abc'
*
* _.trim('-_-abc-_-', '_-');
* // => 'abc'
*
* _.map([' foo ', ' bar '], _.trim);
* // => ['foo', 'bar']
*/
function trim(string, chars, guard) {
var value = string;
string = baseToString(string);
if (!string) {
return string;
}
if (guard ? isIterateeCall(value, chars, guard) : chars == null) {
return string.slice(trimmedLeftIndex(string), trimmedRightIndex(string) + 1);
}
chars = (chars + '');
return string.slice(charsLeftIndex(string, chars), charsRightIndex(string, chars) + 1);
}
/**
* Removes leading whitespace or specified characters from `string`.
*
* @static
* @memberOf _
* @category String
* @param {string} [string=''] The string to trim.
* @param {string} [chars=whitespace] The characters to trim.
* @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
* @returns {string} Returns the trimmed string.
* @example
*
* _.trimLeft(' abc ');
* // => 'abc '
*
* _.trimLeft('-_-abc-_-', '_-');
* // => 'abc-_-'
*/
function trimLeft(string, chars, guard) {
var value = string;
string = baseToString(string);
if (!string) {
return string;
}
if (guard ? isIterateeCall(value, chars, guard) : chars == null) {
return string.slice(trimmedLeftIndex(string));
}
return string.slice(charsLeftIndex(string, (chars + '')));
}
/**
* Removes trailing whitespace or specified characters from `string`.
*
* @static
* @memberOf _
* @category String
* @param {string} [string=''] The string to trim.
* @param {string} [chars=whitespace] The characters to trim.
* @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
* @returns {string} Returns the trimmed string.
* @example
*
* _.trimRight(' abc ');
* // => ' abc'
*
* _.trimRight('-_-abc-_-', '_-');
* // => '-_-abc'
*/
function trimRight(string, chars, guard) {
var value = string;
string = baseToString(string);
if (!string) {
return string;
}
if (guard ? isIterateeCall(value, chars, guard) : chars == null) {
return string.slice(0, trimmedRightIndex(string) + 1);
}
return string.slice(0, charsRightIndex(string, (chars + '')) + 1);
}
/**
* Truncates `string` if it's longer than the given maximum string length.
* The last characters of the truncated string are replaced with the omission
* string which defaults to "...".
*
* @static
* @memberOf _
* @category String
* @param {string} [string=''] The string to truncate.
* @param {Object|number} [options] The options object or maximum string length.
* @param {number} [options.length=30] The maximum string length.
* @param {string} [options.omission='...'] The string to indicate text is omitted.
* @param {RegExp|string} [options.separator] The separator pattern to truncate to.
* @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
* @returns {string} Returns the truncated string.
* @example
*
* _.trunc('hi-diddly-ho there, neighborino');
* // => 'hi-diddly-ho there, neighbo...'
*
* _.trunc('hi-diddly-ho there, neighborino', 24);
* // => 'hi-diddly-ho there, n...'
*
* _.trunc('hi-diddly-ho there, neighborino', {
* 'length': 24,
* 'separator': ' '
* });
* // => 'hi-diddly-ho there,...'
*
* _.trunc('hi-diddly-ho there, neighborino', {
* 'length': 24,
* 'separator': /,? +/
* });
* // => 'hi-diddly-ho there...'
*
* _.trunc('hi-diddly-ho there, neighborino', {
* 'omission': ' [...]'
* });
* // => 'hi-diddly-ho there, neig [...]'
*/
function trunc(string, options, guard) {
if (guard && isIterateeCall(string, options, guard)) {
options = null;
}
var length = DEFAULT_TRUNC_LENGTH,
omission = DEFAULT_TRUNC_OMISSION;
if (options != null) {
if (isObject(options)) {
var separator = 'separator' in options ? options.separator : separator;
length = 'length' in options ? (+options.length || 0) : length;
omission = 'omission' in options ? baseToString(options.omission) : omission;
} else {
length = +options || 0;
}
}
string = baseToString(string);
if (length >= string.length) {
return string;
}
var end = length - omission.length;
if (end < 1) {
return omission;
}
var result = string.slice(0, end);
if (separator == null) {
return result + omission;
}
if (isRegExp(separator)) {
if (string.slice(end).search(separator)) {
var match,
newEnd,
substring = string.slice(0, end);
if (!separator.global) {
separator = RegExp(separator.source, (reFlags.exec(separator) || '') + 'g');
}
separator.lastIndex = 0;
while ((match = separator.exec(substring))) {
newEnd = match.index;
}
result = result.slice(0, newEnd == null ? end : newEnd);
}
} else if (string.indexOf(separator, end) != end) {
var index = result.lastIndexOf(separator);
if (index > -1) {
result = result.slice(0, index);
}
}
return result + omission;
}
/**
* The inverse of `_.escape`; this method converts the HTML entities
* `&`, `<`, `>`, `"`, `'`, and ``` in `string` to their
* corresponding characters.
*
* **Note:** No other HTML entities are unescaped. To unescape additional HTML
* entities use a third-party library like [_he_](https://mths.be/he).
*
* @static
* @memberOf _
* @category String
* @param {string} [string=''] The string to unescape.
* @returns {string} Returns the unescaped string.
* @example
*
* _.unescape('fred, barney, & pebbles');
* // => 'fred, barney, & pebbles'
*/
function unescape(string) {
string = baseToString(string);
return (string && reHasEscapedHtml.test(string))
? string.replace(reEscapedHtml, unescapeHtmlChar)
: string;
}
/**
* Splits `string` into an array of its words.
*
* @static
* @memberOf _
* @category String
* @param {string} [string=''] The string to inspect.
* @param {RegExp|string} [pattern] The pattern to match words.
* @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
* @returns {Array} Returns the words of `string`.
* @example
*
* _.words('fred, barney, & pebbles');
* // => ['fred', 'barney', 'pebbles']
*
* _.words('fred, barney, & pebbles', /[^, ]+/g);
* // => ['fred', 'barney', '&', 'pebbles']
*/
function words(string, pattern, guard) {
if (guard && isIterateeCall(string, pattern, guard)) {
pattern = null;
}
string = baseToString(string);
return string.match(pattern || reWords) || [];
}
/*------------------------------------------------------------------------*/
/**
* Attempts to invoke `func`, returning either the result or the caught error
* object. Any additional arguments are provided to `func` when it is invoked.
*
* @static
* @memberOf _
* @category Utility
* @param {Function} func The function to attempt.
* @returns {*} Returns the `func` result or error object.
* @example
*
* // avoid throwing errors for invalid selectors
* var elements = _.attempt(function(selector) {
* return document.querySelectorAll(selector);
* }, '>_>');
*
* if (_.isError(elements)) {
* elements = [];
* }
*/
var attempt = restParam(function(func, args) {
try {
return func.apply(undefined, args);
} catch(e) {
return isError(e) ? e : new Error(e);
}
});
/**
* Creates a function that invokes `func` with the `this` binding of `thisArg`
* and arguments of the created function. If `func` is a property name the
* created callback returns the property value for a given element. If `func`
* is an object the created callback returns `true` for elements that contain
* the equivalent object properties, otherwise it returns `false`.
*
* @static
* @memberOf _
* @alias iteratee
* @category Utility
* @param {*} [func=_.identity] The value to convert to a callback.
* @param {*} [thisArg] The `this` binding of `func`.
* @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
* @returns {Function} Returns the callback.
* @example
*
* var users = [
* { 'user': 'barney', 'age': 36 },
* { 'user': 'fred', 'age': 40 }
* ];
*
* // wrap to create custom callback shorthands
* _.callback = _.wrap(_.callback, function(callback, func, thisArg) {
* var match = /^(.+?)__([gl]t)(.+)$/.exec(func);
* if (!match) {
* return callback(func, thisArg);
* }
* return function(object) {
* return match[2] == 'gt'
* ? object[match[1]] > match[3]
* : object[match[1]] < match[3];
* };
* });
*
* _.filter(users, 'age__gt36');
* // => [{ 'user': 'fred', 'age': 40 }]
*/
function callback(func, thisArg, guard) {
if (guard && isIterateeCall(func, thisArg, guard)) {
thisArg = null;
}
return isObjectLike(func)
? matches(func)
: baseCallback(func, thisArg);
}
/**
* Creates a function that returns `value`.
*
* @static
* @memberOf _
* @category Utility
* @param {*} value The value to return from the new function.
* @returns {Function} Returns the new function.
* @example
*
* var object = { 'user': 'fred' };
* var getter = _.constant(object);
*
* getter() === object;
* // => true
*/
function constant(value) {
return function() {
return value;
};
}
/**
* This method returns the first argument provided to it.
*
* @static
* @memberOf _
* @category Utility
* @param {*} value Any value.
* @returns {*} Returns `value`.
* @example
*
* var object = { 'user': 'fred' };
*
* _.identity(object) === object;
* // => true
*/
function identity(value) {
return value;
}
/**
* Creates a function that performs a deep comparison between a given object
* and `source`, returning `true` if the given object has equivalent property
* values, else `false`.
*
* **Note:** This method supports comparing arrays, booleans, `Date` objects,
* numbers, `Object` objects, regexes, and strings. Objects are compared by
* their own, not inherited, enumerable properties. For comparing a single
* own or inherited property value see `_.matchesProperty`.
*
* @static
* @memberOf _
* @category Utility
* @param {Object} source The object of property values to match.
* @returns {Function} Returns the new function.
* @example
*
* var users = [
* { 'user': 'barney', 'age': 36, 'active': true },
* { 'user': 'fred', 'age': 40, 'active': false }
* ];
*
* _.filter(users, _.matches({ 'age': 40, 'active': false }));
* // => [{ 'user': 'fred', 'age': 40, 'active': false }]
*/
function matches(source) {
return baseMatches(baseClone(source, true));
}
/**
* Creates a function that compares the property value of `path` on a given
* object to `value`.
*
* **Note:** This method supports comparing arrays, booleans, `Date` objects,
* numbers, `Object` objects, regexes, and strings. Objects are compared by
* their own, not inherited, enumerable properties.
*
* @static
* @memberOf _
* @category Utility
* @param {Array|string} path The path of the property to get.
* @param {*} srcValue The value to match.
* @returns {Function} Returns the new function.
* @example
*
* var users = [
* { 'user': 'barney' },
* { 'user': 'fred' }
* ];
*
* _.find(users, _.matchesProperty('user', 'fred'));
* // => { 'user': 'fred' }
*/
function matchesProperty(path, srcValue) {
return baseMatchesProperty(path, baseClone(srcValue, true));
}
/**
* Creates a function that invokes the method at `path` on a given object.
* Any additional arguments are provided to the invoked method.
*
* @static
* @memberOf _
* @category Utility
* @param {Array|string} path The path of the method to invoke.
* @param {...*} [args] The arguments to invoke the method with.
* @returns {Function} Returns the new function.
* @example
*
* var objects = [
* { 'a': { 'b': { 'c': _.constant(2) } } },
* { 'a': { 'b': { 'c': _.constant(1) } } }
* ];
*
* _.map(objects, _.method('a.b.c'));
* // => [2, 1]
*
* _.invoke(_.sortBy(objects, _.method(['a', 'b', 'c'])), 'a.b.c');
* // => [1, 2]
*/
var method = restParam(function(path, args) {
return function(object) {
return invokePath(object, path, args);
};
});
/**
* The opposite of `_.method`; this method creates a function that invokes
* the method at a given path on `object`. Any additional arguments are
* provided to the invoked method.
*
* @static
* @memberOf _
* @category Utility
* @param {Object} object The object to query.
* @param {...*} [args] The arguments to invoke the method with.
* @returns {Function} Returns the new function.
* @example
*
* var array = _.times(3, _.constant),
* object = { 'a': array, 'b': array, 'c': array };
*
* _.map(['a[2]', 'c[0]'], _.methodOf(object));
* // => [2, 0]
*
* _.map([['a', '2'], ['c', '0']], _.methodOf(object));
* // => [2, 0]
*/
var methodOf = restParam(function(object, args) {
return function(path) {
return invokePath(object, path, args);
};
});
/**
* Adds all own enumerable function properties of a source object to the
* destination object. If `object` is a function then methods are added to
* its prototype as well.
*
* **Note:** Use `_.runInContext` to create a pristine `lodash` function to
* avoid conflicts caused by modifying the original.
*
* @static
* @memberOf _
* @category Utility
* @param {Function|Object} [object=lodash] The destination object.
* @param {Object} source The object of functions to add.
* @param {Object} [options] The options object.
* @param {boolean} [options.chain=true] Specify whether the functions added
* are chainable.
* @returns {Function|Object} Returns `object`.
* @example
*
* function vowels(string) {
* return _.filter(string, function(v) {
* return /[aeiou]/i.test(v);
* });
* }
*
* _.mixin({ 'vowels': vowels });
* _.vowels('fred');
* // => ['e']
*
* _('fred').vowels().value();
* // => ['e']
*
* _.mixin({ 'vowels': vowels }, { 'chain': false });
* _('fred').vowels();
* // => ['e']
*/
function mixin(object, source, options) {
if (options == null) {
var isObj = isObject(source),
props = isObj ? keys(source) : null,
methodNames = (props && props.length) ? baseFunctions(source, props) : null;
if (!(methodNames ? methodNames.length : isObj)) {
methodNames = false;
options = source;
source = object;
object = this;
}
}
if (!methodNames) {
methodNames = baseFunctions(source, keys(source));
}
var chain = true,
index = -1,
isFunc = isFunction(object),
length = methodNames.length;
if (options === false) {
chain = false;
} else if (isObject(options) && 'chain' in options) {
chain = options.chain;
}
while (++index < length) {
var methodName = methodNames[index],
func = source[methodName];
object[methodName] = func;
if (isFunc) {
object.prototype[methodName] = (function(func) {
return function() {
var chainAll = this.__chain__;
if (chain || chainAll) {
var result = object(this.__wrapped__),
actions = result.__actions__ = arrayCopy(this.__actions__);
actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
result.__chain__ = chainAll;
return result;
}
var args = [this.value()];
push.apply(args, arguments);
return func.apply(object, args);
};
}(func));
}
}
return object;
}
/**
* Reverts the `_` variable to its previous value and returns a reference to
* the `lodash` function.
*
* @static
* @memberOf _
* @category Utility
* @returns {Function} Returns the `lodash` function.
* @example
*
* var lodash = _.noConflict();
*/
function noConflict() {
context._ = oldDash;
return this;
}
/**
* A no-operation function that returns `undefined` regardless of the
* arguments it receives.
*
* @static
* @memberOf _
* @category Utility
* @example
*
* var object = { 'user': 'fred' };
*
* _.noop(object) === undefined;
* // => true
*/
function noop() {
// No operation performed.
}
/**
* Creates a function that returns the property value at `path` on a
* given object.
*
* @static
* @memberOf _
* @category Utility
* @param {Array|string} path The path of the property to get.
* @returns {Function} Returns the new function.
* @example
*
* var objects = [
* { 'a': { 'b': { 'c': 2 } } },
* { 'a': { 'b': { 'c': 1 } } }
* ];
*
* _.map(objects, _.property('a.b.c'));
* // => [2, 1]
*
* _.pluck(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c');
* // => [1, 2]
*/
function property(path) {
return isKey(path) ? baseProperty(path) : basePropertyDeep(path);
}
/**
* The opposite of `_.property`; this method creates a function that returns
* the property value at a given path on `object`.
*
* @static
* @memberOf _
* @category Utility
* @param {Object} object The object to query.
* @returns {Function} Returns the new function.
* @example
*
* var array = [0, 1, 2],
* object = { 'a': array, 'b': array, 'c': array };
*
* _.map(['a[2]', 'c[0]'], _.propertyOf(object));
* // => [2, 0]
*
* _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
* // => [2, 0]
*/
function propertyOf(object) {
return function(path) {
return baseGet(object, toPath(path), path + '');
};
}
/**
* Creates an array of numbers (positive and/or negative) progressing from
* `start` up to, but not including, `end`. If `end` is not specified it is
* set to `start` with `start` then set to `0`. If `end` is less than `start`
* a zero-length range is created unless a negative `step` is specified.
*
* @static
* @memberOf _
* @category Utility
* @param {number} [start=0] The start of the range.
* @param {number} end The end of the range.
* @param {number} [step=1] The value to increment or decrement by.
* @returns {Array} Returns the new array of numbers.
* @example
*
* _.range(4);
* // => [0, 1, 2, 3]
*
* _.range(1, 5);
* // => [1, 2, 3, 4]
*
* _.range(0, 20, 5);
* // => [0, 5, 10, 15]
*
* _.range(0, -4, -1);
* // => [0, -1, -2, -3]
*
* _.range(1, 4, 0);
* // => [1, 1, 1]
*
* _.range(0);
* // => []
*/
function range(start, end, step) {
if (step && isIterateeCall(start, end, step)) {
end = step = null;
}
start = +start || 0;
step = step == null ? 1 : (+step || 0);
if (end == null) {
end = start;
start = 0;
} else {
end = +end || 0;
}
// Use `Array(length)` so engines like Chakra and V8 avoid slower modes.
// See https://youtu.be/XAqIpGU8ZZk#t=17m25s for more details.
var index = -1,
length = nativeMax(ceil((end - start) / (step || 1)), 0),
result = Array(length);
while (++index < length) {
result[index] = start;
start += step;
}
return result;
}
/**
* Invokes the iteratee function `n` times, returning an array of the results
* of each invocation. The `iteratee` is bound to `thisArg` and invoked with
* one argument; (index).
*
* @static
* @memberOf _
* @category Utility
* @param {number} n The number of times to invoke `iteratee`.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @param {*} [thisArg] The `this` binding of `iteratee`.
* @returns {Array} Returns the array of results.
* @example
*
* var diceRolls = _.times(3, _.partial(_.random, 1, 6, false));
* // => [3, 6, 4]
*
* _.times(3, function(n) {
* mage.castSpell(n);
* });
* // => invokes `mage.castSpell(n)` three times with `n` of `0`, `1`, and `2`
*
* _.times(3, function(n) {
* this.cast(n);
* }, mage);
* // => also invokes `mage.castSpell(n)` three times
*/
function times(n, iteratee, thisArg) {
n = floor(n);
// Exit early to avoid a JSC JIT bug in Safari 8
// where `Array(0)` is treated as `Array(1)`.
if (n < 1 || !nativeIsFinite(n)) {
return [];
}
var index = -1,
result = Array(nativeMin(n, MAX_ARRAY_LENGTH));
iteratee = bindCallback(iteratee, thisArg, 1);
while (++index < n) {
if (index < MAX_ARRAY_LENGTH) {
result[index] = iteratee(index);
} else {
iteratee(index);
}
}
return result;
}
/**
* Generates a unique ID. If `prefix` is provided the ID is appended to it.
*
* @static
* @memberOf _
* @category Utility
* @param {string} [prefix] The value to prefix the ID with.
* @returns {string} Returns the unique ID.
* @example
*
* _.uniqueId('contact_');
* // => 'contact_104'
*
* _.uniqueId();
* // => '105'
*/
function uniqueId(prefix) {
var id = ++idCounter;
return baseToString(prefix) + id;
}
/*------------------------------------------------------------------------*/
/**
* Adds two numbers.
*
* @static
* @memberOf _
* @category Math
* @param {number} augend The first number to add.
* @param {number} addend The second number to add.
* @returns {number} Returns the sum.
* @example
*
* _.add(6, 4);
* // => 10
*/
function add(augend, addend) {
return (+augend || 0) + (+addend || 0);
}
/**
* Gets the maximum value of `collection`. If `collection` is empty or falsey
* `-Infinity` is returned. If an iteratee function is provided it is invoked
* for each value in `collection` to generate the criterion by which the value
* is ranked. The `iteratee` is bound to `thisArg` and invoked with three
* arguments: (value, index, collection).
*
* If a property name is provided for `iteratee` the created `_.property`
* style callback returns the property value of the given element.
*
* If a value is also provided for `thisArg` the created `_.matchesProperty`
* style callback returns `true` for elements that have a matching property
* value, else `false`.
*
* If an object is provided for `iteratee` the created `_.matches` style
* callback returns `true` for elements that have the properties of the given
* object, else `false`.
*
* @static
* @memberOf _
* @category Math
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function|Object|string} [iteratee] The function invoked per iteration.
* @param {*} [thisArg] The `this` binding of `iteratee`.
* @returns {*} Returns the maximum value.
* @example
*
* _.max([4, 2, 8, 6]);
* // => 8
*
* _.max([]);
* // => -Infinity
*
* var users = [
* { 'user': 'barney', 'age': 36 },
* { 'user': 'fred', 'age': 40 }
* ];
*
* _.max(users, function(chr) {
* return chr.age;
* });
* // => { 'user': 'fred', 'age': 40 }
*
* // using the `_.property` callback shorthand
* _.max(users, 'age');
* // => { 'user': 'fred', 'age': 40 }
*/
var max = createExtremum(gt, NEGATIVE_INFINITY);
/**
* Gets the minimum value of `collection`. If `collection` is empty or falsey
* `Infinity` is returned. If an iteratee function is provided it is invoked
* for each value in `collection` to generate the criterion by which the value
* is ranked. The `iteratee` is bound to `thisArg` and invoked with three
* arguments: (value, index, collection).
*
* If a property name is provided for `iteratee` the created `_.property`
* style callback returns the property value of the given element.
*
* If a value is also provided for `thisArg` the created `_.matchesProperty`
* style callback returns `true` for elements that have a matching property
* value, else `false`.
*
* If an object is provided for `iteratee` the created `_.matches` style
* callback returns `true` for elements that have the properties of the given
* object, else `false`.
*
* @static
* @memberOf _
* @category Math
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function|Object|string} [iteratee] The function invoked per iteration.
* @param {*} [thisArg] The `this` binding of `iteratee`.
* @returns {*} Returns the minimum value.
* @example
*
* _.min([4, 2, 8, 6]);
* // => 2
*
* _.min([]);
* // => Infinity
*
* var users = [
* { 'user': 'barney', 'age': 36 },
* { 'user': 'fred', 'age': 40 }
* ];
*
* _.min(users, function(chr) {
* return chr.age;
* });
* // => { 'user': 'barney', 'age': 36 }
*
* // using the `_.property` callback shorthand
* _.min(users, 'age');
* // => { 'user': 'barney', 'age': 36 }
*/
var min = createExtremum(lt, POSITIVE_INFINITY);
/**
* Gets the sum of the values in `collection`.
*
* @static
* @memberOf _
* @category Math
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function|Object|string} [iteratee] The function invoked per iteration.
* @param {*} [thisArg] The `this` binding of `iteratee`.
* @returns {number} Returns the sum.
* @example
*
* _.sum([4, 6]);
* // => 10
*
* _.sum({ 'a': 4, 'b': 6 });
* // => 10
*
* var objects = [
* { 'n': 4 },
* { 'n': 6 }
* ];
*
* _.sum(objects, function(object) {
* return object.n;
* });
* // => 10
*
* // using the `_.property` callback shorthand
* _.sum(objects, 'n');
* // => 10
*/
function sum(collection, iteratee, thisArg) {
if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {
iteratee = null;
}
var callback = getCallback(),
noIteratee = iteratee == null;
if (!(noIteratee && callback === baseCallback)) {
noIteratee = false;
iteratee = callback(iteratee, thisArg, 3);
}
return noIteratee
? arraySum(isArray(collection) ? collection : toIterable(collection))
: baseSum(collection, iteratee);
}
/*------------------------------------------------------------------------*/
// Ensure wrappers are instances of `baseLodash`.
lodash.prototype = baseLodash.prototype;
LodashWrapper.prototype = baseCreate(baseLodash.prototype);
LodashWrapper.prototype.constructor = LodashWrapper;
LazyWrapper.prototype = baseCreate(baseLodash.prototype);
LazyWrapper.prototype.constructor = LazyWrapper;
// Add functions to the `Map` cache.
MapCache.prototype['delete'] = mapDelete;
MapCache.prototype.get = mapGet;
MapCache.prototype.has = mapHas;
MapCache.prototype.set = mapSet;
// Add functions to the `Set` cache.
SetCache.prototype.push = cachePush;
// Assign cache to `_.memoize`.
memoize.Cache = MapCache;
// Add functions that return wrapped values when chaining.
lodash.after = after;
lodash.ary = ary;
lodash.assign = assign;
lodash.at = at;
lodash.before = before;
lodash.bind = bind;
lodash.bindAll = bindAll;
lodash.bindKey = bindKey;
lodash.callback = callback;
lodash.chain = chain;
lodash.chunk = chunk;
lodash.compact = compact;
lodash.constant = constant;
lodash.countBy = countBy;
lodash.create = create;
lodash.curry = curry;
lodash.curryRight = curryRight;
lodash.debounce = debounce;
lodash.defaults = defaults;
lodash.defer = defer;
lodash.delay = delay;
lodash.difference = difference;
lodash.drop = drop;
lodash.dropRight = dropRight;
lodash.dropRightWhile = dropRightWhile;
lodash.dropWhile = dropWhile;
lodash.fill = fill;
lodash.filter = filter;
lodash.flatten = flatten;
lodash.flattenDeep = flattenDeep;
lodash.flow = flow;
lodash.flowRight = flowRight;
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.keysIn = keysIn;
lodash.map = map;
lodash.mapKeys = mapKeys;
lodash.mapValues = mapValues;
lodash.matches = matches;
lodash.matchesProperty = matchesProperty;
lodash.memoize = memoize;
lodash.merge = merge;
lodash.method = method;
lodash.methodOf = methodOf;
lodash.mixin = mixin;
lodash.negate = negate;
lodash.omit = omit;
lodash.once = once;
lodash.pairs = pairs;
lodash.partial = partial;
lodash.partialRight = partialRight;
lodash.partition = partition;
lodash.pick = pick;
lodash.pluck = pluck;
lodash.property = property;
lodash.propertyOf = propertyOf;
lodash.pull = pull;
lodash.pullAt = pullAt;
lodash.range = range;
lodash.rearg = rearg;
lodash.reject = reject;
lodash.remove = remove;
lodash.rest = rest;
lodash.restParam = restParam;
lodash.set = set;
lodash.shuffle = shuffle;
lodash.slice = slice;
lodash.sortBy = sortBy;
lodash.sortByAll = sortByAll;
lodash.sortByOrder = sortByOrder;
lodash.spread = spread;
lodash.take = take;
lodash.takeRight = takeRight;
lodash.takeRightWhile = takeRightWhile;
lodash.takeWhile = takeWhile;
lodash.tap = tap;
lodash.throttle = throttle;
lodash.thru = thru;
lodash.times = times;
lodash.toArray = toArray;
lodash.toPlainObject = toPlainObject;
lodash.transform = transform;
lodash.union = union;
lodash.uniq = uniq;
lodash.unzip = unzip;
lodash.unzipWith = unzipWith;
lodash.values = values;
lodash.valuesIn = valuesIn;
lodash.where = where;
lodash.without = without;
lodash.wrap = wrap;
lodash.xor = xor;
lodash.zip = zip;
lodash.zipObject = zipObject;
lodash.zipWith = zipWith;
// Add aliases.
lodash.backflow = flowRight;
lodash.collect = map;
lodash.compose = flowRight;
lodash.each = forEach;
lodash.eachRight = forEachRight;
lodash.extend = assign;
lodash.iteratee = callback;
lodash.methods = functions;
lodash.object = zipObject;
lodash.select = filter;
lodash.tail = rest;
lodash.unique = uniq;
// Add functions to `lodash.prototype`.
mixin(lodash, lodash);
/*------------------------------------------------------------------------*/
// Add functions that return unwrapped values when chaining.
lodash.add = add;
lodash.attempt = attempt;
lodash.camelCase = camelCase;
lodash.capitalize = capitalize;
lodash.clone = clone;
lodash.cloneDeep = cloneDeep;
lodash.deburr = deburr;
lodash.endsWith = endsWith;
lodash.escape = escape;
lodash.escapeRegExp = escapeRegExp;
lodash.every = every;
lodash.find = find;
lodash.findIndex = findIndex;
lodash.findKey = findKey;
lodash.findLast = findLast;
lodash.findLastIndex = findLastIndex;
lodash.findLastKey = findLastKey;
lodash.findWhere = findWhere;
lodash.first = first;
lodash.get = get;
lodash.gt = gt;
lodash.gte = gte;
lodash.has = has;
lodash.identity = identity;
lodash.includes = includes;
lodash.indexOf = indexOf;
lodash.inRange = inRange;
lodash.isArguments = isArguments;
lodash.isArray = isArray;
lodash.isBoolean = isBoolean;
lodash.isDate = isDate;
lodash.isElement = isElement;
lodash.isEmpty = isEmpty;
lodash.isEqual = isEqual;
lodash.isError = isError;
lodash.isFinite = isFinite;
lodash.isFunction = isFunction;
lodash.isMatch = isMatch;
lodash.isNaN = isNaN;
lodash.isNative = isNative;
lodash.isNull = isNull;
lodash.isNumber = isNumber;
lodash.isObject = isObject;
lodash.isPlainObject = isPlainObject;
lodash.isRegExp = isRegExp;
lodash.isString = isString;
lodash.isTypedArray = isTypedArray;
lodash.isUndefined = isUndefined;
lodash.kebabCase = kebabCase;
lodash.last = last;
lodash.lastIndexOf = lastIndexOf;
lodash.lt = lt;
lodash.lte = lte;
lodash.max = max;
lodash.min = min;
lodash.noConflict = noConflict;
lodash.noop = noop;
lodash.now = now;
lodash.pad = pad;
lodash.padLeft = padLeft;
lodash.padRight = padRight;
lodash.parseInt = parseInt;
lodash.random = random;
lodash.reduce = reduce;
lodash.reduceRight = reduceRight;
lodash.repeat = repeat;
lodash.result = result;
lodash.runInContext = runInContext;
lodash.size = size;
lodash.snakeCase = snakeCase;
lodash.some = some;
lodash.sortedIndex = sortedIndex;
lodash.sortedLastIndex = sortedLastIndex;
lodash.startCase = startCase;
lodash.startsWith = startsWith;
lodash.sum = sum;
lodash.template = template;
lodash.trim = trim;
lodash.trimLeft = trimLeft;
lodash.trimRight = trimRight;
lodash.trunc = trunc;
lodash.unescape = unescape;
lodash.uniqueId = uniqueId;
lodash.words = words;
// Add aliases.
lodash.all = every;
lodash.any = some;
lodash.contains = includes;
lodash.eq = isEqual;
lodash.detect = find;
lodash.foldl = reduce;
lodash.foldr = reduceRight;
lodash.head = first;
lodash.include = includes;
lodash.inject = reduce;
mixin(lodash, (function() {
var source = {};
baseForOwn(lodash, function(func, methodName) {
if (!lodash.prototype[methodName]) {
source[methodName] = func;
}
});
return source;
}()), false);
/*------------------------------------------------------------------------*/
// Add functions capable of returning wrapped and unwrapped values when chaining.
lodash.sample = sample;
lodash.prototype.sample = function(n) {
if (!this.__chain__ && n == null) {
return sample(this.value());
}
return this.thru(function(value) {
return sample(value, n);
});
};
/*------------------------------------------------------------------------*/
/**
* The semantic version number.
*
* @static
* @memberOf _
* @type string
*/
lodash.VERSION = VERSION;
// Assign default placeholders.
arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
lodash[methodName].placeholder = lodash;
});
// Add `LazyWrapper` methods that accept an `iteratee` value.
arrayEach(['dropWhile', 'filter', 'map', 'takeWhile'], function(methodName, type) {
var isFilter = type != LAZY_MAP_FLAG,
isDropWhile = type == LAZY_DROP_WHILE_FLAG;
LazyWrapper.prototype[methodName] = function(iteratee, thisArg) {
var filtered = this.__filtered__,
result = (filtered && isDropWhile) ? new LazyWrapper(this) : this.clone(),
iteratees = result.__iteratees__ || (result.__iteratees__ = []);
iteratees.push({
'done': false,
'count': 0,
'index': 0,
'iteratee': getCallback(iteratee, thisArg, 1),
'limit': -1,
'type': type
});
result.__filtered__ = filtered || isFilter;
return result;
};
});
// Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
arrayEach(['drop', 'take'], function(methodName, index) {
var whileName = methodName + 'While';
LazyWrapper.prototype[methodName] = function(n) {
var filtered = this.__filtered__,
result = (filtered && !index) ? this.dropWhile() : this.clone();
n = n == null ? 1 : nativeMax(floor(n) || 0, 0);
if (filtered) {
if (index) {
result.__takeCount__ = nativeMin(result.__takeCount__, n);
} else {
last(result.__iteratees__).limit = n;
}
} else {
var views = result.__views__ || (result.__views__ = []);
views.push({ 'size': n, 'type': methodName + (result.__dir__ < 0 ? 'Right' : '') });
}
return result;
};
LazyWrapper.prototype[methodName + 'Right'] = function(n) {
return this.reverse()[methodName](n).reverse();
};
LazyWrapper.prototype[methodName + 'RightWhile'] = function(predicate, thisArg) {
return this.reverse()[whileName](predicate, thisArg).reverse();
};
});
// Add `LazyWrapper` methods for `_.first` and `_.last`.
arrayEach(['first', 'last'], function(methodName, index) {
var takeName = 'take' + (index ? 'Right' : '');
LazyWrapper.prototype[methodName] = function() {
return this[takeName](1).value()[0];
};
});
// Add `LazyWrapper` methods for `_.initial` and `_.rest`.
arrayEach(['initial', 'rest'], function(methodName, index) {
var dropName = 'drop' + (index ? '' : 'Right');
LazyWrapper.prototype[methodName] = function() {
return this[dropName](1);
};
});
// Add `LazyWrapper` methods for `_.pluck` and `_.where`.
arrayEach(['pluck', 'where'], function(methodName, index) {
var operationName = index ? 'filter' : 'map',
createCallback = index ? baseMatches : property;
LazyWrapper.prototype[methodName] = function(value) {
return this[operationName](createCallback(value));
};
});
LazyWrapper.prototype.compact = function() {
return this.filter(identity);
};
LazyWrapper.prototype.reject = function(predicate, thisArg) {
predicate = getCallback(predicate, thisArg, 1);
return this.filter(function(value) {
return !predicate(value);
});
};
LazyWrapper.prototype.slice = function(start, end) {
start = start == null ? 0 : (+start || 0);
var result = this;
if (start < 0) {
result = this.takeRight(-start);
} else if (start) {
result = this.drop(start);
}
if (end !== undefined) {
end = (+end || 0);
result = end < 0 ? result.dropRight(-end) : result.take(end - start);
}
return result;
};
LazyWrapper.prototype.toArray = function() {
return this.drop(0);
};
// Add `LazyWrapper` methods to `lodash.prototype`.
baseForOwn(LazyWrapper.prototype, function(func, methodName) {
var lodashFunc = lodash[methodName];
if (!lodashFunc) {
return;
}
var checkIteratee = /^(?:filter|map|reject)|While$/.test(methodName),
retUnwrapped = /^(?:first|last)$/.test(methodName);
lodash.prototype[methodName] = function() {
var args = arguments,
chainAll = this.__chain__,
value = this.__wrapped__,
isHybrid = !!this.__actions__.length,
isLazy = value instanceof LazyWrapper,
iteratee = args[0],
useLazy = isLazy || isArray(value);
if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
// avoid lazy use if the iteratee has a "length" value other than `1`
isLazy = useLazy = false;
}
var onlyLazy = isLazy && !isHybrid;
if (retUnwrapped && !chainAll) {
return onlyLazy
? func.call(value)
: lodashFunc.call(lodash, this.value());
}
var interceptor = function(value) {
var otherArgs = [value];
push.apply(otherArgs, args);
return lodashFunc.apply(lodash, otherArgs);
};
if (useLazy) {
var wrapper = onlyLazy ? value : new LazyWrapper(this),
result = func.apply(wrapper, args);
if (!retUnwrapped && (isHybrid || result.__actions__)) {
var actions = result.__actions__ || (result.__actions__ = []);
actions.push({ 'func': thru, 'args': [interceptor], 'thisArg': lodash });
}
return new LodashWrapper(result, chainAll);
}
return this.thru(interceptor);
};
});
// Add `Array` and `String` methods to `lodash.prototype`.
arrayEach(['concat', 'join', 'pop', 'push', 'replace', 'shift', 'sort', 'splice', 'split', 'unshift'], function(methodName) {
var func = (/^(?:replace|split)$/.test(methodName) ? stringProto : arrayProto)[methodName],
chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
retUnwrapped = /^(?:join|pop|replace|shift)$/.test(methodName);
lodash.prototype[methodName] = function() {
var args = arguments;
if (retUnwrapped && !this.__chain__) {
return func.apply(this.value(), args);
}
return this[chainName](function(value) {
return func.apply(value, args);
});
};
});
// Map minified function names to their real names.
baseForOwn(LazyWrapper.prototype, function(func, methodName) {
var lodashFunc = lodash[methodName];
if (lodashFunc) {
var key = lodashFunc.name,
names = realNames[key] || (realNames[key] = []);
names.push({ 'name': methodName, 'func': lodashFunc });
}
});
realNames[createHybridWrapper(null, BIND_KEY_FLAG).name] = [{ 'name': 'wrapper', 'func': null }];
// Add functions to the lazy wrapper.
LazyWrapper.prototype.clone = lazyClone;
LazyWrapper.prototype.reverse = lazyReverse;
LazyWrapper.prototype.value = lazyValue;
// Add chaining functions to the `lodash` wrapper.
lodash.prototype.chain = wrapperChain;
lodash.prototype.commit = wrapperCommit;
lodash.prototype.plant = wrapperPlant;
lodash.prototype.reverse = wrapperReverse;
lodash.prototype.toString = wrapperToString;
lodash.prototype.run = lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
// Add function aliases to the `lodash` wrapper.
lodash.prototype.collect = lodash.prototype.map;
lodash.prototype.head = lodash.prototype.first;
lodash.prototype.select = lodash.prototype.filter;
lodash.prototype.tail = lodash.prototype.rest;
return lodash;
}
/*--------------------------------------------------------------------------*/
// Export lodash.
var _ = runInContext();
// Some AMD build optimizers like r.js check for condition patterns like the following:
if (true) {
// Expose lodash to the global object when an AMD loader is present to avoid
// errors in cases where lodash is loaded by a script tag and not intended
// as an AMD module. See http://requirejs.org/docs/errors.html#mismatch for
// more details.
root._ = _;
// Define as an anonymous module so, through path mapping, it can be
// referenced as the "underscore" module.
!(__WEBPACK_AMD_DEFINE_RESULT__ = function() {
return _;
}.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
// Check for `exports` after `define` in case a build optimizer adds an `exports` object.
else if (freeExports && freeModule) {
// Export for Node.js or RingoJS.
if (moduleExports) {
(freeModule.exports = _)._ = _;
}
// Export for Rhino with CommonJS support.
else {
freeExports._ = _;
}
}
else {
// Export for a browser or Rhino.
root._ = _;
}
}.call(this));
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(15)(module), (function() { return this; }())))
/***/ },
/* 15 */
/***/ function(module, exports, __webpack_require__) {
module.exports = function(module) {
if(!module.webpackPolyfill) {
module.deprecate = function() {};
module.paths = [];
// module.parent = undefined by default
module.children = [];
module.webpackPolyfill = 1;
}
return module;
}
/***/ },
/* 16 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
exports.hash = hash;
Object.defineProperty(exports, "__esModule", {
value: true
});
var sha256 = __webpack_require__(17).sha256;
function hash(data) {
var hasher = new sha256();
hasher.update(data, "utf8");
return hasher.digest();
}
/***/ },
/* 17 */
/***/ function(module, exports, __webpack_require__) {
var exports = module.exports = function SHA (algorithm) {
algorithm = algorithm.toLowerCase()
var Algorithm = exports[algorithm]
if (!Algorithm) throw new Error(algorithm + ' is not supported (we accept pull requests)')
return new Algorithm()
}
exports.sha = __webpack_require__(21)
exports.sha1 = __webpack_require__(22)
exports.sha224 = __webpack_require__(23)
exports.sha256 = __webpack_require__(18)
exports.sha384 = __webpack_require__(24)
exports.sha512 = __webpack_require__(25)
/***/ },
/* 18 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(Buffer) {/**
* A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
* in FIPS 180-2
* Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
*
*/
var inherits = __webpack_require__(19)
var Hash = __webpack_require__(20)
var K = [
0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5,
0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5,
0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3,
0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174,
0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC,
0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA,
0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7,
0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967,
0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13,
0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85,
0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3,
0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070,
0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5,
0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3,
0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208,
0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2
]
var W = new Array(64)
function Sha256 () {
this.init()
this._w = W // new Array(64)
Hash.call(this, 64, 56)
}
inherits(Sha256, Hash)
Sha256.prototype.init = function () {
this._a = 0x6a09e667 | 0
this._b = 0xbb67ae85 | 0
this._c = 0x3c6ef372 | 0
this._d = 0xa54ff53a | 0
this._e = 0x510e527f | 0
this._f = 0x9b05688c | 0
this._g = 0x1f83d9ab | 0
this._h = 0x5be0cd19 | 0
return this
}
function S (X, n) {
return (X >>> n) | (X << (32 - n))
}
function R (X, n) {
return (X >>> n)
}
function Ch (x, y, z) {
return ((x & y) ^ ((~x) & z))
}
function Maj (x, y, z) {
return ((x & y) ^ (x & z) ^ (y & z))
}
function Sigma0256 (x) {
return (S(x, 2) ^ S(x, 13) ^ S(x, 22))
}
function Sigma1256 (x) {
return (S(x, 6) ^ S(x, 11) ^ S(x, 25))
}
function Gamma0256 (x) {
return (S(x, 7) ^ S(x, 18) ^ R(x, 3))
}
function Gamma1256 (x) {
return (S(x, 17) ^ S(x, 19) ^ R(x, 10))
}
Sha256.prototype._update = function (M) {
var W = this._w
var a = this._a | 0
var b = this._b | 0
var c = this._c | 0
var d = this._d | 0
var e = this._e | 0
var f = this._f | 0
var g = this._g | 0
var h = this._h | 0
var j = 0
function calcW () { return Gamma1256(W[j - 2]) + W[j - 7] + Gamma0256(W[j - 15]) + W[j - 16] }
function loop (w) {
W[j] = w
var T1 = h + Sigma1256(e) + Ch(e, f, g) + K[j] + w
var T2 = Sigma0256(a) + Maj(a, b, c)
h = g
g = f
f = e
e = d + T1
d = c
c = b
b = a
a = T1 + T2
j++
}
while (j < 16) loop(M.readInt32BE(j * 4))
while (j < 64) loop(calcW())
this._a = (a + this._a) | 0
this._b = (b + this._b) | 0
this._c = (c + this._c) | 0
this._d = (d + this._d) | 0
this._e = (e + this._e) | 0
this._f = (f + this._f) | 0
this._g = (g + this._g) | 0
this._h = (h + this._h) | 0
}
Sha256.prototype._hash = function () {
var H = new Buffer(32)
H.writeInt32BE(this._a, 0)
H.writeInt32BE(this._b, 4)
H.writeInt32BE(this._c, 8)
H.writeInt32BE(this._d, 12)
H.writeInt32BE(this._e, 16)
H.writeInt32BE(this._f, 20)
H.writeInt32BE(this._g, 24)
H.writeInt32BE(this._h, 28)
return H
}
module.exports = Sha256
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(9).Buffer))
/***/ },
/* 19 */
/***/ function(module, exports, __webpack_require__) {
if (typeof Object.create === 'function') {
// implementation from standard node.js 'util' module
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 {
// old school shim for old browsers
module.exports = function inherits(ctor, superCtor) {
ctor.super_ = superCtor
var TempCtor = function () {}
TempCtor.prototype = superCtor.prototype
ctor.prototype = new TempCtor()
ctor.prototype.constructor = ctor
}
}
/***/ },
/* 20 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(Buffer) {// prototype class for hash functions
function Hash (blockSize, finalSize) {
this._block = new Buffer(blockSize)
this._finalSize = finalSize
this._blockSize = blockSize
this._len = 0
this._s = 0
}
Hash.prototype.update = function (data, enc) {
if (typeof data === 'string') {
enc = enc || 'utf8'
data = new Buffer(data, enc)
}
var l = this._len += data.length
var s = this._s || 0
var f = 0
var buffer = this._block
while (s < l) {
var t = Math.min(data.length, f + this._blockSize - (s % this._blockSize))
var ch = (t - f)
for (var i = 0; i < ch; i++) {
buffer[(s % this._blockSize) + i] = data[i + f]
}
s += ch
f += ch
if ((s % this._blockSize) === 0) {
this._update(buffer)
}
}
this._s = s
return this
}
Hash.prototype.digest = function (enc) {
// Suppose the length of the message M, in bits, is l
var l = this._len * 8
// Append the bit 1 to the end of the message
this._block[this._len % this._blockSize] = 0x80
// and then k zero bits, where k is the smallest non-negative solution to the equation (l + 1 + k) === finalSize mod blockSize
this._block.fill(0, this._len % this._blockSize + 1)
if (l % (this._blockSize * 8) >= this._finalSize * 8) {
this._update(this._block)
this._block.fill(0)
}
// to this append the block which is equal to the number l written in binary
// TODO: handle case where l is > Math.pow(2, 29)
this._block.writeInt32BE(l, this._blockSize - 4)
var hash = this._update(this._block) || this._hash()
return enc ? hash.toString(enc) : hash
}
Hash.prototype._update = function () {
throw new Error('_update must be implemented by subclass')
}
module.exports = Hash
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(9).Buffer))
/***/ },
/* 21 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(Buffer) {/*
* A JavaScript implementation of the Secure Hash Algorithm, SHA-0, as defined
* in FIPS PUB 180-1
* This source code is derived from sha1.js of the same repository.
* The difference between SHA-0 and SHA-1 is just a bitwise rotate left
* operation was added.
*/
var inherits = __webpack_require__(19)
var Hash = __webpack_require__(20)
var W = new Array(80)
function Sha () {
this.init()
this._w = W
Hash.call(this, 64, 56)
}
inherits(Sha, Hash)
Sha.prototype.init = function () {
this._a = 0x67452301 | 0
this._b = 0xefcdab89 | 0
this._c = 0x98badcfe | 0
this._d = 0x10325476 | 0
this._e = 0xc3d2e1f0 | 0
return this
}
/*
* Bitwise rotate a 32-bit number to the left.
*/
function rol (num, cnt) {
return (num << cnt) | (num >>> (32 - cnt))
}
Sha.prototype._update = function (M) {
var W = this._w
var a = this._a
var b = this._b
var c = this._c
var d = this._d
var e = this._e
var j = 0, k
/*
* SHA-1 has a bitwise rotate left operation. But, SHA is not
* function calcW() { return rol(W[j - 3] ^ W[j - 8] ^ W[j - 14] ^ W[j - 16], 1) }
*/
function calcW () { return W[j - 3] ^ W[j - 8] ^ W[j - 14] ^ W[j - 16] }
function loop (w, f) {
W[j] = w
var t = rol(a, 5) + f + e + w + k
e = d
d = c
c = rol(b, 30)
b = a
a = t
j++
}
k = 1518500249
while (j < 16) loop(M.readInt32BE(j * 4), (b & c) | ((~b) & d))
while (j < 20) loop(calcW(), (b & c) | ((~b) & d))
k = 1859775393
while (j < 40) loop(calcW(), b ^ c ^ d)
k = -1894007588
while (j < 60) loop(calcW(), (b & c) | (b & d) | (c & d))
k = -899497514
while (j < 80) loop(calcW(), b ^ c ^ d)
this._a = (a + this._a) | 0
this._b = (b + this._b) | 0
this._c = (c + this._c) | 0
this._d = (d + this._d) | 0
this._e = (e + this._e) | 0
}
Sha.prototype._hash = function () {
var H = new Buffer(20)
H.writeInt32BE(this._a | 0, 0)
H.writeInt32BE(this._b | 0, 4)
H.writeInt32BE(this._c | 0, 8)
H.writeInt32BE(this._d | 0, 12)
H.writeInt32BE(this._e | 0, 16)
return H
}
module.exports = Sha
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(9).Buffer))
/***/ },
/* 22 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(Buffer) {/*
* A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
* in FIPS PUB 180-1
* Version 2.1a Copyright Paul Johnston 2000 - 2002.
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
* Distributed under the BSD License
* See http://pajhome.org.uk/crypt/md5 for details.
*/
var inherits = __webpack_require__(19)
var Hash = __webpack_require__(20)
var W = new Array(80)
function Sha1 () {
this.init()
this._w = W
Hash.call(this, 64, 56)
}
inherits(Sha1, Hash)
Sha1.prototype.init = function () {
this._a = 0x67452301 | 0
this._b = 0xefcdab89 | 0
this._c = 0x98badcfe | 0
this._d = 0x10325476 | 0
this._e = 0xc3d2e1f0 | 0
return this
}
/*
* Bitwise rotate a 32-bit number to the left.
*/
function rol (num, cnt) {
return (num << cnt) | (num >>> (32 - cnt))
}
Sha1.prototype._update = function (M) {
var W = this._w
var a = this._a
var b = this._b
var c = this._c
var d = this._d
var e = this._e
var j = 0, k
function calcW () { return rol(W[j - 3] ^ W[j - 8] ^ W[j - 14] ^ W[j - 16], 1) }
function loop (w, f) {
W[j] = w
var t = rol(a, 5) + f + e + w + k
e = d
d = c
c = rol(b, 30)
b = a
a = t
j++
}
k = 1518500249
while (j < 16) loop(M.readInt32BE(j * 4), (b & c) | ((~b) & d))
while (j < 20) loop(calcW(), (b & c) | ((~b) & d))
k = 1859775393
while (j < 40) loop(calcW(), b ^ c ^ d)
k = -1894007588
while (j < 60) loop(calcW(), (b & c) | (b & d) | (c & d))
k = -899497514
while (j < 80) loop(calcW(), b ^ c ^ d)
this._a = (a + this._a) | 0
this._b = (b + this._b) | 0
this._c = (c + this._c) | 0
this._d = (d + this._d) | 0
this._e = (e + this._e) | 0
}
Sha1.prototype._hash = function () {
var H = new Buffer(20)
H.writeInt32BE(this._a | 0, 0)
H.writeInt32BE(this._b | 0, 4)
H.writeInt32BE(this._c | 0, 8)
H.writeInt32BE(this._d | 0, 12)
H.writeInt32BE(this._e | 0, 16)
return H
}
module.exports = Sha1
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(9).Buffer))
/***/ },
/* 23 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(Buffer) {/**
* A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
* in FIPS 180-2
* Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
*
*/
var inherits = __webpack_require__(19)
var Sha256 = __webpack_require__(18)
var Hash = __webpack_require__(20)
var W = new Array(64)
function Sha224 () {
this.init()
this._w = W // new Array(64)
Hash.call(this, 64, 56)
}
inherits(Sha224, Sha256)
Sha224.prototype.init = function () {
this._a = 0xc1059ed8 | 0
this._b = 0x367cd507 | 0
this._c = 0x3070dd17 | 0
this._d = 0xf70e5939 | 0
this._e = 0xffc00b31 | 0
this._f = 0x68581511 | 0
this._g = 0x64f98fa7 | 0
this._h = 0xbefa4fa4 | 0
return this
}
Sha224.prototype._hash = function () {
var H = new Buffer(28)
H.writeInt32BE(this._a, 0)
H.writeInt32BE(this._b, 4)
H.writeInt32BE(this._c, 8)
H.writeInt32BE(this._d, 12)
H.writeInt32BE(this._e, 16)
H.writeInt32BE(this._f, 20)
H.writeInt32BE(this._g, 24)
return H
}
module.exports = Sha224
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(9).Buffer))
/***/ },
/* 24 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(Buffer) {var inherits = __webpack_require__(19)
var SHA512 = __webpack_require__(25)
var Hash = __webpack_require__(20)
var W = new Array(160)
function Sha384 () {
this.init()
this._w = W
Hash.call(this, 128, 112)
}
inherits(Sha384, SHA512)
Sha384.prototype.init = function () {
this._a = 0xcbbb9d5d | 0
this._b = 0x629a292a | 0
this._c = 0x9159015a | 0
this._d = 0x152fecd8 | 0
this._e = 0x67332667 | 0
this._f = 0x8eb44a87 | 0
this._g = 0xdb0c2e0d | 0
this._h = 0x47b5481d | 0
this._al = 0xc1059ed8 | 0
this._bl = 0x367cd507 | 0
this._cl = 0x3070dd17 | 0
this._dl = 0xf70e5939 | 0
this._el = 0xffc00b31 | 0
this._fl = 0x68581511 | 0
this._gl = 0x64f98fa7 | 0
this._hl = 0xbefa4fa4 | 0
return this
}
Sha384.prototype._hash = function () {
var H = new Buffer(48)
function writeInt64BE (h, l, offset) {
H.writeInt32BE(h, offset)
H.writeInt32BE(l, offset + 4)
}
writeInt64BE(this._a, this._al, 0)
writeInt64BE(this._b, this._bl, 8)
writeInt64BE(this._c, this._cl, 16)
writeInt64BE(this._d, this._dl, 24)
writeInt64BE(this._e, this._el, 32)
writeInt64BE(this._f, this._fl, 40)
return H
}
module.exports = Sha384
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(9).Buffer))
/***/ },
/* 25 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(Buffer) {var inherits = __webpack_require__(19)
var Hash = __webpack_require__(20)
var K = [
0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
]
var W = new Array(160)
function Sha512 () {
this.init()
this._w = W
Hash.call(this, 128, 112)
}
inherits(Sha512, Hash)
Sha512.prototype.init = function () {
this._a = 0x6a09e667 | 0
this._b = 0xbb67ae85 | 0
this._c = 0x3c6ef372 | 0
this._d = 0xa54ff53a | 0
this._e = 0x510e527f | 0
this._f = 0x9b05688c | 0
this._g = 0x1f83d9ab | 0
this._h = 0x5be0cd19 | 0
this._al = 0xf3bcc908 | 0
this._bl = 0x84caa73b | 0
this._cl = 0xfe94f82b | 0
this._dl = 0x5f1d36f1 | 0
this._el = 0xade682d1 | 0
this._fl = 0x2b3e6c1f | 0
this._gl = 0xfb41bd6b | 0
this._hl = 0x137e2179 | 0
return this
}
function S (X, Xl, n) {
return (X >>> n) | (Xl << (32 - n))
}
function Ch (x, y, z) {
return ((x & y) ^ ((~x) & z))
}
function Maj (x, y, z) {
return ((x & y) ^ (x & z) ^ (y & z))
}
Sha512.prototype._update = function (M) {
var W = this._w
var a = this._a | 0
var b = this._b | 0
var c = this._c | 0
var d = this._d | 0
var e = this._e | 0
var f = this._f | 0
var g = this._g | 0
var h = this._h | 0
var al = this._al | 0
var bl = this._bl | 0
var cl = this._cl | 0
var dl = this._dl | 0
var el = this._el | 0
var fl = this._fl | 0
var gl = this._gl | 0
var hl = this._hl | 0
var i = 0, j = 0
var Wi, Wil
function calcW () {
var x = W[j - 15 * 2]
var xl = W[j - 15 * 2 + 1]
var gamma0 = S(x, xl, 1) ^ S(x, xl, 8) ^ (x >>> 7)
var gamma0l = S(xl, x, 1) ^ S(xl, x, 8) ^ S(xl, x, 7)
x = W[j - 2 * 2]
xl = W[j - 2 * 2 + 1]
var gamma1 = S(x, xl, 19) ^ S(xl, x, 29) ^ (x >>> 6)
var gamma1l = S(xl, x, 19) ^ S(x, xl, 29) ^ S(xl, x, 6)
// W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]
var Wi7 = W[j - 7 * 2]
var Wi7l = W[j - 7 * 2 + 1]
var Wi16 = W[j - 16 * 2]
var Wi16l = W[j - 16 * 2 + 1]
Wil = gamma0l + Wi7l
Wi = gamma0 + Wi7 + ((Wil >>> 0) < (gamma0l >>> 0) ? 1 : 0)
Wil = Wil + gamma1l
Wi = Wi + gamma1 + ((Wil >>> 0) < (gamma1l >>> 0) ? 1 : 0)
Wil = Wil + Wi16l
Wi = Wi + Wi16 + ((Wil >>> 0) < (Wi16l >>> 0) ? 1 : 0)
}
function loop () {
W[j] = Wi
W[j + 1] = Wil
var maj = Maj(a, b, c)
var majl = Maj(al, bl, cl)
var sigma0h = S(a, al, 28) ^ S(al, a, 2) ^ S(al, a, 7)
var sigma0l = S(al, a, 28) ^ S(a, al, 2) ^ S(a, al, 7)
var sigma1h = S(e, el, 14) ^ S(e, el, 18) ^ S(el, e, 9)
var sigma1l = S(el, e, 14) ^ S(el, e, 18) ^ S(e, el, 9)
// t1 = h + sigma1 + ch + K[i] + W[i]
var Ki = K[j]
var Kil = K[j + 1]
var ch = Ch(e, f, g)
var chl = Ch(el, fl, gl)
var t1l = hl + sigma1l
var t1 = h + sigma1h + ((t1l >>> 0) < (hl >>> 0) ? 1 : 0)
t1l = t1l + chl
t1 = t1 + ch + ((t1l >>> 0) < (chl >>> 0) ? 1 : 0)
t1l = t1l + Kil
t1 = t1 + Ki + ((t1l >>> 0) < (Kil >>> 0) ? 1 : 0)
t1l = t1l + Wil
t1 = t1 + Wi + ((t1l >>> 0) < (Wil >>> 0) ? 1 : 0)
// t2 = sigma0 + maj
var t2l = sigma0l + majl
var t2 = sigma0h + maj + ((t2l >>> 0) < (sigma0l >>> 0) ? 1 : 0)
h = g
hl = gl
g = f
gl = fl
f = e
fl = el
el = (dl + t1l) | 0
e = (d + t1 + ((el >>> 0) < (dl >>> 0) ? 1 : 0)) | 0
d = c
dl = cl
c = b
cl = bl
b = a
bl = al
al = (t1l + t2l) | 0
a = (t1 + t2 + ((al >>> 0) < (t1l >>> 0) ? 1 : 0)) | 0
i++
j += 2
}
while (i < 16) {
Wi = M.readInt32BE(j * 4)
Wil = M.readInt32BE(j * 4 + 4)
loop()
}
while (i < 80) {
calcW()
loop()
}
this._al = (this._al + al) | 0
this._bl = (this._bl + bl) | 0
this._cl = (this._cl + cl) | 0
this._dl = (this._dl + dl) | 0
this._el = (this._el + el) | 0
this._fl = (this._fl + fl) | 0
this._gl = (this._gl + gl) | 0
this._hl = (this._hl + hl) | 0
this._a = (this._a + a + ((this._al >>> 0) < (al >>> 0) ? 1 : 0)) | 0
this._b = (this._b + b + ((this._bl >>> 0) < (bl >>> 0) ? 1 : 0)) | 0
this._c = (this._c + c + ((this._cl >>> 0) < (cl >>> 0) ? 1 : 0)) | 0
this._d = (this._d + d + ((this._dl >>> 0) < (dl >>> 0) ? 1 : 0)) | 0
this._e = (this._e + e + ((this._el >>> 0) < (el >>> 0) ? 1 : 0)) | 0
this._f = (this._f + f + ((this._fl >>> 0) < (fl >>> 0) ? 1 : 0)) | 0
this._g = (this._g + g + ((this._gl >>> 0) < (gl >>> 0) ? 1 : 0)) | 0
this._h = (this._h + h + ((this._hl >>> 0) < (hl >>> 0) ? 1 : 0)) | 0
}
Sha512.prototype._hash = function () {
var H = new Buffer(64)
function writeInt64BE (h, l, offset) {
H.writeInt32BE(h, offset)
H.writeInt32BE(l, offset + 4)
}
writeInt64BE(this._a, this._al, 0)
writeInt64BE(this._b, this._bl, 8)
writeInt64BE(this._c, this._cl, 16)
writeInt64BE(this._d, this._dl, 24)
writeInt64BE(this._e, this._el, 32)
writeInt64BE(this._f, this._fl, 40)
writeInt64BE(this._g, this._gl, 48)
writeInt64BE(this._h, this._hl, 56)
return H
}
module.exports = Sha512
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(9).Buffer))
/***/ },
/* 26 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(Buffer) {(function(nacl) {
'use strict';
// Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
// Public domain.
//
// Implementation derived from TweetNaCl version 20140427.
// See for details: http://tweetnacl.cr.yp.to/
/* jshint newcap: false */
var gf = function(init) {
var i, r = new Float64Array(16);
if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
return r;
};
// Pluggable, initialized in high-level API below.
var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
var _0 = new Uint8Array(16);
var _9 = new Uint8Array(32); _9[0] = 9;
var gf0 = gf(),
gf1 = gf([1]),
_121665 = gf([0xdb41, 1]),
D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
function ts64(x, i, h, l) {
x[i] = (h >> 24) & 0xff;
x[i+1] = (h >> 16) & 0xff;
x[i+2] = (h >> 8) & 0xff;
x[i+3] = h & 0xff;
x[i+4] = (l >> 24) & 0xff;
x[i+5] = (l >> 16) & 0xff;
x[i+6] = (l >> 8) & 0xff;
x[i+7] = l & 0xff;
}
function vn(x, xi, y, yi, n) {
var i,d = 0;
for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
return (1 & ((d - 1) >>> 8)) - 1;
}
function crypto_verify_16(x, xi, y, yi) {
return vn(x,xi,y,yi,16);
}
function crypto_verify_32(x, xi, y, yi) {
return vn(x,xi,y,yi,32);
}
function core_salsa20(o, p, k, c) {
var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
x15 = j15, u;
for (var i = 0; i < 20; i += 2) {
u = x0 + x12 | 0;
x4 ^= u<<7 | u>>>(32-7);
u = x4 + x0 | 0;
x8 ^= u<<9 | u>>>(32-9);
u = x8 + x4 | 0;
x12 ^= u<<13 | u>>>(32-13);
u = x12 + x8 | 0;
x0 ^= u<<18 | u>>>(32-18);
u = x5 + x1 | 0;
x9 ^= u<<7 | u>>>(32-7);
u = x9 + x5 | 0;
x13 ^= u<<9 | u>>>(32-9);
u = x13 + x9 | 0;
x1 ^= u<<13 | u>>>(32-13);
u = x1 + x13 | 0;
x5 ^= u<<18 | u>>>(32-18);
u = x10 + x6 | 0;
x14 ^= u<<7 | u>>>(32-7);
u = x14 + x10 | 0;
x2 ^= u<<9 | u>>>(32-9);
u = x2 + x14 | 0;
x6 ^= u<<13 | u>>>(32-13);
u = x6 + x2 | 0;
x10 ^= u<<18 | u>>>(32-18);
u = x15 + x11 | 0;
x3 ^= u<<7 | u>>>(32-7);
u = x3 + x15 | 0;
x7 ^= u<<9 | u>>>(32-9);
u = x7 + x3 | 0;
x11 ^= u<<13 | u>>>(32-13);
u = x11 + x7 | 0;
x15 ^= u<<18 | u>>>(32-18);
u = x0 + x3 | 0;
x1 ^= u<<7 | u>>>(32-7);
u = x1 + x0 | 0;
x2 ^= u<<9 | u>>>(32-9);
u = x2 + x1 | 0;
x3 ^= u<<13 | u>>>(32-13);
u = x3 + x2 | 0;
x0 ^= u<<18 | u>>>(32-18);
u = x5 + x4 | 0;
x6 ^= u<<7 | u>>>(32-7);
u = x6 + x5 | 0;
x7 ^= u<<9 | u>>>(32-9);
u = x7 + x6 | 0;
x4 ^= u<<13 | u>>>(32-13);
u = x4 + x7 | 0;
x5 ^= u<<18 | u>>>(32-18);
u = x10 + x9 | 0;
x11 ^= u<<7 | u>>>(32-7);
u = x11 + x10 | 0;
x8 ^= u<<9 | u>>>(32-9);
u = x8 + x11 | 0;
x9 ^= u<<13 | u>>>(32-13);
u = x9 + x8 | 0;
x10 ^= u<<18 | u>>>(32-18);
u = x15 + x14 | 0;
x12 ^= u<<7 | u>>>(32-7);
u = x12 + x15 | 0;
x13 ^= u<<9 | u>>>(32-9);
u = x13 + x12 | 0;
x14 ^= u<<13 | u>>>(32-13);
u = x14 + x13 | 0;
x15 ^= u<<18 | u>>>(32-18);
}
x0 = x0 + j0 | 0;
x1 = x1 + j1 | 0;
x2 = x2 + j2 | 0;
x3 = x3 + j3 | 0;
x4 = x4 + j4 | 0;
x5 = x5 + j5 | 0;
x6 = x6 + j6 | 0;
x7 = x7 + j7 | 0;
x8 = x8 + j8 | 0;
x9 = x9 + j9 | 0;
x10 = x10 + j10 | 0;
x11 = x11 + j11 | 0;
x12 = x12 + j12 | 0;
x13 = x13 + j13 | 0;
x14 = x14 + j14 | 0;
x15 = x15 + j15 | 0;
o[ 0] = x0 >>> 0 & 0xff;
o[ 1] = x0 >>> 8 & 0xff;
o[ 2] = x0 >>> 16 & 0xff;
o[ 3] = x0 >>> 24 & 0xff;
o[ 4] = x1 >>> 0 & 0xff;
o[ 5] = x1 >>> 8 & 0xff;
o[ 6] = x1 >>> 16 & 0xff;
o[ 7] = x1 >>> 24 & 0xff;
o[ 8] = x2 >>> 0 & 0xff;
o[ 9] = x2 >>> 8 & 0xff;
o[10] = x2 >>> 16 & 0xff;
o[11] = x2 >>> 24 & 0xff;
o[12] = x3 >>> 0 & 0xff;
o[13] = x3 >>> 8 & 0xff;
o[14] = x3 >>> 16 & 0xff;
o[15] = x3 >>> 24 & 0xff;
o[16] = x4 >>> 0 & 0xff;
o[17] = x4 >>> 8 & 0xff;
o[18] = x4 >>> 16 & 0xff;
o[19] = x4 >>> 24 & 0xff;
o[20] = x5 >>> 0 & 0xff;
o[21] = x5 >>> 8 & 0xff;
o[22] = x5 >>> 16 & 0xff;
o[23] = x5 >>> 24 & 0xff;
o[24] = x6 >>> 0 & 0xff;
o[25] = x6 >>> 8 & 0xff;
o[26] = x6 >>> 16 & 0xff;
o[27] = x6 >>> 24 & 0xff;
o[28] = x7 >>> 0 & 0xff;
o[29] = x7 >>> 8 & 0xff;
o[30] = x7 >>> 16 & 0xff;
o[31] = x7 >>> 24 & 0xff;
o[32] = x8 >>> 0 & 0xff;
o[33] = x8 >>> 8 & 0xff;
o[34] = x8 >>> 16 & 0xff;
o[35] = x8 >>> 24 & 0xff;
o[36] = x9 >>> 0 & 0xff;
o[37] = x9 >>> 8 & 0xff;
o[38] = x9 >>> 16 & 0xff;
o[39] = x9 >>> 24 & 0xff;
o[40] = x10 >>> 0 & 0xff;
o[41] = x10 >>> 8 & 0xff;
o[42] = x10 >>> 16 & 0xff;
o[43] = x10 >>> 24 & 0xff;
o[44] = x11 >>> 0 & 0xff;
o[45] = x11 >>> 8 & 0xff;
o[46] = x11 >>> 16 & 0xff;
o[47] = x11 >>> 24 & 0xff;
o[48] = x12 >>> 0 & 0xff;
o[49] = x12 >>> 8 & 0xff;
o[50] = x12 >>> 16 & 0xff;
o[51] = x12 >>> 24 & 0xff;
o[52] = x13 >>> 0 & 0xff;
o[53] = x13 >>> 8 & 0xff;
o[54] = x13 >>> 16 & 0xff;
o[55] = x13 >>> 24 & 0xff;
o[56] = x14 >>> 0 & 0xff;
o[57] = x14 >>> 8 & 0xff;
o[58] = x14 >>> 16 & 0xff;
o[59] = x14 >>> 24 & 0xff;
o[60] = x15 >>> 0 & 0xff;
o[61] = x15 >>> 8 & 0xff;
o[62] = x15 >>> 16 & 0xff;
o[63] = x15 >>> 24 & 0xff;
}
function core_hsalsa20(o,p,k,c) {
var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
x15 = j15, u;
for (var i = 0; i < 20; i += 2) {
u = x0 + x12 | 0;
x4 ^= u<<7 | u>>>(32-7);
u = x4 + x0 | 0;
x8 ^= u<<9 | u>>>(32-9);
u = x8 + x4 | 0;
x12 ^= u<<13 | u>>>(32-13);
u = x12 + x8 | 0;
x0 ^= u<<18 | u>>>(32-18);
u = x5 + x1 | 0;
x9 ^= u<<7 | u>>>(32-7);
u = x9 + x5 | 0;
x13 ^= u<<9 | u>>>(32-9);
u = x13 + x9 | 0;
x1 ^= u<<13 | u>>>(32-13);
u = x1 + x13 | 0;
x5 ^= u<<18 | u>>>(32-18);
u = x10 + x6 | 0;
x14 ^= u<<7 | u>>>(32-7);
u = x14 + x10 | 0;
x2 ^= u<<9 | u>>>(32-9);
u = x2 + x14 | 0;
x6 ^= u<<13 | u>>>(32-13);
u = x6 + x2 | 0;
x10 ^= u<<18 | u>>>(32-18);
u = x15 + x11 | 0;
x3 ^= u<<7 | u>>>(32-7);
u = x3 + x15 | 0;
x7 ^= u<<9 | u>>>(32-9);
u = x7 + x3 | 0;
x11 ^= u<<13 | u>>>(32-13);
u = x11 + x7 | 0;
x15 ^= u<<18 | u>>>(32-18);
u = x0 + x3 | 0;
x1 ^= u<<7 | u>>>(32-7);
u = x1 + x0 | 0;
x2 ^= u<<9 | u>>>(32-9);
u = x2 + x1 | 0;
x3 ^= u<<13 | u>>>(32-13);
u = x3 + x2 | 0;
x0 ^= u<<18 | u>>>(32-18);
u = x5 + x4 | 0;
x6 ^= u<<7 | u>>>(32-7);
u = x6 + x5 | 0;
x7 ^= u<<9 | u>>>(32-9);
u = x7 + x6 | 0;
x4 ^= u<<13 | u>>>(32-13);
u = x4 + x7 | 0;
x5 ^= u<<18 | u>>>(32-18);
u = x10 + x9 | 0;
x11 ^= u<<7 | u>>>(32-7);
u = x11 + x10 | 0;
x8 ^= u<<9 | u>>>(32-9);
u = x8 + x11 | 0;
x9 ^= u<<13 | u>>>(32-13);
u = x9 + x8 | 0;
x10 ^= u<<18 | u>>>(32-18);
u = x15 + x14 | 0;
x12 ^= u<<7 | u>>>(32-7);
u = x12 + x15 | 0;
x13 ^= u<<9 | u>>>(32-9);
u = x13 + x12 | 0;
x14 ^= u<<13 | u>>>(32-13);
u = x14 + x13 | 0;
x15 ^= u<<18 | u>>>(32-18);
}
o[ 0] = x0 >>> 0 & 0xff;
o[ 1] = x0 >>> 8 & 0xff;
o[ 2] = x0 >>> 16 & 0xff;
o[ 3] = x0 >>> 24 & 0xff;
o[ 4] = x5 >>> 0 & 0xff;
o[ 5] = x5 >>> 8 & 0xff;
o[ 6] = x5 >>> 16 & 0xff;
o[ 7] = x5 >>> 24 & 0xff;
o[ 8] = x10 >>> 0 & 0xff;
o[ 9] = x10 >>> 8 & 0xff;
o[10] = x10 >>> 16 & 0xff;
o[11] = x10 >>> 24 & 0xff;
o[12] = x15 >>> 0 & 0xff;
o[13] = x15 >>> 8 & 0xff;
o[14] = x15 >>> 16 & 0xff;
o[15] = x15 >>> 24 & 0xff;
o[16] = x6 >>> 0 & 0xff;
o[17] = x6 >>> 8 & 0xff;
o[18] = x6 >>> 16 & 0xff;
o[19] = x6 >>> 24 & 0xff;
o[20] = x7 >>> 0 & 0xff;
o[21] = x7 >>> 8 & 0xff;
o[22] = x7 >>> 16 & 0xff;
o[23] = x7 >>> 24 & 0xff;
o[24] = x8 >>> 0 & 0xff;
o[25] = x8 >>> 8 & 0xff;
o[26] = x8 >>> 16 & 0xff;
o[27] = x8 >>> 24 & 0xff;
o[28] = x9 >>> 0 & 0xff;
o[29] = x9 >>> 8 & 0xff;
o[30] = x9 >>> 16 & 0xff;
o[31] = x9 >>> 24 & 0xff;
}
function crypto_core_salsa20(out,inp,k,c) {
core_salsa20(out,inp,k,c);
}
function crypto_core_hsalsa20(out,inp,k,c) {
core_hsalsa20(out,inp,k,c);
}
var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
// "expand 32-byte k"
function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
var z = new Uint8Array(16), x = new Uint8Array(64);
var u, i;
for (i = 0; i < 16; i++) z[i] = 0;
for (i = 0; i < 8; i++) z[i] = n[i];
while (b >= 64) {
crypto_core_salsa20(x,z,k,sigma);
for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
u = 1;
for (i = 8; i < 16; i++) {
u = u + (z[i] & 0xff) | 0;
z[i] = u & 0xff;
u >>>= 8;
}
b -= 64;
cpos += 64;
mpos += 64;
}
if (b > 0) {
crypto_core_salsa20(x,z,k,sigma);
for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
}
return 0;
}
function crypto_stream_salsa20(c,cpos,b,n,k) {
var z = new Uint8Array(16), x = new Uint8Array(64);
var u, i;
for (i = 0; i < 16; i++) z[i] = 0;
for (i = 0; i < 8; i++) z[i] = n[i];
while (b >= 64) {
crypto_core_salsa20(x,z,k,sigma);
for (i = 0; i < 64; i++) c[cpos+i] = x[i];
u = 1;
for (i = 8; i < 16; i++) {
u = u + (z[i] & 0xff) | 0;
z[i] = u & 0xff;
u >>>= 8;
}
b -= 64;
cpos += 64;
}
if (b > 0) {
crypto_core_salsa20(x,z,k,sigma);
for (i = 0; i < b; i++) c[cpos+i] = x[i];
}
return 0;
}
function crypto_stream(c,cpos,d,n,k) {
var s = new Uint8Array(32);
crypto_core_hsalsa20(s,n,k,sigma);
var sn = new Uint8Array(8);
for (var i = 0; i < 8; i++) sn[i] = n[i+16];
return crypto_stream_salsa20(c,cpos,d,sn,s);
}
function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
var s = new Uint8Array(32);
crypto_core_hsalsa20(s,n,k,sigma);
var sn = new Uint8Array(8);
for (var i = 0; i < 8; i++) sn[i] = n[i+16];
return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
}
/*
* Port of Andrew Moon's Poly1305-donna-16. Public domain.
* https://github.com/floodyberry/poly1305-donna
*/
var poly1305 = function(key) {
this.buffer = new Uint8Array(16);
this.r = new Uint16Array(10);
this.h = new Uint16Array(10);
this.pad = new Uint16Array(8);
this.leftover = 0;
this.fin = 0;
var t0, t1, t2, t3, t4, t5, t6, t7;
t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
this.r[5] = ((t4 >>> 1)) & 0x1ffe;
t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
this.r[9] = ((t7 >>> 5)) & 0x007f;
this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
};
poly1305.prototype.blocks = function(m, mpos, bytes) {
var hibit = this.fin ? 0 : (1 << 11);
var t0, t1, t2, t3, t4, t5, t6, t7, c;
var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
var h0 = this.h[0],
h1 = this.h[1],
h2 = this.h[2],
h3 = this.h[3],
h4 = this.h[4],
h5 = this.h[5],
h6 = this.h[6],
h7 = this.h[7],
h8 = this.h[8],
h9 = this.h[9];
var r0 = this.r[0],
r1 = this.r[1],
r2 = this.r[2],
r3 = this.r[3],
r4 = this.r[4],
r5 = this.r[5],
r6 = this.r[6],
r7 = this.r[7],
r8 = this.r[8],
r9 = this.r[9];
while (bytes >= 16) {
t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
h5 += ((t4 >>> 1)) & 0x1fff;
t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
h9 += ((t7 >>> 5)) | hibit;
c = 0;
d0 = c;
d0 += h0 * r0;
d0 += h1 * (5 * r9);
d0 += h2 * (5 * r8);
d0 += h3 * (5 * r7);
d0 += h4 * (5 * r6);
c = (d0 >>> 13); d0 &= 0x1fff;
d0 += h5 * (5 * r5);
d0 += h6 * (5 * r4);
d0 += h7 * (5 * r3);
d0 += h8 * (5 * r2);
d0 += h9 * (5 * r1);
c += (d0 >>> 13); d0 &= 0x1fff;
d1 = c;
d1 += h0 * r1;
d1 += h1 * r0;
d1 += h2 * (5 * r9);
d1 += h3 * (5 * r8);
d1 += h4 * (5 * r7);
c = (d1 >>> 13); d1 &= 0x1fff;
d1 += h5 * (5 * r6);
d1 += h6 * (5 * r5);
d1 += h7 * (5 * r4);
d1 += h8 * (5 * r3);
d1 += h9 * (5 * r2);
c += (d1 >>> 13); d1 &= 0x1fff;
d2 = c;
d2 += h0 * r2;
d2 += h1 * r1;
d2 += h2 * r0;
d2 += h3 * (5 * r9);
d2 += h4 * (5 * r8);
c = (d2 >>> 13); d2 &= 0x1fff;
d2 += h5 * (5 * r7);
d2 += h6 * (5 * r6);
d2 += h7 * (5 * r5);
d2 += h8 * (5 * r4);
d2 += h9 * (5 * r3);
c += (d2 >>> 13); d2 &= 0x1fff;
d3 = c;
d3 += h0 * r3;
d3 += h1 * r2;
d3 += h2 * r1;
d3 += h3 * r0;
d3 += h4 * (5 * r9);
c = (d3 >>> 13); d3 &= 0x1fff;
d3 += h5 * (5 * r8);
d3 += h6 * (5 * r7);
d3 += h7 * (5 * r6);
d3 += h8 * (5 * r5);
d3 += h9 * (5 * r4);
c += (d3 >>> 13); d3 &= 0x1fff;
d4 = c;
d4 += h0 * r4;
d4 += h1 * r3;
d4 += h2 * r2;
d4 += h3 * r1;
d4 += h4 * r0;
c = (d4 >>> 13); d4 &= 0x1fff;
d4 += h5 * (5 * r9);
d4 += h6 * (5 * r8);
d4 += h7 * (5 * r7);
d4 += h8 * (5 * r6);
d4 += h9 * (5 * r5);
c += (d4 >>> 13); d4 &= 0x1fff;
d5 = c;
d5 += h0 * r5;
d5 += h1 * r4;
d5 += h2 * r3;
d5 += h3 * r2;
d5 += h4 * r1;
c = (d5 >>> 13); d5 &= 0x1fff;
d5 += h5 * r0;
d5 += h6 * (5 * r9);
d5 += h7 * (5 * r8);
d5 += h8 * (5 * r7);
d5 += h9 * (5 * r6);
c += (d5 >>> 13); d5 &= 0x1fff;
d6 = c;
d6 += h0 * r6;
d6 += h1 * r5;
d6 += h2 * r4;
d6 += h3 * r3;
d6 += h4 * r2;
c = (d6 >>> 13); d6 &= 0x1fff;
d6 += h5 * r1;
d6 += h6 * r0;
d6 += h7 * (5 * r9);
d6 += h8 * (5 * r8);
d6 += h9 * (5 * r7);
c += (d6 >>> 13); d6 &= 0x1fff;
d7 = c;
d7 += h0 * r7;
d7 += h1 * r6;
d7 += h2 * r5;
d7 += h3 * r4;
d7 += h4 * r3;
c = (d7 >>> 13); d7 &= 0x1fff;
d7 += h5 * r2;
d7 += h6 * r1;
d7 += h7 * r0;
d7 += h8 * (5 * r9);
d7 += h9 * (5 * r8);
c += (d7 >>> 13); d7 &= 0x1fff;
d8 = c;
d8 += h0 * r8;
d8 += h1 * r7;
d8 += h2 * r6;
d8 += h3 * r5;
d8 += h4 * r4;
c = (d8 >>> 13); d8 &= 0x1fff;
d8 += h5 * r3;
d8 += h6 * r2;
d8 += h7 * r1;
d8 += h8 * r0;
d8 += h9 * (5 * r9);
c += (d8 >>> 13); d8 &= 0x1fff;
d9 = c;
d9 += h0 * r9;
d9 += h1 * r8;
d9 += h2 * r7;
d9 += h3 * r6;
d9 += h4 * r5;
c = (d9 >>> 13); d9 &= 0x1fff;
d9 += h5 * r4;
d9 += h6 * r3;
d9 += h7 * r2;
d9 += h8 * r1;
d9 += h9 * r0;
c += (d9 >>> 13); d9 &= 0x1fff;
c = (((c << 2) + c)) | 0;
c = (c + d0) | 0;
d0 = c & 0x1fff;
c = (c >>> 13);
d1 += c;
h0 = d0;
h1 = d1;
h2 = d2;
h3 = d3;
h4 = d4;
h5 = d5;
h6 = d6;
h7 = d7;
h8 = d8;
h9 = d9;
mpos += 16;
bytes -= 16;
}
this.h[0] = h0;
this.h[1] = h1;
this.h[2] = h2;
this.h[3] = h3;
this.h[4] = h4;
this.h[5] = h5;
this.h[6] = h6;
this.h[7] = h7;
this.h[8] = h8;
this.h[9] = h9;
};
poly1305.prototype.finish = function(mac, macpos) {
var g = new Uint16Array(10);
var c, mask, f, i;
if (this.leftover) {
i = this.leftover;
this.buffer[i++] = 1;
for (; i < 16; i++) this.buffer[i] = 0;
this.fin = 1;
this.blocks(this.buffer, 0, 16);
}
c = this.h[1] >>> 13;
this.h[1] &= 0x1fff;
for (i = 2; i < 10; i++) {
this.h[i] += c;
c = this.h[i] >>> 13;
this.h[i] &= 0x1fff;
}
this.h[0] += (c * 5);
c = this.h[0] >>> 13;
this.h[0] &= 0x1fff;
this.h[1] += c;
c = this.h[1] >>> 13;
this.h[1] &= 0x1fff;
this.h[2] += c;
g[0] = this.h[0] + 5;
c = g[0] >>> 13;
g[0] &= 0x1fff;
for (i = 1; i < 10; i++) {
g[i] = this.h[i] + c;
c = g[i] >>> 13;
g[i] &= 0x1fff;
}
g[9] -= (1 << 13);
mask = (g[9] >>> ((2 * 8) - 1)) - 1;
for (i = 0; i < 10; i++) g[i] &= mask;
mask = ~mask;
for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
f = this.h[0] + this.pad[0];
this.h[0] = f & 0xffff;
for (i = 1; i < 8; i++) {
f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
this.h[i] = f & 0xffff;
}
mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
};
poly1305.prototype.update = function(m, mpos, bytes) {
var i, want;
if (this.leftover) {
want = (16 - this.leftover);
if (want > bytes)
want = bytes;
for (i = 0; i < want; i++)
this.buffer[this.leftover + i] = m[mpos+i];
bytes -= want;
mpos += want;
this.leftover += want;
if (this.leftover < 16)
return;
this.blocks(buffer, 0, 16);
this.leftover = 0;
}
if (bytes >= 16) {
want = bytes - (bytes % 16);
this.blocks(m, mpos, want);
mpos += want;
bytes -= want;
}
if (bytes) {
for (i = 0; i < bytes; i++)
this.buffer[this.leftover + i] = m[mpos+i];
this.leftover += bytes;
}
};
function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
var s = new poly1305(k);
s.update(m, mpos, n);
s.finish(out, outpos);
return 0;
}
function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
var x = new Uint8Array(16);
crypto_onetimeauth(x,0,m,mpos,n,k);
return crypto_verify_16(h,hpos,x,0);
}
function crypto_secretbox(c,m,d,n,k) {
var i;
if (d < 32) return -1;
crypto_stream_xor(c,0,m,0,d,n,k);
crypto_onetimeauth(c, 16, c, 32, d - 32, c);
for (i = 0; i < 16; i++) c[i] = 0;
return 0;
}
function crypto_secretbox_open(m,c,d,n,k) {
var i;
var x = new Uint8Array(32);
if (d < 32) return -1;
crypto_stream(x,0,32,n,k);
if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
crypto_stream_xor(m,0,c,0,d,n,k);
for (i = 0; i < 32; i++) m[i] = 0;
return 0;
}
function set25519(r, a) {
var i;
for (i = 0; i < 16; i++) r[i] = a[i]|0;
}
function car25519(o) {
var i, v, c = 1;
for (i = 0; i < 16; i++) {
v = o[i] + c + 65535;
c = Math.floor(v / 65536);
o[i] = v - c * 65536;
}
o[0] += c-1 + 37 * (c-1);
}
function sel25519(p, q, b) {
var t, c = ~(b-1);
for (var i = 0; i < 16; i++) {
t = c & (p[i] ^ q[i]);
p[i] ^= t;
q[i] ^= t;
}
}
function pack25519(o, n) {
var i, j, b;
var m = gf(), t = gf();
for (i = 0; i < 16; i++) t[i] = n[i];
car25519(t);
car25519(t);
car25519(t);
for (j = 0; j < 2; j++) {
m[0] = t[0] - 0xffed;
for (i = 1; i < 15; i++) {
m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
m[i-1] &= 0xffff;
}
m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
b = (m[15]>>16) & 1;
m[14] &= 0xffff;
sel25519(t, m, 1-b);
}
for (i = 0; i < 16; i++) {
o[2*i] = t[i] & 0xff;
o[2*i+1] = t[i]>>8;
}
}
function neq25519(a, b) {
var c = new Uint8Array(32), d = new Uint8Array(32);
pack25519(c, a);
pack25519(d, b);
return crypto_verify_32(c, 0, d, 0);
}
function par25519(a) {
var d = new Uint8Array(32);
pack25519(d, a);
return d[0] & 1;
}
function unpack25519(o, n) {
var i;
for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
o[15] &= 0x7fff;
}
function A(o, a, b) {
for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
}
function Z(o, a, b) {
for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
}
function M(o, a, b) {
var v, c,
t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
b0 = b[0],
b1 = b[1],
b2 = b[2],
b3 = b[3],
b4 = b[4],
b5 = b[5],
b6 = b[6],
b7 = b[7],
b8 = b[8],
b9 = b[9],
b10 = b[10],
b11 = b[11],
b12 = b[12],
b13 = b[13],
b14 = b[14],
b15 = b[15];
v = a[0];
t0 += v * b0;
t1 += v * b1;
t2 += v * b2;
t3 += v * b3;
t4 += v * b4;
t5 += v * b5;
t6 += v * b6;
t7 += v * b7;
t8 += v * b8;
t9 += v * b9;
t10 += v * b10;
t11 += v * b11;
t12 += v * b12;
t13 += v * b13;
t14 += v * b14;
t15 += v * b15;
v = a[1];
t1 += v * b0;
t2 += v * b1;
t3 += v * b2;
t4 += v * b3;
t5 += v * b4;
t6 += v * b5;
t7 += v * b6;
t8 += v * b7;
t9 += v * b8;
t10 += v * b9;
t11 += v * b10;
t12 += v * b11;
t13 += v * b12;
t14 += v * b13;
t15 += v * b14;
t16 += v * b15;
v = a[2];
t2 += v * b0;
t3 += v * b1;
t4 += v * b2;
t5 += v * b3;
t6 += v * b4;
t7 += v * b5;
t8 += v * b6;
t9 += v * b7;
t10 += v * b8;
t11 += v * b9;
t12 += v * b10;
t13 += v * b11;
t14 += v * b12;
t15 += v * b13;
t16 += v * b14;
t17 += v * b15;
v = a[3];
t3 += v * b0;
t4 += v * b1;
t5 += v * b2;
t6 += v * b3;
t7 += v * b4;
t8 += v * b5;
t9 += v * b6;
t10 += v * b7;
t11 += v * b8;
t12 += v * b9;
t13 += v * b10;
t14 += v * b11;
t15 += v * b12;
t16 += v * b13;
t17 += v * b14;
t18 += v * b15;
v = a[4];
t4 += v * b0;
t5 += v * b1;
t6 += v * b2;
t7 += v * b3;
t8 += v * b4;
t9 += v * b5;
t10 += v * b6;
t11 += v * b7;
t12 += v * b8;
t13 += v * b9;
t14 += v * b10;
t15 += v * b11;
t16 += v * b12;
t17 += v * b13;
t18 += v * b14;
t19 += v * b15;
v = a[5];
t5 += v * b0;
t6 += v * b1;
t7 += v * b2;
t8 += v * b3;
t9 += v * b4;
t10 += v * b5;
t11 += v * b6;
t12 += v * b7;
t13 += v * b8;
t14 += v * b9;
t15 += v * b10;
t16 += v * b11;
t17 += v * b12;
t18 += v * b13;
t19 += v * b14;
t20 += v * b15;
v = a[6];
t6 += v * b0;
t7 += v * b1;
t8 += v * b2;
t9 += v * b3;
t10 += v * b4;
t11 += v * b5;
t12 += v * b6;
t13 += v * b7;
t14 += v * b8;
t15 += v * b9;
t16 += v * b10;
t17 += v * b11;
t18 += v * b12;
t19 += v * b13;
t20 += v * b14;
t21 += v * b15;
v = a[7];
t7 += v * b0;
t8 += v * b1;
t9 += v * b2;
t10 += v * b3;
t11 += v * b4;
t12 += v * b5;
t13 += v * b6;
t14 += v * b7;
t15 += v * b8;
t16 += v * b9;
t17 += v * b10;
t18 += v * b11;
t19 += v * b12;
t20 += v * b13;
t21 += v * b14;
t22 += v * b15;
v = a[8];
t8 += v * b0;
t9 += v * b1;
t10 += v * b2;
t11 += v * b3;
t12 += v * b4;
t13 += v * b5;
t14 += v * b6;
t15 += v * b7;
t16 += v * b8;
t17 += v * b9;
t18 += v * b10;
t19 += v * b11;
t20 += v * b12;
t21 += v * b13;
t22 += v * b14;
t23 += v * b15;
v = a[9];
t9 += v * b0;
t10 += v * b1;
t11 += v * b2;
t12 += v * b3;
t13 += v * b4;
t14 += v * b5;
t15 += v * b6;
t16 += v * b7;
t17 += v * b8;
t18 += v * b9;
t19 += v * b10;
t20 += v * b11;
t21 += v * b12;
t22 += v * b13;
t23 += v * b14;
t24 += v * b15;
v = a[10];
t10 += v * b0;
t11 += v * b1;
t12 += v * b2;
t13 += v * b3;
t14 += v * b4;
t15 += v * b5;
t16 += v * b6;
t17 += v * b7;
t18 += v * b8;
t19 += v * b9;
t20 += v * b10;
t21 += v * b11;
t22 += v * b12;
t23 += v * b13;
t24 += v * b14;
t25 += v * b15;
v = a[11];
t11 += v * b0;
t12 += v * b1;
t13 += v * b2;
t14 += v * b3;
t15 += v * b4;
t16 += v * b5;
t17 += v * b6;
t18 += v * b7;
t19 += v * b8;
t20 += v * b9;
t21 += v * b10;
t22 += v * b11;
t23 += v * b12;
t24 += v * b13;
t25 += v * b14;
t26 += v * b15;
v = a[12];
t12 += v * b0;
t13 += v * b1;
t14 += v * b2;
t15 += v * b3;
t16 += v * b4;
t17 += v * b5;
t18 += v * b6;
t19 += v * b7;
t20 += v * b8;
t21 += v * b9;
t22 += v * b10;
t23 += v * b11;
t24 += v * b12;
t25 += v * b13;
t26 += v * b14;
t27 += v * b15;
v = a[13];
t13 += v * b0;
t14 += v * b1;
t15 += v * b2;
t16 += v * b3;
t17 += v * b4;
t18 += v * b5;
t19 += v * b6;
t20 += v * b7;
t21 += v * b8;
t22 += v * b9;
t23 += v * b10;
t24 += v * b11;
t25 += v * b12;
t26 += v * b13;
t27 += v * b14;
t28 += v * b15;
v = a[14];
t14 += v * b0;
t15 += v * b1;
t16 += v * b2;
t17 += v * b3;
t18 += v * b4;
t19 += v * b5;
t20 += v * b6;
t21 += v * b7;
t22 += v * b8;
t23 += v * b9;
t24 += v * b10;
t25 += v * b11;
t26 += v * b12;
t27 += v * b13;
t28 += v * b14;
t29 += v * b15;
v = a[15];
t15 += v * b0;
t16 += v * b1;
t17 += v * b2;
t18 += v * b3;
t19 += v * b4;
t20 += v * b5;
t21 += v * b6;
t22 += v * b7;
t23 += v * b8;
t24 += v * b9;
t25 += v * b10;
t26 += v * b11;
t27 += v * b12;
t28 += v * b13;
t29 += v * b14;
t30 += v * b15;
t0 += 38 * t16;
t1 += 38 * t17;
t2 += 38 * t18;
t3 += 38 * t19;
t4 += 38 * t20;
t5 += 38 * t21;
t6 += 38 * t22;
t7 += 38 * t23;
t8 += 38 * t24;
t9 += 38 * t25;
t10 += 38 * t26;
t11 += 38 * t27;
t12 += 38 * t28;
t13 += 38 * t29;
t14 += 38 * t30;
// t15 left as is
// first car
c = 1;
v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
t0 += c-1 + 37 * (c-1);
// second car
c = 1;
v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
t0 += c-1 + 37 * (c-1);
o[ 0] = t0;
o[ 1] = t1;
o[ 2] = t2;
o[ 3] = t3;
o[ 4] = t4;
o[ 5] = t5;
o[ 6] = t6;
o[ 7] = t7;
o[ 8] = t8;
o[ 9] = t9;
o[10] = t10;
o[11] = t11;
o[12] = t12;
o[13] = t13;
o[14] = t14;
o[15] = t15;
}
function S(o, a) {
M(o, a, a);
}
function inv25519(o, i) {
var c = gf();
var a;
for (a = 0; a < 16; a++) c[a] = i[a];
for (a = 253; a >= 0; a--) {
S(c, c);
if(a !== 2 && a !== 4) M(c, c, i);
}
for (a = 0; a < 16; a++) o[a] = c[a];
}
function pow2523(o, i) {
var c = gf();
var a;
for (a = 0; a < 16; a++) c[a] = i[a];
for (a = 250; a >= 0; a--) {
S(c, c);
if(a !== 1) M(c, c, i);
}
for (a = 0; a < 16; a++) o[a] = c[a];
}
function crypto_scalarmult(q, n, p) {
var z = new Uint8Array(32);
var x = new Float64Array(80), r, i;
var a = gf(), b = gf(), c = gf(),
d = gf(), e = gf(), f = gf();
for (i = 0; i < 31; i++) z[i] = n[i];
z[31]=(n[31]&127)|64;
z[0]&=248;
unpack25519(x,p);
for (i = 0; i < 16; i++) {
b[i]=x[i];
d[i]=a[i]=c[i]=0;
}
a[0]=d[0]=1;
for (i=254;i>=0;--i) {
r=(z[i>>>3]>>>(i&7))&1;
sel25519(a,b,r);
sel25519(c,d,r);
A(e,a,c);
Z(a,a,c);
A(c,b,d);
Z(b,b,d);
S(d,e);
S(f,a);
M(a,c,a);
M(c,b,e);
A(e,a,c);
Z(a,a,c);
S(b,a);
Z(c,d,f);
M(a,c,_121665);
A(a,a,d);
M(c,c,a);
M(a,d,f);
M(d,b,x);
S(b,e);
sel25519(a,b,r);
sel25519(c,d,r);
}
for (i = 0; i < 16; i++) {
x[i+16]=a[i];
x[i+32]=c[i];
x[i+48]=b[i];
x[i+64]=d[i];
}
var x32 = x.subarray(32);
var x16 = x.subarray(16);
inv25519(x32,x32);
M(x16,x16,x32);
pack25519(q,x16);
return 0;
}
function crypto_scalarmult_base(q, n) {
return crypto_scalarmult(q, n, _9);
}
function crypto_box_keypair(y, x) {
randombytes(x, 32);
return crypto_scalarmult_base(y, x);
}
function crypto_box_beforenm(k, y, x) {
var s = new Uint8Array(32);
crypto_scalarmult(s, x, y);
return crypto_core_hsalsa20(k, _0, s, sigma);
}
var crypto_box_afternm = crypto_secretbox;
var crypto_box_open_afternm = crypto_secretbox_open;
function crypto_box(c, m, d, n, y, x) {
var k = new Uint8Array(32);
crypto_box_beforenm(k, y, x);
return crypto_box_afternm(c, m, d, n, k);
}
function crypto_box_open(m, c, d, n, y, x) {
var k = new Uint8Array(32);
crypto_box_beforenm(k, y, x);
return crypto_box_open_afternm(m, c, d, n, k);
}
var K = [
0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
];
function crypto_hashblocks_hl(hh, hl, m, n) {
var wh = new Int32Array(16), wl = new Int32Array(16),
bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
th, tl, i, j, h, l, a, b, c, d;
var ah0 = hh[0],
ah1 = hh[1],
ah2 = hh[2],
ah3 = hh[3],
ah4 = hh[4],
ah5 = hh[5],
ah6 = hh[6],
ah7 = hh[7],
al0 = hl[0],
al1 = hl[1],
al2 = hl[2],
al3 = hl[3],
al4 = hl[4],
al5 = hl[5],
al6 = hl[6],
al7 = hl[7];
var pos = 0;
while (n >= 128) {
for (i = 0; i < 16; i++) {
j = 8 * i + pos;
wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
}
for (i = 0; i < 80; i++) {
bh0 = ah0;
bh1 = ah1;
bh2 = ah2;
bh3 = ah3;
bh4 = ah4;
bh5 = ah5;
bh6 = ah6;
bh7 = ah7;
bl0 = al0;
bl1 = al1;
bl2 = al2;
bl3 = al3;
bl4 = al4;
bl5 = al5;
bl6 = al6;
bl7 = al7;
// add
h = ah7;
l = al7;
a = l & 0xffff; b = l >>> 16;
c = h & 0xffff; d = h >>> 16;
// Sigma1
h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
a += l & 0xffff; b += l >>> 16;
c += h & 0xffff; d += h >>> 16;
// Ch
h = (ah4 & ah5) ^ (~ah4 & ah6);
l = (al4 & al5) ^ (~al4 & al6);
a += l & 0xffff; b += l >>> 16;
c += h & 0xffff; d += h >>> 16;
// K
h = K[i*2];
l = K[i*2+1];
a += l & 0xffff; b += l >>> 16;
c += h & 0xffff; d += h >>> 16;
// w
h = wh[i%16];
l = wl[i%16];
a += l & 0xffff; b += l >>> 16;
c += h & 0xffff; d += h >>> 16;
b += a >>> 16;
c += b >>> 16;
d += c >>> 16;
th = c & 0xffff | d << 16;
tl = a & 0xffff | b << 16;
// add
h = th;
l = tl;
a = l & 0xffff; b = l >>> 16;
c = h & 0xffff; d = h >>> 16;
// Sigma0
h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
a += l & 0xffff; b += l >>> 16;
c += h & 0xffff; d += h >>> 16;
// Maj
h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
a += l & 0xffff; b += l >>> 16;
c += h & 0xffff; d += h >>> 16;
b += a >>> 16;
c += b >>> 16;
d += c >>> 16;
bh7 = (c & 0xffff) | (d << 16);
bl7 = (a & 0xffff) | (b << 16);
// add
h = bh3;
l = bl3;
a = l & 0xffff; b = l >>> 16;
c = h & 0xffff; d = h >>> 16;
h = th;
l = tl;
a += l & 0xffff; b += l >>> 16;
c += h & 0xffff; d += h >>> 16;
b += a >>> 16;
c += b >>> 16;
d += c >>> 16;
bh3 = (c & 0xffff) | (d << 16);
bl3 = (a & 0xffff) | (b << 16);
ah1 = bh0;
ah2 = bh1;
ah3 = bh2;
ah4 = bh3;
ah5 = bh4;
ah6 = bh5;
ah7 = bh6;
ah0 = bh7;
al1 = bl0;
al2 = bl1;
al3 = bl2;
al4 = bl3;
al5 = bl4;
al6 = bl5;
al7 = bl6;
al0 = bl7;
if (i%16 === 15) {
for (j = 0; j < 16; j++) {
// add
h = wh[j];
l = wl[j];
a = l & 0xffff; b = l >>> 16;
c = h & 0xffff; d = h >>> 16;
h = wh[(j+9)%16];
l = wl[(j+9)%16];
a += l & 0xffff; b += l >>> 16;
c += h & 0xffff; d += h >>> 16;
// sigma0
th = wh[(j+1)%16];
tl = wl[(j+1)%16];
h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
a += l & 0xffff; b += l >>> 16;
c += h & 0xffff; d += h >>> 16;
// sigma1
th = wh[(j+14)%16];
tl = wl[(j+14)%16];
h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
a += l & 0xffff; b += l >>> 16;
c += h & 0xffff; d += h >>> 16;
b += a >>> 16;
c += b >>> 16;
d += c >>> 16;
wh[j] = (c & 0xffff) | (d << 16);
wl[j] = (a & 0xffff) | (b << 16);
}
}
}
// add
h = ah0;
l = al0;
a = l & 0xffff; b = l >>> 16;
c = h & 0xffff; d = h >>> 16;
h = hh[0];
l = hl[0];
a += l & 0xffff; b += l >>> 16;
c += h & 0xffff; d += h >>> 16;
b += a >>> 16;
c += b >>> 16;
d += c >>> 16;
hh[0] = ah0 = (c & 0xffff) | (d << 16);
hl[0] = al0 = (a & 0xffff) | (b << 16);
h = ah1;
l = al1;
a = l & 0xffff; b = l >>> 16;
c = h & 0xffff; d = h >>> 16;
h = hh[1];
l = hl[1];
a += l & 0xffff; b += l >>> 16;
c += h & 0xffff; d += h >>> 16;
b += a >>> 16;
c += b >>> 16;
d += c >>> 16;
hh[1] = ah1 = (c & 0xffff) | (d << 16);
hl[1] = al1 = (a & 0xffff) | (b << 16);
h = ah2;
l = al2;
a = l & 0xffff; b = l >>> 16;
c = h & 0xffff; d = h >>> 16;
h = hh[2];
l = hl[2];
a += l & 0xffff; b += l >>> 16;
c += h & 0xffff; d += h >>> 16;
b += a >>> 16;
c += b >>> 16;
d += c >>> 16;
hh[2] = ah2 = (c & 0xffff) | (d << 16);
hl[2] = al2 = (a & 0xffff) | (b << 16);
h = ah3;
l = al3;
a = l & 0xffff; b = l >>> 16;
c = h & 0xffff; d = h >>> 16;
h = hh[3];
l = hl[3];
a += l & 0xffff; b += l >>> 16;
c += h & 0xffff; d += h >>> 16;
b += a >>> 16;
c += b >>> 16;
d += c >>> 16;
hh[3] = ah3 = (c & 0xffff) | (d << 16);
hl[3] = al3 = (a & 0xffff) | (b << 16);
h = ah4;
l = al4;
a = l & 0xffff; b = l >>> 16;
c = h & 0xffff; d = h >>> 16;
h = hh[4];
l = hl[4];
a += l & 0xffff; b += l >>> 16;
c += h & 0xffff; d += h >>> 16;
b += a >>> 16;
c += b >>> 16;
d += c >>> 16;
hh[4] = ah4 = (c & 0xffff) | (d << 16);
hl[4] = al4 = (a & 0xffff) | (b << 16);
h = ah5;
l = al5;
a = l & 0xffff; b = l >>> 16;
c = h & 0xffff; d = h >>> 16;
h = hh[5];
l = hl[5];
a += l & 0xffff; b += l >>> 16;
c += h & 0xffff; d += h >>> 16;
b += a >>> 16;
c += b >>> 16;
d += c >>> 16;
hh[5] = ah5 = (c & 0xffff) | (d << 16);
hl[5] = al5 = (a & 0xffff) | (b << 16);
h = ah6;
l = al6;
a = l & 0xffff; b = l >>> 16;
c = h & 0xffff; d = h >>> 16;
h = hh[6];
l = hl[6];
a += l & 0xffff; b += l >>> 16;
c += h & 0xffff; d += h >>> 16;
b += a >>> 16;
c += b >>> 16;
d += c >>> 16;
hh[6] = ah6 = (c & 0xffff) | (d << 16);
hl[6] = al6 = (a & 0xffff) | (b << 16);
h = ah7;
l = al7;
a = l & 0xffff; b = l >>> 16;
c = h & 0xffff; d = h >>> 16;
h = hh[7];
l = hl[7];
a += l & 0xffff; b += l >>> 16;
c += h & 0xffff; d += h >>> 16;
b += a >>> 16;
c += b >>> 16;
d += c >>> 16;
hh[7] = ah7 = (c & 0xffff) | (d << 16);
hl[7] = al7 = (a & 0xffff) | (b << 16);
pos += 128;
n -= 128;
}
return n;
}
function crypto_hash(out, m, n) {
var hh = new Int32Array(8),
hl = new Int32Array(8),
x = new Uint8Array(256),
i, b = n;
hh[0] = 0x6a09e667;
hh[1] = 0xbb67ae85;
hh[2] = 0x3c6ef372;
hh[3] = 0xa54ff53a;
hh[4] = 0x510e527f;
hh[5] = 0x9b05688c;
hh[6] = 0x1f83d9ab;
hh[7] = 0x5be0cd19;
hl[0] = 0xf3bcc908;
hl[1] = 0x84caa73b;
hl[2] = 0xfe94f82b;
hl[3] = 0x5f1d36f1;
hl[4] = 0xade682d1;
hl[5] = 0x2b3e6c1f;
hl[6] = 0xfb41bd6b;
hl[7] = 0x137e2179;
crypto_hashblocks_hl(hh, hl, m, n);
n %= 128;
for (i = 0; i < n; i++) x[i] = m[b-n+i];
x[n] = 128;
n = 256-128*(n<112?1:0);
x[n-9] = 0;
ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
crypto_hashblocks_hl(hh, hl, x, n);
for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
return 0;
}
function add(p, q) {
var a = gf(), b = gf(), c = gf(),
d = gf(), e = gf(), f = gf(),
g = gf(), h = gf(), t = gf();
Z(a, p[1], p[0]);
Z(t, q[1], q[0]);
M(a, a, t);
A(b, p[0], p[1]);
A(t, q[0], q[1]);
M(b, b, t);
M(c, p[3], q[3]);
M(c, c, D2);
M(d, p[2], q[2]);
A(d, d, d);
Z(e, b, a);
Z(f, d, c);
A(g, d, c);
A(h, b, a);
M(p[0], e, f);
M(p[1], h, g);
M(p[2], g, f);
M(p[3], e, h);
}
function cswap(p, q, b) {
var i;
for (i = 0; i < 4; i++) {
sel25519(p[i], q[i], b);
}
}
function pack(r, p) {
var tx = gf(), ty = gf(), zi = gf();
inv25519(zi, p[2]);
M(tx, p[0], zi);
M(ty, p[1], zi);
pack25519(r, ty);
r[31] ^= par25519(tx) << 7;
}
function scalarmult(p, q, s) {
var b, i;
set25519(p[0], gf0);
set25519(p[1], gf1);
set25519(p[2], gf1);
set25519(p[3], gf0);
for (i = 255; i >= 0; --i) {
b = (s[(i/8)|0] >> (i&7)) & 1;
cswap(p, q, b);
add(q, p);
add(p, p);
cswap(p, q, b);
}
}
function scalarbase(p, s) {
var q = [gf(), gf(), gf(), gf()];
set25519(q[0], X);
set25519(q[1], Y);
set25519(q[2], gf1);
M(q[3], X, Y);
scalarmult(p, q, s);
}
function crypto_sign_keypair(pk, sk, seeded) {
var d = new Uint8Array(64);
var p = [gf(), gf(), gf(), gf()];
var i;
if (!seeded) randombytes(sk, 32);
crypto_hash(d, sk, 32);
d[0] &= 248;
d[31] &= 127;
d[31] |= 64;
scalarbase(p, d);
pack(pk, p);
for (i = 0; i < 32; i++) sk[i+32] = pk[i];
return 0;
}
var L = new Float64Array([0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10]);
function modL(r, x) {
var carry, i, j, k;
for (i = 63; i >= 32; --i) {
carry = 0;
for (j = i - 32, k = i - 12; j < k; ++j) {
x[j] += carry - 16 * x[i] * L[j - (i - 32)];
carry = (x[j] + 128) >> 8;
x[j] -= carry * 256;
}
x[j] += carry;
x[i] = 0;
}
carry = 0;
for (j = 0; j < 32; j++) {
x[j] += carry - (x[31] >> 4) * L[j];
carry = x[j] >> 8;
x[j] &= 255;
}
for (j = 0; j < 32; j++) x[j] -= carry * L[j];
for (i = 0; i < 32; i++) {
x[i+1] += x[i] >> 8;
r[i] = x[i] & 255;
}
}
function reduce(r) {
var x = new Float64Array(64), i;
for (i = 0; i < 64; i++) x[i] = r[i];
for (i = 0; i < 64; i++) r[i] = 0;
modL(r, x);
}
// Note: difference from C - smlen returned, not passed as argument.
function crypto_sign(sm, m, n, sk) {
var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
var i, j, x = new Float64Array(64);
var p = [gf(), gf(), gf(), gf()];
crypto_hash(d, sk, 32);
d[0] &= 248;
d[31] &= 127;
d[31] |= 64;
var smlen = n + 64;
for (i = 0; i < n; i++) sm[64 + i] = m[i];
for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
crypto_hash(r, sm.subarray(32), n+32);
reduce(r);
scalarbase(p, r);
pack(sm, p);
for (i = 32; i < 64; i++) sm[i] = sk[i];
crypto_hash(h, sm, n + 64);
reduce(h);
for (i = 0; i < 64; i++) x[i] = 0;
for (i = 0; i < 32; i++) x[i] = r[i];
for (i = 0; i < 32; i++) {
for (j = 0; j < 32; j++) {
x[i+j] += h[i] * d[j];
}
}
modL(sm.subarray(32), x);
return smlen;
}
function unpackneg(r, p) {
var t = gf(), chk = gf(), num = gf(),
den = gf(), den2 = gf(), den4 = gf(),
den6 = gf();
set25519(r[2], gf1);
unpack25519(r[1], p);
S(num, r[1]);
M(den, num, D);
Z(num, num, r[2]);
A(den, r[2], den);
S(den2, den);
S(den4, den2);
M(den6, den4, den2);
M(t, den6, num);
M(t, t, den);
pow2523(t, t);
M(t, t, num);
M(t, t, den);
M(t, t, den);
M(r[0], t, den);
S(chk, r[0]);
M(chk, chk, den);
if (neq25519(chk, num)) M(r[0], r[0], I);
S(chk, r[0]);
M(chk, chk, den);
if (neq25519(chk, num)) return -1;
if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
M(r[3], r[0], r[1]);
return 0;
}
function crypto_sign_open(m, sm, n, pk) {
var i, mlen;
var t = new Uint8Array(32), h = new Uint8Array(64);
var p = [gf(), gf(), gf(), gf()],
q = [gf(), gf(), gf(), gf()];
mlen = -1;
if (n < 64) return -1;
if (unpackneg(q, pk)) return -1;
for (i = 0; i < n; i++) m[i] = sm[i];
for (i = 0; i < 32; i++) m[i+32] = pk[i];
crypto_hash(h, m, n);
reduce(h);
scalarmult(p, q, h);
scalarbase(q, sm.subarray(32));
add(p, q);
pack(t, p);
n -= 64;
if (crypto_verify_32(sm, 0, t, 0)) {
for (i = 0; i < n; i++) m[i] = 0;
return -1;
}
for (i = 0; i < n; i++) m[i] = sm[i + 64];
mlen = n;
return mlen;
}
var crypto_secretbox_KEYBYTES = 32,
crypto_secretbox_NONCEBYTES = 24,
crypto_secretbox_ZEROBYTES = 32,
crypto_secretbox_BOXZEROBYTES = 16,
crypto_scalarmult_BYTES = 32,
crypto_scalarmult_SCALARBYTES = 32,
crypto_box_PUBLICKEYBYTES = 32,
crypto_box_SECRETKEYBYTES = 32,
crypto_box_BEFORENMBYTES = 32,
crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
crypto_sign_BYTES = 64,
crypto_sign_PUBLICKEYBYTES = 32,
crypto_sign_SECRETKEYBYTES = 64,
crypto_sign_SEEDBYTES = 32,
crypto_hash_BYTES = 64;
nacl.lowlevel = {
crypto_core_hsalsa20: crypto_core_hsalsa20,
crypto_stream_xor : crypto_stream_xor,
crypto_stream : crypto_stream,
crypto_stream_salsa20_xor : crypto_stream_salsa20_xor,
crypto_stream_salsa20 : crypto_stream_salsa20,
crypto_onetimeauth : crypto_onetimeauth,
crypto_onetimeauth_verify : crypto_onetimeauth_verify,
crypto_verify_16 : crypto_verify_16,
crypto_verify_32 : crypto_verify_32,
crypto_secretbox : crypto_secretbox,
crypto_secretbox_open : crypto_secretbox_open,
crypto_scalarmult : crypto_scalarmult,
crypto_scalarmult_base : crypto_scalarmult_base,
crypto_box_beforenm : crypto_box_beforenm,
crypto_box_afternm : crypto_box_afternm,
crypto_box : crypto_box,
crypto_box_open : crypto_box_open,
crypto_box_keypair : crypto_box_keypair,
crypto_hash : crypto_hash,
crypto_sign : crypto_sign,
crypto_sign_keypair : crypto_sign_keypair,
crypto_sign_open : crypto_sign_open,
crypto_secretbox_KEYBYTES : crypto_secretbox_KEYBYTES,
crypto_secretbox_NONCEBYTES : crypto_secretbox_NONCEBYTES,
crypto_secretbox_ZEROBYTES : crypto_secretbox_ZEROBYTES,
crypto_secretbox_BOXZEROBYTES : crypto_secretbox_BOXZEROBYTES,
crypto_scalarmult_BYTES : crypto_scalarmult_BYTES,
crypto_scalarmult_SCALARBYTES : crypto_scalarmult_SCALARBYTES,
crypto_box_PUBLICKEYBYTES : crypto_box_PUBLICKEYBYTES,
crypto_box_SECRETKEYBYTES : crypto_box_SECRETKEYBYTES,
crypto_box_BEFORENMBYTES : crypto_box_BEFORENMBYTES,
crypto_box_NONCEBYTES : crypto_box_NONCEBYTES,
crypto_box_ZEROBYTES : crypto_box_ZEROBYTES,
crypto_box_BOXZEROBYTES : crypto_box_BOXZEROBYTES,
crypto_sign_BYTES : crypto_sign_BYTES,
crypto_sign_PUBLICKEYBYTES : crypto_sign_PUBLICKEYBYTES,
crypto_sign_SECRETKEYBYTES : crypto_sign_SECRETKEYBYTES,
crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
crypto_hash_BYTES : crypto_hash_BYTES
};
/* High-level API */
function checkLengths(k, n) {
if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
}
function checkBoxLengths(pk, sk) {
if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
}
function checkArrayTypes() {
var t, i;
for (i = 0; i < arguments.length; i++) {
if ((t = Object.prototype.toString.call(arguments[i])) !== '[object Uint8Array]')
throw new TypeError('unexpected type ' + t + ', use Uint8Array');
}
}
function cleanup(arr) {
for (var i = 0; i < arr.length; i++) arr[i] = 0;
}
nacl.util = {};
nacl.util.decodeUTF8 = function(s) {
var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
return b;
};
nacl.util.encodeUTF8 = function(arr) {
var i, s = [];
for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
return decodeURIComponent(escape(s.join('')));
};
nacl.util.encodeBase64 = function(arr) {
if (typeof btoa === 'undefined') {
return (new Buffer(arr)).toString('base64');
} else {
var i, s = [], len = arr.length;
for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
return btoa(s.join(''));
}
};
nacl.util.decodeBase64 = function(s) {
if (typeof atob === 'undefined') {
return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
} else {
var i, d = atob(s), b = new Uint8Array(d.length);
for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
return b;
}
};
nacl.randomBytes = function(n) {
var b = new Uint8Array(n);
randombytes(b, n);
return b;
};
nacl.secretbox = function(msg, nonce, key) {
checkArrayTypes(msg, nonce, key);
checkLengths(key, nonce);
var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
var c = new Uint8Array(m.length);
for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
crypto_secretbox(c, m, m.length, nonce, key);
return c.subarray(crypto_secretbox_BOXZEROBYTES);
};
nacl.secretbox.open = function(box, nonce, key) {
checkArrayTypes(box, nonce, key);
checkLengths(key, nonce);
var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
var m = new Uint8Array(c.length);
for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
if (c.length < 32) return false;
if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return false;
return m.subarray(crypto_secretbox_ZEROBYTES);
};
nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
nacl.scalarMult = function(n, p) {
checkArrayTypes(n, p);
if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
var q = new Uint8Array(crypto_scalarmult_BYTES);
crypto_scalarmult(q, n, p);
return q;
};
nacl.scalarMult.base = function(n) {
checkArrayTypes(n);
if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
var q = new Uint8Array(crypto_scalarmult_BYTES);
crypto_scalarmult_base(q, n);
return q;
};
nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
nacl.box = function(msg, nonce, publicKey, secretKey) {
var k = nacl.box.before(publicKey, secretKey);
return nacl.secretbox(msg, nonce, k);
};
nacl.box.before = function(publicKey, secretKey) {
checkArrayTypes(publicKey, secretKey);
checkBoxLengths(publicKey, secretKey);
var k = new Uint8Array(crypto_box_BEFORENMBYTES);
crypto_box_beforenm(k, publicKey, secretKey);
return k;
};
nacl.box.after = nacl.secretbox;
nacl.box.open = function(msg, nonce, publicKey, secretKey) {
var k = nacl.box.before(publicKey, secretKey);
return nacl.secretbox.open(msg, nonce, k);
};
nacl.box.open.after = nacl.secretbox.open;
nacl.box.keyPair = function() {
var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
crypto_box_keypair(pk, sk);
return {publicKey: pk, secretKey: sk};
};
nacl.box.keyPair.fromSecretKey = function(secretKey) {
checkArrayTypes(secretKey);
if (secretKey.length !== crypto_box_SECRETKEYBYTES)
throw new Error('bad secret key size');
var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
crypto_scalarmult_base(pk, secretKey);
return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
};
nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
nacl.box.nonceLength = crypto_box_NONCEBYTES;
nacl.box.overheadLength = nacl.secretbox.overheadLength;
nacl.sign = function(msg, secretKey) {
checkArrayTypes(msg, secretKey);
if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
throw new Error('bad secret key size');
var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
crypto_sign(signedMsg, msg, msg.length, secretKey);
return signedMsg;
};
nacl.sign.open = function(signedMsg, publicKey) {
if (arguments.length !== 2)
throw new Error('nacl.sign.open accepts 2 arguments; did you mean to use nacl.sign.detached.verify?');
checkArrayTypes(signedMsg, publicKey);
if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
throw new Error('bad public key size');
var tmp = new Uint8Array(signedMsg.length);
var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
if (mlen < 0) return null;
var m = new Uint8Array(mlen);
for (var i = 0; i < m.length; i++) m[i] = tmp[i];
return m;
};
nacl.sign.detached = function(msg, secretKey) {
var signedMsg = nacl.sign(msg, secretKey);
var sig = new Uint8Array(crypto_sign_BYTES);
for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
return sig;
};
nacl.sign.detached.verify = function(msg, sig, publicKey) {
checkArrayTypes(msg, sig, publicKey);
if (sig.length !== crypto_sign_BYTES)
throw new Error('bad signature size');
if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
throw new Error('bad public key size');
var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
var m = new Uint8Array(crypto_sign_BYTES + msg.length);
var i;
for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
};
nacl.sign.keyPair = function() {
var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
crypto_sign_keypair(pk, sk);
return {publicKey: pk, secretKey: sk};
};
nacl.sign.keyPair.fromSecretKey = function(secretKey) {
checkArrayTypes(secretKey);
if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
throw new Error('bad secret key size');
var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
};
nacl.sign.keyPair.fromSeed = function(seed) {
checkArrayTypes(seed);
if (seed.length !== crypto_sign_SEEDBYTES)
throw new Error('bad seed size');
var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
for (var i = 0; i < 32; i++) sk[i] = seed[i];
crypto_sign_keypair(pk, sk, true);
return {publicKey: pk, secretKey: sk};
};
nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
nacl.sign.seedLength = crypto_sign_SEEDBYTES;
nacl.sign.signatureLength = crypto_sign_BYTES;
nacl.hash = function(msg) {
checkArrayTypes(msg);
var h = new Uint8Array(crypto_hash_BYTES);
crypto_hash(h, msg, msg.length);
return h;
};
nacl.hash.hashLength = crypto_hash_BYTES;
nacl.verify = function(x, y) {
checkArrayTypes(x, y);
// Zero length arguments are considered not equal.
if (x.length === 0 || y.length === 0) return false;
if (x.length !== y.length) return false;
return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
};
nacl.setPRNG = function(fn) {
randombytes = fn;
};
(function() {
// Initialize PRNG if environment provides CSPRNG.
// If not, methods calling randombytes will throw.
var crypto;
if (typeof window !== 'undefined') {
// Browser.
if (window.crypto && window.crypto.getRandomValues) {
crypto = window.crypto; // Standard
} else if (window.msCrypto && window.msCrypto.getRandomValues) {
crypto = window.msCrypto; // Internet Explorer 11+
}
if (crypto) {
nacl.setPRNG(function(x, n) {
var i, v = new Uint8Array(n);
crypto.getRandomValues(v);
for (i = 0; i < n; i++) x[i] = v[i];
cleanup(v);
});
}
} else if (true) {
// Node.js.
crypto = __webpack_require__(27);
if (crypto) {
nacl.setPRNG(function(x, n) {
var i, v = crypto.randomBytes(n);
for (i = 0; i < n; i++) x[i] = v[i];
cleanup(v);
});
}
}
})();
})(typeof module !== 'undefined' && module.exports ? module.exports : (window.nacl = window.nacl || {}));
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(9).Buffer))
/***/ },
/* 27 */
/***/ function(module, exports, __webpack_require__) {
/* (ignored) */
/***/ },
/* 28 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
Object.defineProperty(exports, "__esModule", {
value: true
});
var _index = __webpack_require__(5);
var xdr = _index.xdr;
var Keypair = _index.Keypair;
var Hyper = _index.Hyper;
var UnsignedHyper = _index.UnsignedHyper;
var hash = _index.hash;
var encodeBase58Check = __webpack_require__(8).encodeBase58Check;
var Currency = __webpack_require__(29).Currency;
var best_r = __webpack_require__(30).best_r;
/**
* @class Operation
*/
var Operation = exports.Operation = (function () {
function Operation() {
_classCallCheck(this, Operation);
}
_createClass(Operation, null, {
createAccount: {
/**
* Create and fund a non existent account.
* @param {object} opts
* @param {string} opts.destination - Destination address to create an account for.
* @param {string} opts.startingBalance - Amount the account should be funded. Must be greater
* than the reserve balance amount.
* @param {string} [opts.source] - The source account for the payment. Defaults to the transaction's source account.
* @returns {xdr.CreateAccountOp}
*/
value: function createAccount(opts) {
if (!opts.destination) {
throw new Error("Must provide a destination for a payment operation");
}
if (!opts.startingBalance) {
throw new Error("Must provide a starting balance");
}
var attributes = {};
attributes.destination = Keypair.fromAddress(opts.destination).publicKey();
attributes.startingBalance = Hyper.fromString(String(opts.startingBalance));
var createAccount = new xdr.CreateAccountOp(attributes);
var opAttributes = {};
opAttributes.body = xdr.OperationBody.createAccount(createAccount);
if (opts.source) {
opAttributes.sourceAccount = Keypair.fromAddress(opts.source).publicKey();
}
var op = new xdr.Operation(opAttributes);
return op;
}
},
payment: {
/**
* Create a payment operation.
* @param {object} opts
* @param {string} opts.destination - The destination address.
* @param {Currency} opts.currency - The currency to send.
* @param {string} opts.amount - The amount to send.
* @param {string} [opts.source] - The source account for the payment. Defaults to the transaction's source account.
* @returns {xdr.PaymentOp}
*/
value: function payment(opts) {
if (!opts.destination) {
throw new Error("Must provide a destination for a payment operation");
}
if (!opts.currency) {
throw new Error("Must provide a currency for a payment operation");
}
if (!opts.amount) {
throw new Error("Must provide an amount for a payment operation");
}
var attributes = {};
attributes.destination = Keypair.fromAddress(opts.destination).publicKey();
attributes.currency = opts.currency.toXdrObject();
attributes.amount = Hyper.fromString(String(opts.amount));
var payment = new xdr.PaymentOp(attributes);
var opAttributes = {};
opAttributes.body = xdr.OperationBody.payment(payment);
if (opts.source) {
opAttributes.sourceAccount = Keypair.fromAddress(opts.source).publicKey();
}
var op = new xdr.Operation(opAttributes);
return op;
}
},
pathPayment: {
/**
* Returns a XDR PaymentOp. A "payment" operation send the specified amount to the
* destination account, optionally through a path. XLM payments create the destination
* account if it does not exist.
* @param {object} opts
* @param {Currency} opts.sendCurrency - The currency to pay with.
* @param {string} opts.sendMax - The maximum amount of sendCurrency to send.
* @param {string} opts.destination - The destination account to send to.
* @param {Currency} opts.destCurrency - The currency the destination will receive.
* @param {string|number} otps.destAmount - The amount the destination receives.
* @param {array} [opts.path] - An array of Currency objects to use as the path.
* @param {string} [opts.source] - The source account for the payment. Defaults to the transaction's source account.
* @returns {xdr.PathPaymentOp}
*/
value: function pathPayment(opts) {
if (!opts.sendCurrency) {
throw new Error("Must specify a send currency");
}
if (!opts.sendMax) {
throw new Error("Must specify a send max");
}
if (!opts.destination) {
throw new Error("Must provide a destination for a payment operation");
}
if (!opts.destCurrency) {
throw new Error("Must provide a destCurrency for a payment operation");
}
if (!opts.destAmount) {
throw new Error("Must provide an destAmount for a payment operation");
}
var attributes = {};
attributes.sendCurrency = opts.sendCurrency.toXdrObject();
attributes.sendMax = Hyper.fromString(String(opts.sendMax));
attributes.destination = Keypair.fromAddress(opts.destination).publicKey();
attributes.destCurrency = opts.destCurrency.toXdrObject();
attributes.destAmount = Hyper.fromString(String(opts.destAmount));
attributes.path = opts.path ? opts.path : [];
var payment = new xdr.PathPaymentOp(attributes);
var opAttributes = {};
opAttributes.body = xdr.OperationBody.pathPayment(payment);
if (opts.source) {
opAttributes.sourceAccount = Keypair.fromAddress(opts.source).publicKey();
}
var op = new xdr.Operation(opAttributes);
return op;
}
},
changeTrust: {
/**
* Returns an XDR ChangeTrustOp. A "change trust" operation adds, removes, or updates a
* trust line for a given currency from the source account to another. The issuer being
* trusted and the currency code are in the given Currency object.
* @param {object} opts
* @param {Currency} opts.currency - The currency for the trust line.
* @param {string} [opts.limit] - The limit for the currency, defaults to max int64.
* If the limit is set to 0 it deletes the trustline.
* @param {string} [opts.source] - The source account (defaults to transaction source).
* @returns {xdr.ChangeTrustOp}
*/
value: function changeTrust(opts) {
var attributes = {};
attributes.line = opts.currency.toXdrObject();
var limit = opts.limit ? limit : "9223372036854775807";
attributes.limit = Hyper.fromString(limit);
if (opts.source) {
attributes.source = opts.source ? opts.source.masterKeypair : null;
}
var changeTrustOP = new xdr.ChangeTrustOp(attributes);
var opAttributes = {};
opAttributes.body = xdr.OperationBody.changeTrust(changeTrustOP);
if (opts.source) {
opAttributes.sourceAccount = Keypair.fromAddress(opts.source).publicKey();
}
var op = new xdr.Operation(opAttributes);
return op;
}
},
allowTrust: {
/**
* Returns an XDR AllowTrustOp. An "allow trust" operation authorizes another
* account to hold your account's credit for a given currency.
* @param {object} opts
* @param {string} opts.trustor - The trusting account (the one being authorized)
* @param {string} opts.currencyCode - The currency code being authorized.
* @param {boolean} opts.authorize - True to authorize the line, false to deauthorize.
* @param {string} [opts.source] - The source account (defaults to transaction source).
* @returns {xdr.AllowTrustOp}
*/
value: function allowTrust(opts) {
var attributes = {};
attributes.trustor = Keypair.fromAddress(opts.trustor).publicKey();
var code = opts.currencyCode.length == 3 ? opts.currencyCode + "\u0000" : opts.currencyCode;
attributes.currency = xdr.AllowTrustOpCurrency.currencyTypeAlphanum(code);
attributes.authorize = opts.authorize;
var allowTrustOp = new xdr.AllowTrustOp(attributes);
var opAttributes = {};
opAttributes.body = xdr.OperationBody.allowTrust(allowTrustOp);
if (opts.source) {
opAttributes.sourceAccount = Keypair.fromAddress(opts.source).publicKey();
}
var op = new xdr.Operation(opAttributes);
return op;
}
},
setOptions: {
/**
* Returns an XDR SetOptionsOp. A "set options" operations set or clear account flags,
* set the account's inflation destination, and/or add new signers to the account.
* The account flags are the xdr.AccountFlags enum, which are:
* - AUTH_REQUIRED_FLAG = 0x1
* - AUTH_REVOCABLE_FLAG = 0x2
* @param {object} opts
* @param {string} [opts.inflationDest] - Set this address as the account's inflation destination.
* @param {number} [opts.clearFlags] - Bitmap integer for which flags to clear.
* @param {number} [opts.setFlags] - Bitmap integer for which flags to set.
* @param {array} [opts.thresholds] - Sets the weight of the master key and the threshold
* for each level low, medium, and high. Array of uint8.
* For now, see the stellar-core docs.
* @param {number} [opts.thresholds.weight] - The master key weight.
* @param {number} [opts.thresholds.low] - The sum weight for the low threshold.
* @param {number} [opts.thresholds.medium] - The sum weight for the medium threshold.
* @param {number} [opts.thresholds.high] - The sum weight for the high threshold.
* @param {object} [opts.signer] - Add or remove a signer from the account. The signer is
* deleted if the weight is 0.
* @param {string} [opts.signer.address] - The address of the new signer.
* @param {number} [opts.signer.weight] - The weight of the new signer (0 to delete or 1-255)
* @param {string} [opts.homeDomain] - sets the home domain used for reverse federation lookup.
* @returns {xdr.SetOptionsOp}
*/
value: function setOptions(opts) {
var attributes = {};
if (opts.inflationDest) {
attributes.inflationDest = Keypair.fromAddress(opts.inflationDest).publicKey();
}
if (opts.clearFlags) {
attributes.clearFlags = opts.clearFlags;
}
if (opts.setFlags) {
attributes.setFlags = opts.setFlags;
}
if (opts.thresholds) {
var thresholds = [];
thresholds[0] = 255 & opts.thresholds.weight;
thresholds[1] = 255 & opts.thresholds.low;
thresholds[2] = 255 & opts.thresholds.medium;
thresholds[3] = 255 & opts.thresholds.high;
attributes.thresholds = thresholds;
}
if (opts.signer) {
var signer = new xdr.Signer({
pubKey: Keypair.fromAddress(opts.signer.address).publicKey(),
weight: opts.signer.weight
});
attributes.signer = signer;
}
if (opts.homeDomain) {
attributes.homeDomain = opts.homeDomain;
}
var setOptionsOp = new xdr.SetOptionsOp(attributes);
var opAttributes = {};
opAttributes.body = xdr.OperationBody.setOption(setOptionsOp);
if (opts.source) {
opAttributes.sourceAccount = Keypair.fromAddress(opts.source).publicKey();
}
var op = new xdr.Operation(opAttributes);
return op;
}
},
manageOffer: {
/**
* Returns a XDR ManageOfferOp. A "manage offer" operation creates, updates, or
* deletes an offer.
* @param {object} opts
* @param {Currency} takerGets - What you're selling.
* @param {Currency} takerPays - What you're buying.
* @param {string} amount - The total amount you're selling. If 0, deletes the offer.
* @param {number} price - The exchange rate ratio (takerpay / takerget)
* @param {string} offerId - If 0, will create a new offer. Otherwise, edits an exisiting offer.
* @returns {xdr.ManageOfferOp}
*/
value: function manageOffer(opts) {
var attributes = {};
attributes.takerGets = opts.takerGets.toXdrObject();
attributes.takerPays = opts.takerPays.toXdrObject();
attributes.amount = Hyper.fromString(String(opts.amount));
var approx = best_r(opts.price);
attributes.price = new xdr.Price({
n: approx[0],
d: approx[1]
});
attributes.offerId = UnsignedHyper.fromString(String(opts.offerId));
var manageOfferOp = new xdr.ManageOfferOp(attributes);
var opAttributes = {};
opAttributes.body = xdr.OperationBody.manageOffer(manageOfferOp);
if (opts.source) {
opAttributes.sourceAccount = Keypair.fromAddress(opts.source).publicKey();
}
var op = new xdr.Operation(opAttributes);
return op;
}
},
createPassiveOffer: {
/**
* Returns a XDR CreatePasiveOfferOp. A "create passive offer" operation creates an
* offer that won't consume a counter offer that exactly matches this offer. This is
* useful for offers just used as 1:1 exchanges for path payments. Use manage offer
* to manage this offer after using this operation to create it.
* @param {object} opts
* @param {Currency} takerGets - What you're selling.
* @param {Currency} takerPays - What you're buying.
* @param {string} amount - The total amount you're selling. If 0, deletes the offer.
* @param {number} price - The exchange rate ratio (takerpay / takerget)
* @returns {xdr.CreatePassiveOfferOp}
*/
value: function createPassiveOffer(opts) {
var attributes = {};
attributes.takerGets = opts.takerGets.toXdrObject();
attributes.takerPays = opts.takerPays.toXdrObject();
attributes.amount = Hyper.fromString(String(opts.amount));
var approx = best_r(opts.price);
attributes.price = new xdr.Price({
n: approx[0],
d: approx[1]
});
var createPassiveOfferOp = new xdr.CreatePassiveOfferOp(attributes);
var opAttributes = {};
opAttributes.body = xdr.OperationBody.createPassiveOffer(createPassiveOfferOp);
if (opts.source) {
opAttributes.sourceAccount = Keypair.fromAddress(opts.source).publicKey();
}
var op = new xdr.Operation(opAttributes);
return op;
}
},
accountMerge: {
/**
* Transfers native balance to destination account.
* @param {object} opts
* @param {string} opts.destination - Destination to merge the source account into.
* @returns {xdr.AccountMergeOp}
*/
value: function accountMerge(opts) {
var opAttributes = {};
opAttributes.body = xdr.OperationBody.accountMerge(Keypair.fromAddress(opts.destination).publicKey());
if (opts.source) {
opAttributes.sourceAccount = Keypair.fromAddress(opts.source).publicKey();
}
var op = new xdr.Operation(opAttributes);
return op;
}
},
inflation: {
/**
* This operation generates the inflation.
* @param {object} [opts]
* @param {string} [opts.source] - The optional source account.
* @returns {xdr.AccountMergeOp}
*/
value: function inflation() {
var opts = arguments[0] === undefined ? {} : arguments[0];
var opAttributes = {};
opAttributes.body = xdr.OperationBody.inflation();
if (opts.source) {
opAttributes.sourceAccount = Keypair.fromAddress(opts.source).publicKey();
}
var op = new xdr.Operation(opAttributes);
return op;
}
},
operationToObject: {
/**
* Converts the XDR Operation object to the opts object used to create the XDR
* operation.
* @param {xdr.Operation} operation - An XDR Operation.
* @return {object}
*/
value: function operationToObject(operation) {
var obj = {};
var attrs = operation.body._value && operation.body._value._attributes;
switch (operation.body._switch.name) {
case "createAccount":
obj.type = "createAccount";
obj.destination = encodeBase58Check("accountId", attrs.destination);
obj.startingBalance = attrs.startingBalance.toString();
break;
case "payment":
obj.type = "payment";
obj.destination = encodeBase58Check("accountId", attrs.destination);
obj.currency = Currency.fromOperation(attrs.currency);
obj.amount = attrs.amount.toString();
break;
case "pathPayment":
obj.type = "pathPayment";
obj.sendCurrency = Currency.fromOperation(attrs.sendCurrency);
obj.sendMax = attrs.sendMax.toString();
obj.destination = encodeBase58Check("accountId", attrs.destination);
obj.destCurrency = Currency.fromOperation(attrs.destCurrency);
obj.destAmount = attrs.destAmount.toString();
obj.path = attrs.path;
break;
case "changeTrust":
obj.type = "changeTrust";
obj.line = Currency.fromOperation(attrs.line);
break;
case "allowTrust":
obj.type = "allowTrust";
obj.trustor = encodeBase58Check("accountId", attrs.trustor);
obj.currencyCode = attrs.currency._value.toString();
if (obj.currencyCode[3] === "\u0000") {
obj.currencyCode = obj.currencyCode.slice(0, 3);
}
obj.authorize = attrs.authorize;
break;
case "setOption":
obj.type = "setOptions";
if (attrs.inflationDest) {
obj.inflationDest = encodeBase58Check("accountId", attrs.inflationDest);
}
if (attrs.clearFlags) {
obj.clearFlags = attrs.clearFlags;
}
if (attrs.setFlags) {
obj.setFlags = attrs.setFlags;
}
if (attrs.thresholds) {
obj.thresholds = {
weight: Number(attrs.thresholds[0]),
low: Number(attrs.thresholds[1]),
medium: Number(attrs.thresholds[2]),
high: Number(attrs.thresholds[3]) };
}
if (attrs.signer) {
var signer = {};
signer.address = encodeBase58Check("accountId", attrs.signer._attributes.pubKey);
signer.weight = attrs.signer._attributes.weight;
obj.signer = signer;
}
if (attrs.homeDomain) {
obj.homeDomain = attrs.homeDomain;
}
break;
case "manageOffer":
obj.type = "manageOffer";
obj.takerGets = Currency.fromOperation(attrs.takerGets);
obj.takerPays = Currency.fromOperation(attrs.takerPays);
obj.amount = attrs.amount.toString();
obj.price = attrs.price._attributes.n / attrs.price._attributes.d;
obj.offerId = attrs.offerId.toString();
break;
case "createPassiveOffer":
obj.type = "createPassiveOffer";
obj.takerGets = Currency.fromOperation(attrs.takerGets);
obj.takerPays = Currency.fromOperation(attrs.takerPays);
obj.amount = attrs.amount.toString();
obj.price = attrs.price._attributes.n / attrs.price._attributes.d;
break;
case "accountMerge":
obj.type = "accountMerge";
obj.destination = encodeBase58Check("accountId", operation.body._value);
break;
case "inflation":
obj.type = "inflation";
break;
default:
throw new Error("Unknown operation");
}
return obj;
}
}
});
return Operation;
})();
/***/ },
/* 29 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
Object.defineProperty(exports, "__esModule", {
value: true
});
var _index = __webpack_require__(5);
var xdr = _index.xdr;
var Keypair = _index.Keypair;
var encodeBase58Check = __webpack_require__(8).encodeBase58Check;
/**
* Currency class represents a currency, either the native currency ("XLM")
* or a currency code / issuer address pair.
* @class Currency
*/
var Currency = exports.Currency = (function () {
/**
* A currency code describes a currency and issuer pair. In the case of the native
* currency XLM, the issuer will be null.
* @constructor
* @param {string} code - The currency code.
* @param {string} issuer - The address of the issuer.
*/
function Currency(code, issuer) {
_classCallCheck(this, Currency);
if (code.length != 3 && code.length != 4) {
throw new Error("Currency code must be 3 or 4 characters");
}
if (String(code).toLowerCase() !== "xlm" && !issuer) {
throw new Error("Issuer cannot be null");
}
// pad code with null byte if necessary
this.code = code.length == 3 ? code + "\u0000" : code;
this.issuer = issuer;
}
_createClass(Currency, {
toXdrObject: {
/**
* Returns the xdr object for this currency.
*/
value: function toXdrObject() {
if (this.isNative()) {
return xdr.Currency.currencyTypeNative();
} else {
// need to pad the currency code with the null byte
var currencyType = new xdr.CurrencyAlphaNum({
currencyCode: this.code,
issuer: Keypair.fromAddress(this.issuer).publicKey()
});
var currency = xdr.Currency.currencyTypeAlphanum();
currency.set("currencyTypeAlphanum", currencyType);
return currency;
}
}
},
isNative: {
/**
* Returns true if this currency object is the native currency.
*/
value: function isNative() {
return !this.issuer;
}
},
equals: {
/**
* Returns true if this currency equals the given currency.
*/
value: function equals(currency) {
return this.code == currency.code && this.issuer == currency.issuer;
}
}
}, {
native: {
/**
* Returns a currency object for the native currency.
*/
value: function native() {
return new Currency("XLM");
}
},
fromOperation: {
/**
* Returns a currency object from its XDR object representation.
* @param {xdr.Currency.iso4217} xdr - The currency xdr object.
*/
value: function fromOperation(xdr) {
if (xdr._switch.name == "currencyTypeNative") {
return this.native();
} else {
var code = xdr._value._attributes.currencyCode;
var issuer = encodeBase58Check("accountId", xdr._value._attributes.issuer);
return new this(code, issuer);
}
}
}
});
return Currency;
})();
/***/ },
/* 30 */
/***/ function(module, exports, __webpack_require__) {
/**
* Calculats and returns the best rational approximation of the given real number.
* @returns {array} first element is n, second element is d
*/
"use strict";
exports.best_r = best_r;
Object.defineProperty(exports, "__esModule", {
value: true
});
var MAX_INT = (1 << 31 >>> 0) - 1;
function best_r(number) {
var a = Math.floor(number);
var f;
var fractions = [[0, 1], [1, 0]];
var i = 2;
while (true) {
if (number > MAX_INT) {
break;
}
a = Math.floor(number);
f = number - a;
var h = a * fractions[i - 1][0] + fractions[i - 2][0];
var k = a * fractions[i - 1][1] + fractions[i - 2][1];
if (h > MAX_INT || k > MAX_INT) {
break;
}
fractions.push([h, k]);
if (f === 0) {
break;
}
number = 1 / f;
i = i + 1;
}
return fractions[fractions.length - 1];
}
/***/ },
/* 31 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(Buffer) {"use strict";
var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
Object.defineProperty(exports, "__esModule", {
value: true
});
var _index = __webpack_require__(5);
var xdr = _index.xdr;
var hash = _index.hash;
var encodeBase58Check = __webpack_require__(8).encodeBase58Check;
var Operation = __webpack_require__(28).Operation;
var MAX_FEE = 1000;
var MIN_LEDGER = 0;
var MAX_LEDGER = 4294967295; // max uint32
var Transaction = exports.Transaction = (function () {
/**
* A new Transaction object is created from a transaction envelope (or via TransactionBuilder).
* One a Transaction has been created from an envelope, its attributes and operations
* should not be changed. You should only add signers to a Transaction object before
* submitting to the network or forwarding on to additional signers.
* @constructor
* @param {string|xdr.TransactionEnvelope} envelope - The transaction envelope object or
* hex encoded string.
*/
function Transaction(envelope) {
_classCallCheck(this, Transaction);
if (typeof envelope === "string") {
var buffer = new Buffer(envelope, "hex");
envelope = xdr.TransactionEnvelope.fromXdr(buffer);
}
// since this transaction is immutable, save the tx
this.tx = envelope._attributes.tx;
this.source = encodeBase58Check("accountId", envelope._attributes.tx._attributes.sourceAccount);
this.fee = envelope._attributes.tx._attributes.fee;
this.sequence = envelope._attributes.tx._attributes.seqNum.toString();
this.minLedger = envelope._attributes.tx._attributes.minLedger;
this.maxLedger = envelope._attributes.tx._attributes.maxLedger;
var operations = envelope._attributes.tx._attributes.operations;
this.operations = [];
for (var i = 0; i < operations.length; i++) {
this.operations[i] = Operation.operationToObject(operations[i]._attributes);
}
var signatures = envelope._attributes.signatures;
this.signatures = [];
for (var i = 0; i < signatures.length; i++) {
this.signatures[i] = signatures[i];
}
}
_createClass(Transaction, {
addSignature: {
/**
* Adds a signature to this transaction.
* @param signature
*/
value: function addSignature(signature) {
this.signatures.push(signature);
}
},
sign: {
/**
* Signs the transaction with the given Keypair.
* @param {Keypair} keypair
*/
value: function sign(keypair) {
var tx_raw = this.tx.toXDR();
var tx_hash = hash(tx_raw);
return keypair.signDecorated(tx_hash);
}
},
toEnvelope: {
/**
* To envelope returns a xdr.TransactionEnvelope which can be submitted to the network.
*/
value: function toEnvelope() {
var tx = this.tx;
var signatures = this.signatures;
var envelope = new xdr.TransactionEnvelope({ tx: tx, signatures: signatures });
return envelope;
}
}
});
return Transaction;
})();
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(9).Buffer))
/***/ },
/* 32 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(Buffer) {"use strict";
var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
Object.defineProperty(exports, "__esModule", {
value: true
});
var xdr = __webpack_require__(5).xdr;
/**
* @class Memo
*/
var Memo = exports.Memo = (function () {
function Memo() {
_classCallCheck(this, Memo);
}
_createClass(Memo, null, {
none: {
/**
* Returns an empty memo.
*/
value: function none() {
return xdr.Memo.memoNone();
}
},
text: {
/**
* Creates and returns a "text" memo.
* @param {string} text - memo text
* @returns {xdr.Memo}
*/
value: (function (_text) {
var _textWrapper = function text(_x) {
return _text.apply(this, arguments);
};
_textWrapper.toString = function () {
return _text.toString();
};
return _textWrapper;
})(function (text) {
if (typeof text !== "string") {
throw new Error("Expects string type got a " + typeof text);
}
if (Buffer.byteLength(text, "ascii") > 32) {
throw new Error("Text should be < 32 bytes (ascii encoded). Got " + Buffer.byteLength(text, "ascii"));
}
return xdr.Memo.memoText(text);
})
},
id: {
/**
* Creates and returns an "id" memo.
* @param {string} id - 64 bit id
* @returns {xdr.Memo}
*/
value: (function (_id) {
var _idWrapper = function id(_x2) {
return _id.apply(this, arguments);
};
_idWrapper.toString = function () {
return _id.toString();
};
return _idWrapper;
})(function (id) {
if (Number(id) === "NaN") {
throw new Error("Expects a int64 as a string. Got " + id);
}
return xdr.Memo.memoId(id);
})
},
hash: {
/**
* Creates and returns a "hash" memo.
* @param {array|string} hash - 32 byte hash
*/
value: (function (_hash) {
var _hashWrapper = function hash(_x3) {
return _hash.apply(this, arguments);
};
_hashWrapper.toString = function () {
return _hash.toString();
};
return _hashWrapper;
})(function (hash) {
if (typeof hash === "string" && Buffer.byteLength(hash) != 32) {
throw new Error("Expects a 32 byte hash value. Got " + Buffer.byteLength(hash) + " bytes instead");
}
return xdr.Memo.memoHash(hash);
})
},
returnHash: {
/**
* Creates and returns a "return hash" memo.
* @param {array|string} hash - 32 byte hash
*/
value: function returnHash(hash) {
if (typeof hash === "string" && Buffer.byteLength(hash) != 32) {
throw new Error("Expects a 32 byte hash value. Got " + Buffer.byteLength(hash) + " bytes instead");
}
return xdr.Memo.memoReturn(hash);
}
}
});
return Memo;
})();
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(9).Buffer))
/***/ },
/* 33 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; };
// Automatically generated on 2015-06-08T13:36:19-07:00
// DO NOT EDIT or your changes may be overwritten
/* jshint maxstatements:2147483647 */
/* jshint esnext:true */
var XDR = _interopRequireWildcard(__webpack_require__(34));
var types = XDR.config(function (xdr) {
// === xdr source ============================================================
//
// typedef opaque Signature[64];
//
// ===========================================================================
xdr.typedef("Signature", xdr.opaque(64));
// === xdr source ============================================================
//
// typedef opaque Hash[32];
//
// ===========================================================================
xdr.typedef("Hash", xdr.opaque(32));
// === xdr source ============================================================
//
// typedef opaque uint256[32];
//
// ===========================================================================
xdr.typedef("Uint256", xdr.opaque(32));
// === xdr source ============================================================
//
// typedef unsigned int uint32;
//
// ===========================================================================
xdr.typedef("Uint32", xdr.uint());
// === xdr source ============================================================
//
// typedef unsigned hyper uint64;
//
// ===========================================================================
xdr.typedef("Uint64", xdr.uhyper());
// === xdr source ============================================================
//
// typedef opaque Value<>;
//
// ===========================================================================
xdr.typedef("Value", xdr.varOpaque());
// === xdr source ============================================================
//
// typedef opaque Evidence<>;
//
// ===========================================================================
xdr.typedef("Evidence", xdr.varOpaque());
// === xdr source ============================================================
//
// struct SCPBallot
// {
// uint32 counter; // n
// Value value; // x
// };
//
// ===========================================================================
xdr.struct("ScpBallot", [["counter", xdr.lookup("Uint32")], ["value", xdr.lookup("Value")]]);
// === xdr source ============================================================
//
// enum SCPStatementType
// {
// PREPARING = 0,
// PREPARED = 1,
// COMMITTING = 2,
// COMMITTED = 3
// };
//
// ===========================================================================
xdr["enum"]("ScpStatementType", {
preparing: 0,
prepared: 1,
committing: 2,
committed: 3 });
// === xdr source ============================================================
//
// struct
// {
// SCPBallot excepted<>; // B_c
// SCPBallot* prepared; // p
// }
//
// ===========================================================================
xdr.struct("ScpStatementPrepare", [["excepted", xdr.varArray(xdr.lookup("ScpBallot"), 2147483647)], ["prepared", xdr.option(xdr.lookup("ScpBallot"))]]);
// === xdr source ============================================================
//
// union switch (SCPStatementType type)
// {
// case PREPARING:
// struct
// {
// SCPBallot excepted<>; // B_c
// SCPBallot* prepared; // p
// } prepare;
// case PREPARED:
// case COMMITTING:
// case COMMITTED:
// void;
// }
//
// ===========================================================================
xdr.union("ScpStatementPledges", {
switchOn: xdr.lookup("ScpStatementType"),
switchName: "type",
switches: {
preparing: "prepare",
prepared: xdr["void"](),
committing: xdr["void"](),
committed: xdr["void"]() },
arms: {
prepare: xdr.lookup("ScpStatementPrepare") } });
// === xdr source ============================================================
//
// struct SCPStatement
// {
// uint64 slotIndex; // i
// SCPBallot ballot; // b
// Hash quorumSetHash; // D
//
// union switch (SCPStatementType type)
// {
// case PREPARING:
// struct
// {
// SCPBallot excepted<>; // B_c
// SCPBallot* prepared; // p
// } prepare;
// case PREPARED:
// case COMMITTING:
// case COMMITTED:
// void;
// }
// pledges;
// };
//
// ===========================================================================
xdr.struct("ScpStatement", [["slotIndex", xdr.lookup("Uint64")], ["ballot", xdr.lookup("ScpBallot")], ["quorumSetHash", xdr.lookup("Hash")], ["pledges", xdr.lookup("ScpStatementPledges")]]);
// === xdr source ============================================================
//
// struct SCPEnvelope
// {
// uint256 nodeID; // v
// SCPStatement statement;
// Signature signature;
// };
//
// ===========================================================================
xdr.struct("ScpEnvelope", [["nodeId", xdr.lookup("Uint256")], ["statement", xdr.lookup("ScpStatement")], ["signature", xdr.lookup("Signature")]]);
// === xdr source ============================================================
//
// struct SCPQuorumSet
// {
// uint32 threshold;
// Hash validators<>;
// SCPQuorumSet innerSets<>;
// };
//
// ===========================================================================
xdr.struct("ScpQuorumSet", [["threshold", xdr.lookup("Uint32")], ["validators", xdr.varArray(xdr.lookup("Hash"), 2147483647)]]);
// === xdr source ============================================================
//
// enum LedgerEntryType
// {
// ACCOUNT = 0,
// TRUSTLINE = 1,
// OFFER = 2
// };
//
// ===========================================================================
xdr["enum"]("LedgerEntryType", {
account: 0,
trustline: 1,
offer: 2 });
// === xdr source ============================================================
//
// struct Signer
// {
// uint256 pubKey;
// uint32 weight; // really only need 1byte
// };
//
// ===========================================================================
xdr.struct("Signer", [["pubKey", xdr.lookup("Uint256")], ["weight", xdr.lookup("Uint32")]]);
// === xdr source ============================================================
//
// enum AccountFlags
// { // masks for each flag
//
// // if set, TrustLines are created with authorized set to "false"
// // requiring the issuer to set it for each TrustLine
// AUTH_REQUIRED_FLAG = 0x1,
// // if set, the authorized flag in TrustTines can be cleared
// // otherwise, authorization cannot be revoked
// AUTH_REVOCABLE_FLAG = 0x2
// };
//
// ===========================================================================
xdr["enum"]("AccountFlags", {
authRequiredFlag: 1,
authRevocableFlag: 2 });
// === xdr source ============================================================
//
// struct AccountEntry
// {
// AccountID accountID; // master public key for this account
// int64 balance; // in stroops
// SequenceNumber seqNum; // last sequence number used for this account
// uint32 numSubEntries; // number of sub-entries this account has
// // drives the reserve
// AccountID* inflationDest; // Account to vote during inflation
// uint32 flags; // see AccountFlags
//
// // fields used for signatures
// // thresholds stores unsigned bytes: [weight of master|low|medium|high]
// Thresholds thresholds;
//
// string32 homeDomain; // can be used for reverse federation and memo lookup
//
// Signer signers<20>; // possible signers for this account
// };
//
// ===========================================================================
xdr.struct("AccountEntry", [["accountId", xdr.lookup("AccountId")], ["balance", xdr.lookup("Int64")], ["seqNum", xdr.lookup("SequenceNumber")], ["numSubEntries", xdr.lookup("Uint32")], ["inflationDest", xdr.option(xdr.lookup("AccountId"))], ["flags", xdr.lookup("Uint32")], ["thresholds", xdr.lookup("Thresholds")], ["homeDomain", xdr.lookup("String32")], ["signers", xdr.varArray(xdr.lookup("Signer"), 20)]]);
// === xdr source ============================================================
//
// enum TrustLineFlags
// {
// // issuer has authorized account to perform transactions with its credit
// AUTHORIZED_FLAG = 1
// };
//
// ===========================================================================
xdr["enum"]("TrustLineFlags", {
authorizedFlag: 1 });
// === xdr source ============================================================
//
// struct TrustLineEntry
// {
// AccountID accountID; // account this trustline belongs to
// Currency currency; // currency (with issuer)
// int64 balance; // how much of this currency the user has.
// // Currency defines the unit for this;
//
// int64 limit; // balance cannot be above this
// uint32 flags; // see TrustLineFlags
// };
//
// ===========================================================================
xdr.struct("TrustLineEntry", [["accountId", xdr.lookup("AccountId")], ["currency", xdr.lookup("Currency")], ["balance", xdr.lookup("Int64")], ["limit", xdr.lookup("Int64")], ["flags", xdr.lookup("Uint32")]]);
// === xdr source ============================================================
//
// enum OfferEntryFlags
// {
// // issuer has authorized account to perform transactions with its credit
// PASSIVE_FLAG = 1
// };
//
// ===========================================================================
xdr["enum"]("OfferEntryFlags", {
passiveFlag: 1 });
// === xdr source ============================================================
//
// struct OfferEntry
// {
// AccountID accountID;
// uint64 offerID;
// Currency takerGets; // A
// Currency takerPays; // B
// int64 amount; // amount of A
//
// /* price for this offer:
// price of A in terms of B
// price=AmountB/AmountA=priceNumerator/priceDenominator
// price is after fees
// */
// Price price;
// uint32 flags; // see OfferEntryFlags
// };
//
// ===========================================================================
xdr.struct("OfferEntry", [["accountId", xdr.lookup("AccountId")], ["offerId", xdr.lookup("Uint64")], ["takerGets", xdr.lookup("Currency")], ["takerPays", xdr.lookup("Currency")], ["amount", xdr.lookup("Int64")], ["price", xdr.lookup("Price")], ["flags", xdr.lookup("Uint32")]]);
// === xdr source ============================================================
//
// union LedgerEntry switch (LedgerEntryType type)
// {
// case ACCOUNT:
// AccountEntry account;
//
// case TRUSTLINE:
// TrustLineEntry trustLine;
//
// case OFFER:
// OfferEntry offer;
// };
//
// ===========================================================================
xdr.union("LedgerEntry", {
switchOn: xdr.lookup("LedgerEntryType"),
switchName: "type",
switches: {
account: "account",
trustline: "trustLine",
offer: "offer" },
arms: {
account: xdr.lookup("AccountEntry"),
trustLine: xdr.lookup("TrustLineEntry"),
offer: xdr.lookup("OfferEntry") } });
// === xdr source ============================================================
//
// struct LedgerHeader
// {
// Hash previousLedgerHash; // hash of the previous ledger header
// Hash txSetHash; // the tx set that was SCP confirmed
// Hash txSetResultHash; // the TransactionResultSet that led to this ledger
// Hash bucketListHash; // hash of the ledger state
//
// uint32 ledgerSeq; // sequence number of this ledger
// uint64 closeTime; // network close time
//
// int64 totalCoins; // total number of stroops in existence
//
// int64 feePool; // fees burned since last inflation run
// uint32 inflationSeq; // inflation sequence number
//
// uint64 idPool; // last used global ID, used for generating objects
//
// int32 baseFee; // base fee per operation in stroops
// int32 baseReserve; // account base reserve in stroops
//
// Hash skipList[4]; // hashes of ledgers in the past. allows you to jump back
// // in time without walking the chain back ledger by ledger
// };
//
// ===========================================================================
xdr.struct("LedgerHeader", [["previousLedgerHash", xdr.lookup("Hash")], ["txSetHash", xdr.lookup("Hash")], ["txSetResultHash", xdr.lookup("Hash")], ["bucketListHash", xdr.lookup("Hash")], ["ledgerSeq", xdr.lookup("Uint32")], ["closeTime", xdr.lookup("Uint64")], ["totalCoins", xdr.lookup("Int64")], ["feePool", xdr.lookup("Int64")], ["inflationSeq", xdr.lookup("Uint32")], ["idPool", xdr.lookup("Uint64")], ["baseFee", xdr.lookup("Int32")], ["baseReserve", xdr.lookup("Int32")], ["skipList", xdr.array(xdr.lookup("Hash"), 4)]]);
// === xdr source ============================================================
//
// struct
// {
// AccountID accountID;
// }
//
// ===========================================================================
xdr.struct("LedgerKeyAccount", [["accountId", xdr.lookup("AccountId")]]);
// === xdr source ============================================================
//
// struct
// {
// AccountID accountID;
// Currency currency;
// }
//
// ===========================================================================
xdr.struct("LedgerKeyTrustLine", [["accountId", xdr.lookup("AccountId")], ["currency", xdr.lookup("Currency")]]);
// === xdr source ============================================================
//
// struct
// {
// AccountID accountID;
// uint64 offerID;
// }
//
// ===========================================================================
xdr.struct("LedgerKeyOffer", [["accountId", xdr.lookup("AccountId")], ["offerId", xdr.lookup("Uint64")]]);
// === xdr source ============================================================
//
// union LedgerKey switch (LedgerEntryType type)
// {
// case ACCOUNT:
// struct
// {
// AccountID accountID;
// } account;
//
// case TRUSTLINE:
// struct
// {
// AccountID accountID;
// Currency currency;
// } trustLine;
//
// case OFFER:
// struct
// {
// AccountID accountID;
// uint64 offerID;
// } offer;
// };
//
// ===========================================================================
xdr.union("LedgerKey", {
switchOn: xdr.lookup("LedgerEntryType"),
switchName: "type",
switches: {
account: "account",
trustline: "trustLine",
offer: "offer" },
arms: {
account: xdr.lookup("LedgerKeyAccount"),
trustLine: xdr.lookup("LedgerKeyTrustLine"),
offer: xdr.lookup("LedgerKeyOffer") } });
// === xdr source ============================================================
//
// enum BucketEntryType
// {
// LIVEENTRY = 0,
// DEADENTRY = 1
// };
//
// ===========================================================================
xdr["enum"]("BucketEntryType", {
liveentry: 0,
deadentry: 1 });
// === xdr source ============================================================
//
// union BucketEntry switch (BucketEntryType type)
// {
// case LIVEENTRY:
// LedgerEntry liveEntry;
//
// case DEADENTRY:
// LedgerKey deadEntry;
// };
//
// ===========================================================================
xdr.union("BucketEntry", {
switchOn: xdr.lookup("BucketEntryType"),
switchName: "type",
switches: {
liveentry: "liveEntry",
deadentry: "deadEntry" },
arms: {
liveEntry: xdr.lookup("LedgerEntry"),
deadEntry: xdr.lookup("LedgerKey") } });
// === xdr source ============================================================
//
// struct TransactionSet
// {
// Hash previousLedgerHash;
// TransactionEnvelope txs<5000>;
// };
//
// ===========================================================================
xdr.struct("TransactionSet", [["previousLedgerHash", xdr.lookup("Hash")], ["txes", xdr.varArray(xdr.lookup("TransactionEnvelope"), 5000)]]);
// === xdr source ============================================================
//
// struct TransactionResultPair
// {
// Hash transactionHash;
// TransactionResult result; // result for the transaction
// };
//
// ===========================================================================
xdr.struct("TransactionResultPair", [["transactionHash", xdr.lookup("Hash")], ["result", xdr.lookup("TransactionResult")]]);
// === xdr source ============================================================
//
// struct TransactionResultSet
// {
// TransactionResultPair results<5000>;
// };
//
// ===========================================================================
xdr.struct("TransactionResultSet", [["results", xdr.varArray(xdr.lookup("TransactionResultPair"), 5000)]]);
// === xdr source ============================================================
//
// struct TransactionHistoryEntry
// {
// uint32 ledgerSeq;
// TransactionSet txSet;
// };
//
// ===========================================================================
xdr.struct("TransactionHistoryEntry", [["ledgerSeq", xdr.lookup("Uint32")], ["txSet", xdr.lookup("TransactionSet")]]);
// === xdr source ============================================================
//
// struct TransactionHistoryResultEntry
// {
// uint32 ledgerSeq;
// TransactionResultSet txResultSet;
// };
//
// ===========================================================================
xdr.struct("TransactionHistoryResultEntry", [["ledgerSeq", xdr.lookup("Uint32")], ["txResultSet", xdr.lookup("TransactionResultSet")]]);
// === xdr source ============================================================
//
// struct LedgerHeaderHistoryEntry
// {
// Hash hash;
// LedgerHeader header;
// };
//
// ===========================================================================
xdr.struct("LedgerHeaderHistoryEntry", [["hash", xdr.lookup("Hash")], ["header", xdr.lookup("LedgerHeader")]]);
// === xdr source ============================================================
//
// enum LedgerEntryChangeType
// {
// LEDGER_ENTRY_CREATED = 0, // entry was added to the ledger
// LEDGER_ENTRY_UPDATED = 1, // entry was modified in the ledger
// LEDGER_ENTRY_REMOVED = 2 // entry was removed from the ledger
// };
//
// ===========================================================================
xdr["enum"]("LedgerEntryChangeType", {
ledgerEntryCreated: 0,
ledgerEntryUpdated: 1,
ledgerEntryRemoved: 2 });
// === xdr source ============================================================
//
// union LedgerEntryChange switch (LedgerEntryChangeType type)
// {
// case LEDGER_ENTRY_CREATED:
// LedgerEntry created;
// case LEDGER_ENTRY_UPDATED:
// LedgerEntry updated;
// case LEDGER_ENTRY_REMOVED:
// LedgerKey removed;
// };
//
// ===========================================================================
xdr.union("LedgerEntryChange", {
switchOn: xdr.lookup("LedgerEntryChangeType"),
switchName: "type",
switches: {
ledgerEntryCreated: "created",
ledgerEntryUpdated: "updated",
ledgerEntryRemoved: "removed" },
arms: {
created: xdr.lookup("LedgerEntry"),
updated: xdr.lookup("LedgerEntry"),
removed: xdr.lookup("LedgerKey") } });
// === xdr source ============================================================
//
// struct TransactionMeta
// {
// LedgerEntryChange changes<>;
// };
//
// ===========================================================================
xdr.struct("TransactionMeta", [["changes", xdr.varArray(xdr.lookup("LedgerEntryChange"), 2147483647)]]);
// === xdr source ============================================================
//
// struct StellarBallotValue
// {
// Hash txSetHash;
// uint64 closeTime;
// uint32 baseFee;
// };
//
// ===========================================================================
xdr.struct("StellarBallotValue", [["txSetHash", xdr.lookup("Hash")], ["closeTime", xdr.lookup("Uint64")], ["baseFee", xdr.lookup("Uint32")]]);
// === xdr source ============================================================
//
// struct StellarBallot
// {
// uint256 nodeID;
// Signature signature;
// StellarBallotValue value;
// };
//
// ===========================================================================
xdr.struct("StellarBallot", [["nodeId", xdr.lookup("Uint256")], ["signature", xdr.lookup("Signature")], ["value", xdr.lookup("StellarBallotValue")]]);
// === xdr source ============================================================
//
// struct Error
// {
// int code;
// string msg<100>;
// };
//
// ===========================================================================
xdr.struct("Error", [["code", xdr.int()], ["msg", xdr.string(100)]]);
// === xdr source ============================================================
//
// struct Hello
// {
// int protocolVersion;
// string versionStr<100>;
// int listeningPort;
// opaque peerID[32];
// };
//
// ===========================================================================
xdr.struct("Hello", [["protocolVersion", xdr.int()], ["versionStr", xdr.string(100)], ["listeningPort", xdr.int()], ["peerId", xdr.opaque(32)]]);
// === xdr source ============================================================
//
// struct PeerAddress
// {
// opaque ip[4];
// uint32 port;
// uint32 numFailures;
// };
//
// ===========================================================================
xdr.struct("PeerAddress", [["ip", xdr.opaque(4)], ["port", xdr.lookup("Uint32")], ["numFailures", xdr.lookup("Uint32")]]);
// === xdr source ============================================================
//
// enum MessageType
// {
// ERROR_MSG = 0,
// HELLO = 1,
// DONT_HAVE = 2,
//
// GET_PEERS = 3, // gets a list of peers this guy knows about
// PEERS = 4,
//
// GET_TX_SET = 5, // gets a particular txset by hash
// TX_SET = 6,
//
// TRANSACTION = 7, // pass on a tx you have heard about
//
// // SCP
// GET_SCP_QUORUMSET = 8,
// SCP_QUORUMSET = 9,
// SCP_MESSAGE = 10
// };
//
// ===========================================================================
xdr["enum"]("MessageType", {
errorMsg: 0,
hello: 1,
dontHave: 2,
getPeer: 3,
peer: 4,
getTxSet: 5,
txSet: 6,
transaction: 7,
getScpQuorumset: 8,
scpQuorumset: 9,
scpMessage: 10 });
// === xdr source ============================================================
//
// struct DontHave
// {
// MessageType type;
// uint256 reqHash;
// };
//
// ===========================================================================
xdr.struct("DontHave", [["type", xdr.lookup("MessageType")], ["reqHash", xdr.lookup("Uint256")]]);
// === xdr source ============================================================
//
// union StellarMessage switch (MessageType type)
// {
// case ERROR_MSG:
// Error error;
// case HELLO:
// Hello hello;
// case DONT_HAVE:
// DontHave dontHave;
// case GET_PEERS:
// void;
// case PEERS:
// PeerAddress peers<>;
//
// case GET_TX_SET:
// uint256 txSetHash;
// case TX_SET:
// TransactionSet txSet;
//
// case TRANSACTION:
// TransactionEnvelope transaction;
//
// // SCP
// case GET_SCP_QUORUMSET:
// uint256 qSetHash;
// case SCP_QUORUMSET:
// SCPQuorumSet qSet;
// case SCP_MESSAGE:
// SCPEnvelope envelope;
// };
//
// ===========================================================================
xdr.union("StellarMessage", {
switchOn: xdr.lookup("MessageType"),
switchName: "type",
switches: {
errorMsg: "error",
hello: "hello",
dontHave: "dontHave",
getPeer: xdr["void"](),
peer: "peers",
getTxSet: "txSetHash",
txSet: "txSet",
transaction: "transaction",
getScpQuorumset: "qSetHash",
scpQuorumset: "qSet",
scpMessage: "envelope" },
arms: {
error: xdr.lookup("Error"),
hello: xdr.lookup("Hello"),
dontHave: xdr.lookup("DontHave"),
peers: xdr.varArray(xdr.lookup("PeerAddress"), 2147483647),
txSetHash: xdr.lookup("Uint256"),
txSet: xdr.lookup("TransactionSet"),
transaction: xdr.lookup("TransactionEnvelope"),
qSetHash: xdr.lookup("Uint256"),
qSet: xdr.lookup("ScpQuorumSet"),
envelope: xdr.lookup("ScpEnvelope") } });
// === xdr source ============================================================
//
// struct DecoratedSignature
// {
// opaque hint[4]; // first 4 bytes of the public key, used as a hint
// uint512 signature; // actual signature
// };
//
// ===========================================================================
xdr.struct("DecoratedSignature", [["hint", xdr.opaque(4)], ["signature", xdr.lookup("Uint512")]]);
// === xdr source ============================================================
//
// enum OperationType
// {
// CREATE_ACCOUNT = 0,
// PAYMENT = 1,
// PATH_PAYMENT = 2,
// MANAGE_OFFER = 3,
// CREATE_PASSIVE_OFFER = 4,
// SET_OPTIONS = 5,
// CHANGE_TRUST = 6,
// ALLOW_TRUST = 7,
// ACCOUNT_MERGE = 8,
// INFLATION = 9
// };
//
// ===========================================================================
xdr["enum"]("OperationType", {
createAccount: 0,
payment: 1,
pathPayment: 2,
manageOffer: 3,
createPassiveOffer: 4,
setOption: 5,
changeTrust: 6,
allowTrust: 7,
accountMerge: 8,
inflation: 9 });
// === xdr source ============================================================
//
// struct CreateAccountOp
// {
// AccountID destination; // account to create
// int64 startingBalance; // amount they end up with
// };
//
// ===========================================================================
xdr.struct("CreateAccountOp", [["destination", xdr.lookup("AccountId")], ["startingBalance", xdr.lookup("Int64")]]);
// === xdr source ============================================================
//
// struct PaymentOp
// {
// AccountID destination; // recipient of the payment
// Currency currency; // what they end up with
// int64 amount; // amount they end up with
// };
//
// ===========================================================================
xdr.struct("PaymentOp", [["destination", xdr.lookup("AccountId")], ["currency", xdr.lookup("Currency")], ["amount", xdr.lookup("Int64")]]);
// === xdr source ============================================================
//
// struct PathPaymentOp
// {
// Currency sendCurrency; // currency we pay with
// int64 sendMax; // the maximum amount of sendCurrency to
// // send (excluding fees).
// // The operation will fail if can't be met
//
// AccountID destination; // recipient of the payment
// Currency destCurrency; // what they end up with
// int64 destAmount; // amount they end up with
//
// Currency path<5>; // additional hops it must go through to get there
// };
//
// ===========================================================================
xdr.struct("PathPaymentOp", [["sendCurrency", xdr.lookup("Currency")], ["sendMax", xdr.lookup("Int64")], ["destination", xdr.lookup("AccountId")], ["destCurrency", xdr.lookup("Currency")], ["destAmount", xdr.lookup("Int64")], ["path", xdr.varArray(xdr.lookup("Currency"), 5)]]);
// === xdr source ============================================================
//
// struct ManageOfferOp
// {
// Currency takerGets;
// Currency takerPays;
// int64 amount; // amount taker gets. if set to 0, delete the offer
// Price price; // =takerPaysAmount/takerGetsAmount
//
// // 0=create a new offer, otherwise edit an existing offer
// uint64 offerID;
// };
//
// ===========================================================================
xdr.struct("ManageOfferOp", [["takerGets", xdr.lookup("Currency")], ["takerPays", xdr.lookup("Currency")], ["amount", xdr.lookup("Int64")], ["price", xdr.lookup("Price")], ["offerId", xdr.lookup("Uint64")]]);
// === xdr source ============================================================
//
// struct CreatePassiveOfferOp
// {
// Currency takerGets;
// Currency takerPays;
// int64 amount; // amount taker gets. if set to 0, delete the offer
// Price price; // =takerPaysAmount/takerGetsAmount
// };
//
// ===========================================================================
xdr.struct("CreatePassiveOfferOp", [["takerGets", xdr.lookup("Currency")], ["takerPays", xdr.lookup("Currency")], ["amount", xdr.lookup("Int64")], ["price", xdr.lookup("Price")]]);
// === xdr source ============================================================
//
// struct SetOptionsOp
// {
// AccountID* inflationDest; // sets the inflation destination
//
// uint32* clearFlags; // which flags to clear
// uint32* setFlags; // which flags to set
//
// Thresholds* thresholds; // update the thresholds for the account
//
// string32* homeDomain; // sets the home domain
//
// // Add, update or remove a signer for the account
// // signer is deleted if the weight is 0
// Signer* signer;
// };
//
// ===========================================================================
xdr.struct("SetOptionsOp", [["inflationDest", xdr.option(xdr.lookup("AccountId"))], ["clearFlags", xdr.option(xdr.lookup("Uint32"))], ["setFlags", xdr.option(xdr.lookup("Uint32"))], ["thresholds", xdr.option(xdr.lookup("Thresholds"))], ["homeDomain", xdr.option(xdr.lookup("String32"))], ["signer", xdr.option(xdr.lookup("Signer"))]]);
// === xdr source ============================================================
//
// struct ChangeTrustOp
// {
// Currency line;
//
// // if limit is set to 0, deletes the trust line
// int64 limit;
// };
//
// ===========================================================================
xdr.struct("ChangeTrustOp", [["line", xdr.lookup("Currency")], ["limit", xdr.lookup("Int64")]]);
// === xdr source ============================================================
//
// union switch (CurrencyType type)
// {
// // CURRENCY_TYPE_NATIVE is not allowed
// case CURRENCY_TYPE_ALPHANUM:
// opaque currencyCode[4];
//
// // add other currency types here in the future
// }
//
// ===========================================================================
xdr.union("AllowTrustOpCurrency", {
switchOn: xdr.lookup("CurrencyType"),
switchName: "type",
switches: {
currencyTypeAlphanum: "currencyCode" },
arms: {
currencyCode: xdr.opaque(4) } });
// === xdr source ============================================================
//
// struct AllowTrustOp
// {
// AccountID trustor;
// union switch (CurrencyType type)
// {
// // CURRENCY_TYPE_NATIVE is not allowed
// case CURRENCY_TYPE_ALPHANUM:
// opaque currencyCode[4];
//
// // add other currency types here in the future
// }
// currency;
//
// bool authorize;
// };
//
// ===========================================================================
xdr.struct("AllowTrustOp", [["trustor", xdr.lookup("AccountId")], ["currency", xdr.lookup("AllowTrustOpCurrency")], ["authorize", xdr.bool()]]);
// === xdr source ============================================================
//
// union switch (OperationType type)
// {
// case CREATE_ACCOUNT:
// CreateAccountOp createAccountOp;
// case PAYMENT:
// PaymentOp paymentOp;
// case PATH_PAYMENT:
// PathPaymentOp pathPaymentOp;
// case MANAGE_OFFER:
// ManageOfferOp manageOfferOp;
// case CREATE_PASSIVE_OFFER:
// CreatePassiveOfferOp createPassiveOfferOp;
// case SET_OPTIONS:
// SetOptionsOp setOptionsOp;
// case CHANGE_TRUST:
// ChangeTrustOp changeTrustOp;
// case ALLOW_TRUST:
// AllowTrustOp allowTrustOp;
// case ACCOUNT_MERGE:
// uint256 destination;
// case INFLATION:
// void;
// }
//
// ===========================================================================
xdr.union("OperationBody", {
switchOn: xdr.lookup("OperationType"),
switchName: "type",
switches: {
createAccount: "createAccountOp",
payment: "paymentOp",
pathPayment: "pathPaymentOp",
manageOffer: "manageOfferOp",
createPassiveOffer: "createPassiveOfferOp",
setOption: "setOptionsOp",
changeTrust: "changeTrustOp",
allowTrust: "allowTrustOp",
accountMerge: "destination",
inflation: xdr["void"]() },
arms: {
createAccountOp: xdr.lookup("CreateAccountOp"),
paymentOp: xdr.lookup("PaymentOp"),
pathPaymentOp: xdr.lookup("PathPaymentOp"),
manageOfferOp: xdr.lookup("ManageOfferOp"),
createPassiveOfferOp: xdr.lookup("CreatePassiveOfferOp"),
setOptionsOp: xdr.lookup("SetOptionsOp"),
changeTrustOp: xdr.lookup("ChangeTrustOp"),
allowTrustOp: xdr.lookup("AllowTrustOp"),
destination: xdr.lookup("Uint256") } });
// === xdr source ============================================================
//
// struct Operation
// {
// // sourceAccount is the account used to run the operation
// // if not set, the runtime defaults to "account" specified at
// // the transaction level
// AccountID* sourceAccount;
//
// union switch (OperationType type)
// {
// case CREATE_ACCOUNT:
// CreateAccountOp createAccountOp;
// case PAYMENT:
// PaymentOp paymentOp;
// case PATH_PAYMENT:
// PathPaymentOp pathPaymentOp;
// case MANAGE_OFFER:
// ManageOfferOp manageOfferOp;
// case CREATE_PASSIVE_OFFER:
// CreatePassiveOfferOp createPassiveOfferOp;
// case SET_OPTIONS:
// SetOptionsOp setOptionsOp;
// case CHANGE_TRUST:
// ChangeTrustOp changeTrustOp;
// case ALLOW_TRUST:
// AllowTrustOp allowTrustOp;
// case ACCOUNT_MERGE:
// uint256 destination;
// case INFLATION:
// void;
// }
// body;
// };
//
// ===========================================================================
xdr.struct("Operation", [["sourceAccount", xdr.option(xdr.lookup("AccountId"))], ["body", xdr.lookup("OperationBody")]]);
// === xdr source ============================================================
//
// enum MemoType
// {
// MEMO_NONE = 0,
// MEMO_TEXT = 1,
// MEMO_ID = 2,
// MEMO_HASH = 3,
// MEMO_RETURN = 4
// };
//
// ===========================================================================
xdr["enum"]("MemoType", {
memoNone: 0,
memoText: 1,
memoId: 2,
memoHash: 3,
memoReturn: 4 });
// === xdr source ============================================================
//
// union Memo switch (MemoType type)
// {
// case MEMO_NONE:
// void;
// case MEMO_TEXT:
// string text<28>;
// case MEMO_ID:
// uint64 id;
// case MEMO_HASH:
// Hash hash; // the hash of what to pull from the content server
// case MEMO_RETURN:
// Hash retHash; // the hash of the tx you are rejecting
// };
//
// ===========================================================================
xdr.union("Memo", {
switchOn: xdr.lookup("MemoType"),
switchName: "type",
switches: {
memoNone: xdr["void"](),
memoText: "text",
memoId: "id",
memoHash: "hash",
memoReturn: "retHash" },
arms: {
text: xdr.string(28),
id: xdr.lookup("Uint64"),
hash: xdr.lookup("Hash"),
retHash: xdr.lookup("Hash") } });
// === xdr source ============================================================
//
// struct TimeBounds
// {
// uint64 minTime;
// uint64 maxTime;
// };
//
// ===========================================================================
xdr.struct("TimeBounds", [["minTime", xdr.lookup("Uint64")], ["maxTime", xdr.lookup("Uint64")]]);
// === xdr source ============================================================
//
// struct Transaction
// {
// // account used to run the transaction
// AccountID sourceAccount;
//
// // the fee the sourceAccount will pay
// int32 fee;
//
// // sequence number to consume in the account
// SequenceNumber seqNum;
//
// // validity range (inclusive) for the last ledger close time
// TimeBounds* timeBounds;
//
// Memo memo;
//
// Operation operations<100>;
// };
//
// ===========================================================================
xdr.struct("Transaction", [["sourceAccount", xdr.lookup("AccountId")], ["fee", xdr.lookup("Int32")], ["seqNum", xdr.lookup("SequenceNumber")], ["timeBounds", xdr.option(xdr.lookup("TimeBounds"))], ["memo", xdr.lookup("Memo")], ["operations", xdr.varArray(xdr.lookup("Operation"), 100)]]);
// === xdr source ============================================================
//
// struct TransactionEnvelope
// {
// Transaction tx;
// DecoratedSignature signatures<20>;
// };
//
// ===========================================================================
xdr.struct("TransactionEnvelope", [["tx", xdr.lookup("Transaction")], ["signatures", xdr.varArray(xdr.lookup("DecoratedSignature"), 20)]]);
// === xdr source ============================================================
//
// struct ClaimOfferAtom
// {
// // emited to identify the offer
// AccountID offerOwner; // Account that owns the offer
// uint64 offerID;
//
// // amount and currency taken from the owner
// Currency currencyClaimed;
// int64 amountClaimed;
//
// // should we also include the amount that the owner gets in return?
// };
//
// ===========================================================================
xdr.struct("ClaimOfferAtom", [["offerOwner", xdr.lookup("AccountId")], ["offerId", xdr.lookup("Uint64")], ["currencyClaimed", xdr.lookup("Currency")], ["amountClaimed", xdr.lookup("Int64")]]);
// === xdr source ============================================================
//
// enum CreateAccountResultCode
// {
// // codes considered as "success" for the operation
// CREATE_ACCOUNT_SUCCESS = 0, // account was created
//
// // codes considered as "failure" for the operation
// CREATE_ACCOUNT_MALFORMED = 1, // invalid destination
// CREATE_ACCOUNT_UNDERFUNDED = 2, // not enough funds in source account
// CREATE_ACCOUNT_LOW_RESERVE =
// 3, // would create an account below the min reserve
// CREATE_ACCOUNT_ALREADY_EXIST = 4 // account already exists
// };
//
// ===========================================================================
xdr["enum"]("CreateAccountResultCode", {
createAccountSuccess: 0,
createAccountMalformed: 1,
createAccountUnderfunded: 2,
createAccountLowReserve: 3,
createAccountAlreadyExist: 4 });
// === xdr source ============================================================
//
// union CreateAccountResult switch (CreateAccountResultCode code)
// {
// case CREATE_ACCOUNT_SUCCESS:
// void;
// default:
// void;
// };
//
// ===========================================================================
xdr.union("CreateAccountResult", {
switchOn: xdr.lookup("CreateAccountResultCode"),
switchName: "code",
switches: {
createAccountSuccess: xdr["void"]() },
arms: {},
defaultArm: xdr["void"]() });
// === xdr source ============================================================
//
// enum PaymentResultCode
// {
// // codes considered as "success" for the operation
// PAYMENT_SUCCESS = 0, // payment successfuly completed
//
// // codes considered as "failure" for the operation
// PAYMENT_MALFORMED = -1, // bad input
// PAYMENT_UNDERFUNDED = -2, // not enough funds in source account
// PAYMENT_NO_DESTINATION = -3, // destination account does not exist
// PAYMENT_NO_TRUST = -4, // destination missing a trust line for currency
// PAYMENT_NOT_AUTHORIZED = -5, // destination not authorized to hold currency
// PAYMENT_LINE_FULL = -6 // destination would go above their limit
// };
//
// ===========================================================================
xdr["enum"]("PaymentResultCode", {
paymentSuccess: 0,
paymentMalformed: -1,
paymentUnderfunded: -2,
paymentNoDestination: -3,
paymentNoTrust: -4,
paymentNotAuthorized: -5,
paymentLineFull: -6 });
// === xdr source ============================================================
//
// union PaymentResult switch (PaymentResultCode code)
// {
// case PAYMENT_SUCCESS:
// void;
// default:
// void;
// };
//
// ===========================================================================
xdr.union("PaymentResult", {
switchOn: xdr.lookup("PaymentResultCode"),
switchName: "code",
switches: {
paymentSuccess: xdr["void"]() },
arms: {},
defaultArm: xdr["void"]() });
// === xdr source ============================================================
//
// enum PathPaymentResultCode
// {
// // codes considered as "success" for the operation
// PATH_PAYMENT_SUCCESS = 0, // success
//
// // codes considered as "failure" for the operation
// PATH_PAYMENT_MALFORMED = -1, // bad input
// PATH_PAYMENT_UNDERFUNDED = -2, // not enough funds in source account
// PATH_PAYMENT_NO_DESTINATION = -3, // destination account does not exist
// PATH_PAYMENT_NO_TRUST = -4, // destination missing a trust line for currency
// PATH_PAYMENT_NOT_AUTHORIZED =
// -5, // destination not authorized to hold currency
// PATH_PAYMENT_LINE_FULL = -6, // destination would go above their limit
// PATH_PAYMENT_TOO_FEW_OFFERS = -7, // not enough offers to satisfy path
// PATH_PAYMENT_OVER_SENDMAX = -8 // could not satisfy sendmax
// };
//
// ===========================================================================
xdr["enum"]("PathPaymentResultCode", {
pathPaymentSuccess: 0,
pathPaymentMalformed: -1,
pathPaymentUnderfunded: -2,
pathPaymentNoDestination: -3,
pathPaymentNoTrust: -4,
pathPaymentNotAuthorized: -5,
pathPaymentLineFull: -6,
pathPaymentTooFewOffer: -7,
pathPaymentOverSendmax: -8 });
// === xdr source ============================================================
//
// struct SimplePaymentResult
// {
// AccountID destination;
// Currency currency;
// int64 amount;
// };
//
// ===========================================================================
xdr.struct("SimplePaymentResult", [["destination", xdr.lookup("AccountId")], ["currency", xdr.lookup("Currency")], ["amount", xdr.lookup("Int64")]]);
// === xdr source ============================================================
//
// struct
// {
// ClaimOfferAtom offers<>;
// SimplePaymentResult last;
// }
//
// ===========================================================================
xdr.struct("PathPaymentResultSuccess", [["offers", xdr.varArray(xdr.lookup("ClaimOfferAtom"), 2147483647)], ["last", xdr.lookup("SimplePaymentResult")]]);
// === xdr source ============================================================
//
// union PathPaymentResult switch (PathPaymentResultCode code)
// {
// case PATH_PAYMENT_SUCCESS:
// struct
// {
// ClaimOfferAtom offers<>;
// SimplePaymentResult last;
// } success;
// default:
// void;
// };
//
// ===========================================================================
xdr.union("PathPaymentResult", {
switchOn: xdr.lookup("PathPaymentResultCode"),
switchName: "code",
switches: {
pathPaymentSuccess: "success" },
arms: {
success: xdr.lookup("PathPaymentResultSuccess") },
defaultArm: xdr["void"]() });
// === xdr source ============================================================
//
// enum ManageOfferResultCode
// {
// // codes considered as "success" for the operation
// MANAGE_OFFER_SUCCESS = 0,
//
// // codes considered as "failure" for the operation
// MANAGE_OFFER_MALFORMED = -1, // generated offer would be invalid
// MANAGE_OFFER_NO_TRUST = -2, // can't hold what it's buying
// MANAGE_OFFER_NOT_AUTHORIZED = -3, // not authorized to sell or buy
// MANAGE_OFFER_LINE_FULL = -4, // can't receive more of what it's buying
// MANAGE_OFFER_UNDERFUNDED = -5, // doesn't hold what it's trying to sell
// MANAGE_OFFER_CROSS_SELF = -6, // would cross an offer from the same user
//
// // update errors
// MANAGE_OFFER_NOT_FOUND = -7, // offerID does not match an existing offer
// MANAGE_OFFER_MISMATCH = -8, // currencies don't match offer
//
// MANAGE_OFFER_LOW_RESERVE = -9 // not enough funds to create a new Offer
// };
//
// ===========================================================================
xdr["enum"]("ManageOfferResultCode", {
manageOfferSuccess: 0,
manageOfferMalformed: -1,
manageOfferNoTrust: -2,
manageOfferNotAuthorized: -3,
manageOfferLineFull: -4,
manageOfferUnderfunded: -5,
manageOfferCrossSelf: -6,
manageOfferNotFound: -7,
manageOfferMismatch: -8,
manageOfferLowReserve: -9 });
// === xdr source ============================================================
//
// enum ManageOfferEffect
// {
// MANAGE_OFFER_CREATED = 0,
// MANAGE_OFFER_UPDATED = 1,
// MANAGE_OFFER_DELETED = 2
// };
//
// ===========================================================================
xdr["enum"]("ManageOfferEffect", {
manageOfferCreated: 0,
manageOfferUpdated: 1,
manageOfferDeleted: 2 });
// === xdr source ============================================================
//
// union switch (ManageOfferEffect effect)
// {
// case MANAGE_OFFER_CREATED:
// case MANAGE_OFFER_UPDATED:
// OfferEntry offer;
// default:
// void;
// }
//
// ===========================================================================
xdr.union("ManageOfferSuccessResultOffer", {
switchOn: xdr.lookup("ManageOfferEffect"),
switchName: "effect",
switches: {
manageOfferCreated: "offer",
manageOfferUpdated: "offer" },
arms: {
offer: xdr.lookup("OfferEntry") },
defaultArm: xdr["void"]() });
// === xdr source ============================================================
//
// struct ManageOfferSuccessResult
// {
// // offers that got claimed while creating this offer
// ClaimOfferAtom offersClaimed<>;
//
// union switch (ManageOfferEffect effect)
// {
// case MANAGE_OFFER_CREATED:
// case MANAGE_OFFER_UPDATED:
// OfferEntry offer;
// default:
// void;
// }
// offer;
// };
//
// ===========================================================================
xdr.struct("ManageOfferSuccessResult", [["offersClaimed", xdr.varArray(xdr.lookup("ClaimOfferAtom"), 2147483647)], ["offer", xdr.lookup("ManageOfferSuccessResultOffer")]]);
// === xdr source ============================================================
//
// union ManageOfferResult switch (ManageOfferResultCode code)
// {
// case MANAGE_OFFER_SUCCESS:
// ManageOfferSuccessResult success;
// default:
// void;
// };
//
// ===========================================================================
xdr.union("ManageOfferResult", {
switchOn: xdr.lookup("ManageOfferResultCode"),
switchName: "code",
switches: {
manageOfferSuccess: "success" },
arms: {
success: xdr.lookup("ManageOfferSuccessResult") },
defaultArm: xdr["void"]() });
// === xdr source ============================================================
//
// enum SetOptionsResultCode
// {
// // codes considered as "success" for the operation
// SET_OPTIONS_SUCCESS = 0,
// // codes considered as "failure" for the operation
// SET_OPTIONS_LOW_RESERVE = -1, // not enough funds to add a signer
// SET_OPTIONS_TOO_MANY_SIGNERS = -2, // max number of signers already reached
// SET_OPTIONS_BAD_FLAGS = -3, // invalid combination of clear/set flags
// SET_OPTIONS_INVALID_INFLATION = -4, // inflation account does not exist
// SET_OPTIONS_CANT_CHANGE = -5, // can no longer change this option
// SET_OPTIONS_UNKNOWN_FLAG = -6 // can't set an unknown flag
// };
//
// ===========================================================================
xdr["enum"]("SetOptionsResultCode", {
setOptionsSuccess: 0,
setOptionsLowReserve: -1,
setOptionsTooManySigner: -2,
setOptionsBadFlag: -3,
setOptionsInvalidInflation: -4,
setOptionsCantChange: -5,
setOptionsUnknownFlag: -6 });
// === xdr source ============================================================
//
// union SetOptionsResult switch (SetOptionsResultCode code)
// {
// case SET_OPTIONS_SUCCESS:
// void;
// default:
// void;
// };
//
// ===========================================================================
xdr.union("SetOptionsResult", {
switchOn: xdr.lookup("SetOptionsResultCode"),
switchName: "code",
switches: {
setOptionsSuccess: xdr["void"]() },
arms: {},
defaultArm: xdr["void"]() });
// === xdr source ============================================================
//
// enum ChangeTrustResultCode
// {
// // codes considered as "success" for the operation
// CHANGE_TRUST_SUCCESS = 0,
// // codes considered as "failure" for the operation
// CHANGE_TRUST_MALFORMED = -1, // bad input
// CHANGE_TRUST_NO_ISSUER = -2, // could not find issuer
// CHANGE_TRUST_INVALID_LIMIT = -3, // cannot drop limit below balance
// CHANGE_TRUST_LOW_RESERVE = -4 // not enough funds to create a new trust line
// };
//
// ===========================================================================
xdr["enum"]("ChangeTrustResultCode", {
changeTrustSuccess: 0,
changeTrustMalformed: -1,
changeTrustNoIssuer: -2,
changeTrustInvalidLimit: -3,
changeTrustLowReserve: -4 });
// === xdr source ============================================================
//
// union ChangeTrustResult switch (ChangeTrustResultCode code)
// {
// case CHANGE_TRUST_SUCCESS:
// void;
// default:
// void;
// };
//
// ===========================================================================
xdr.union("ChangeTrustResult", {
switchOn: xdr.lookup("ChangeTrustResultCode"),
switchName: "code",
switches: {
changeTrustSuccess: xdr["void"]() },
arms: {},
defaultArm: xdr["void"]() });
// === xdr source ============================================================
//
// enum AllowTrustResultCode
// {
// // codes considered as "success" for the operation
// ALLOW_TRUST_SUCCESS = 0,
// // codes considered as "failure" for the operation
// ALLOW_TRUST_MALFORMED = -1, // currency is not CURRENCY_TYPE_ALPHANUM
// ALLOW_TRUST_NO_TRUST_LINE = -2, // trustor does not have a trustline
// // source account does not require trust
// ALLOW_TRUST_TRUST_NOT_REQUIRED = -3,
// ALLOW_TRUST_CANT_REVOKE = -4 // source account can't revoke trust
// };
//
// ===========================================================================
xdr["enum"]("AllowTrustResultCode", {
allowTrustSuccess: 0,
allowTrustMalformed: -1,
allowTrustNoTrustLine: -2,
allowTrustTrustNotRequired: -3,
allowTrustCantRevoke: -4 });
// === xdr source ============================================================
//
// union AllowTrustResult switch (AllowTrustResultCode code)
// {
// case ALLOW_TRUST_SUCCESS:
// void;
// default:
// void;
// };
//
// ===========================================================================
xdr.union("AllowTrustResult", {
switchOn: xdr.lookup("AllowTrustResultCode"),
switchName: "code",
switches: {
allowTrustSuccess: xdr["void"]() },
arms: {},
defaultArm: xdr["void"]() });
// === xdr source ============================================================
//
// enum AccountMergeResultCode
// {
// // codes considered as "success" for the operation
// ACCOUNT_MERGE_SUCCESS = 0,
// // codes considered as "failure" for the operation
// ACCOUNT_MERGE_MALFORMED = -1, // can't merge onto itself
// ACCOUNT_MERGE_NO_ACCOUNT = -2, // destination does not exist
// ACCOUNT_MERGE_HAS_CREDIT = -3, // account has active trust lines
// ACCOUNT_MERGE_CREDIT_HELD = -4 // an issuer cannot be merged if used
// };
//
// ===========================================================================
xdr["enum"]("AccountMergeResultCode", {
accountMergeSuccess: 0,
accountMergeMalformed: -1,
accountMergeNoAccount: -2,
accountMergeHasCredit: -3,
accountMergeCreditHeld: -4 });
// === xdr source ============================================================
//
// union AccountMergeResult switch (AccountMergeResultCode code)
// {
// case ACCOUNT_MERGE_SUCCESS:
// void;
// default:
// void;
// };
//
// ===========================================================================
xdr.union("AccountMergeResult", {
switchOn: xdr.lookup("AccountMergeResultCode"),
switchName: "code",
switches: {
accountMergeSuccess: xdr["void"]() },
arms: {},
defaultArm: xdr["void"]() });
// === xdr source ============================================================
//
// enum InflationResultCode
// {
// // codes considered as "success" for the operation
// INFLATION_SUCCESS = 0,
// // codes considered as "failure" for the operation
// INFLATION_NOT_TIME = -1
// };
//
// ===========================================================================
xdr["enum"]("InflationResultCode", {
inflationSuccess: 0,
inflationNotTime: -1 });
// === xdr source ============================================================
//
// struct inflationPayout // or use PaymentResultAtom to limit types?
// {
// AccountID destination;
// int64 amount;
// };
//
// ===========================================================================
xdr.struct("InflationPayout", [["destination", xdr.lookup("AccountId")], ["amount", xdr.lookup("Int64")]]);
// === xdr source ============================================================
//
// union InflationResult switch (InflationResultCode code)
// {
// case INFLATION_SUCCESS:
// inflationPayout payouts<>;
// default:
// void;
// };
//
// ===========================================================================
xdr.union("InflationResult", {
switchOn: xdr.lookup("InflationResultCode"),
switchName: "code",
switches: {
inflationSuccess: "payouts" },
arms: {
payouts: xdr.varArray(xdr.lookup("InflationPayout"), 2147483647) },
defaultArm: xdr["void"]() });
// === xdr source ============================================================
//
// enum OperationResultCode
// {
// opINNER = 0, // inner object result is valid
//
// opBAD_AUTH = -1, // not enough signatures to perform operation
// opNO_ACCOUNT = -2 // source account was not found
// };
//
// ===========================================================================
xdr["enum"]("OperationResultCode", {
opInner: 0,
opBadAuth: -1,
opNoAccount: -2 });
// === xdr source ============================================================
//
// union switch (OperationType type)
// {
// case CREATE_ACCOUNT:
// CreateAccountResult createAccountResult;
// case PAYMENT:
// PaymentResult paymentResult;
// case PATH_PAYMENT:
// PathPaymentResult pathPaymentResult;
// case MANAGE_OFFER:
// ManageOfferResult manageOfferResult;
// case CREATE_PASSIVE_OFFER:
// ManageOfferResult createPassiveOfferResult;
// case SET_OPTIONS:
// SetOptionsResult setOptionsResult;
// case CHANGE_TRUST:
// ChangeTrustResult changeTrustResult;
// case ALLOW_TRUST:
// AllowTrustResult allowTrustResult;
// case ACCOUNT_MERGE:
// AccountMergeResult accountMergeResult;
// case INFLATION:
// InflationResult inflationResult;
// }
//
// ===========================================================================
xdr.union("OperationResultTr", {
switchOn: xdr.lookup("OperationType"),
switchName: "type",
switches: {
createAccount: "createAccountResult",
payment: "paymentResult",
pathPayment: "pathPaymentResult",
manageOffer: "manageOfferResult",
createPassiveOffer: "createPassiveOfferResult",
setOption: "setOptionsResult",
changeTrust: "changeTrustResult",
allowTrust: "allowTrustResult",
accountMerge: "accountMergeResult",
inflation: "inflationResult" },
arms: {
createAccountResult: xdr.lookup("CreateAccountResult"),
paymentResult: xdr.lookup("PaymentResult"),
pathPaymentResult: xdr.lookup("PathPaymentResult"),
manageOfferResult: xdr.lookup("ManageOfferResult"),
createPassiveOfferResult: xdr.lookup("ManageOfferResult"),
setOptionsResult: xdr.lookup("SetOptionsResult"),
changeTrustResult: xdr.lookup("ChangeTrustResult"),
allowTrustResult: xdr.lookup("AllowTrustResult"),
accountMergeResult: xdr.lookup("AccountMergeResult"),
inflationResult: xdr.lookup("InflationResult") } });
// === xdr source ============================================================
//
// union OperationResult switch (OperationResultCode code)
// {
// case opINNER:
// union switch (OperationType type)
// {
// case CREATE_ACCOUNT:
// CreateAccountResult createAccountResult;
// case PAYMENT:
// PaymentResult paymentResult;
// case PATH_PAYMENT:
// PathPaymentResult pathPaymentResult;
// case MANAGE_OFFER:
// ManageOfferResult manageOfferResult;
// case CREATE_PASSIVE_OFFER:
// ManageOfferResult createPassiveOfferResult;
// case SET_OPTIONS:
// SetOptionsResult setOptionsResult;
// case CHANGE_TRUST:
// ChangeTrustResult changeTrustResult;
// case ALLOW_TRUST:
// AllowTrustResult allowTrustResult;
// case ACCOUNT_MERGE:
// AccountMergeResult accountMergeResult;
// case INFLATION:
// InflationResult inflationResult;
// }
// tr;
// default:
// void;
// };
//
// ===========================================================================
xdr.union("OperationResult", {
switchOn: xdr.lookup("OperationResultCode"),
switchName: "code",
switches: {
opInner: "tr" },
arms: {
tr: xdr.lookup("OperationResultTr") },
defaultArm: xdr["void"]() });
// === xdr source ============================================================
//
// enum TransactionResultCode
// {
// txSUCCESS = 0, // all operations succeeded
//
// txFAILED = -1, // one of the operations failed (but none were applied)
//
// txTOO_EARLY = -2, // ledger closeTime before minTime
// txTOO_LATE = -3, // ledger closeTime after maxTime
// txMISSING_OPERATION = -4, // no operation was specified
// txBAD_SEQ = -5, // sequence number does not match source account
//
// txBAD_AUTH = -6, // not enough signatures to perform transaction
// txINSUFFICIENT_BALANCE = -7, // fee would bring account below reserve
// txNO_ACCOUNT = -8, // source account not found
// txINSUFFICIENT_FEE = -9, // fee is too small
// txBAD_AUTH_EXTRA = -10, // too many signatures on transaction
// txINTERNAL_ERROR = -11 // an unknown error occured
// };
//
// ===========================================================================
xdr["enum"]("TransactionResultCode", {
txSuccess: 0,
txFailed: -1,
txTooEarly: -2,
txTooLate: -3,
txMissingOperation: -4,
txBadSeq: -5,
txBadAuth: -6,
txInsufficientBalance: -7,
txNoAccount: -8,
txInsufficientFee: -9,
txBadAuthExtra: -10,
txInternalError: -11 });
// === xdr source ============================================================
//
// union switch (TransactionResultCode code)
// {
// case txSUCCESS:
// case txFAILED:
// OperationResult results<>;
// default:
// void;
// }
//
// ===========================================================================
xdr.union("TransactionResultResult", {
switchOn: xdr.lookup("TransactionResultCode"),
switchName: "code",
switches: {
txSuccess: "results",
txFailed: "results" },
arms: {
results: xdr.varArray(xdr.lookup("OperationResult"), 2147483647) },
defaultArm: xdr["void"]() });
// === xdr source ============================================================
//
// struct TransactionResult
// {
// int64 feeCharged; // actual fee charged for the transaction
//
// union switch (TransactionResultCode code)
// {
// case txSUCCESS:
// case txFAILED:
// OperationResult results<>;
// default:
// void;
// }
// result;
// };
//
// ===========================================================================
xdr.struct("TransactionResult", [["feeCharged", xdr.lookup("Int64")], ["result", xdr.lookup("TransactionResultResult")]]);
// === xdr source ============================================================
//
// typedef opaque uint512[64];
//
// ===========================================================================
xdr.typedef("Uint512", xdr.opaque(64));
// === xdr source ============================================================
//
// typedef hyper int64;
//
// ===========================================================================
xdr.typedef("Int64", xdr.hyper());
// === xdr source ============================================================
//
// typedef int int32;
//
// ===========================================================================
xdr.typedef("Int32", xdr.int());
// === xdr source ============================================================
//
// typedef opaque AccountID[32];
//
// ===========================================================================
xdr.typedef("AccountId", xdr.opaque(32));
// === xdr source ============================================================
//
// typedef opaque Thresholds[4];
//
// ===========================================================================
xdr.typedef("Thresholds", xdr.opaque(4));
// === xdr source ============================================================
//
// typedef string string32<32>;
//
// ===========================================================================
xdr.typedef("String32", xdr.string(32));
// === xdr source ============================================================
//
// typedef uint64 SequenceNumber;
//
// ===========================================================================
xdr.typedef("SequenceNumber", xdr.lookup("Uint64"));
// === xdr source ============================================================
//
// enum CurrencyType
// {
// CURRENCY_TYPE_NATIVE = 0,
// CURRENCY_TYPE_ALPHANUM = 1
// };
//
// ===========================================================================
xdr["enum"]("CurrencyType", {
currencyTypeNative: 0,
currencyTypeAlphanum: 1 });
// === xdr source ============================================================
//
// struct
// {
// opaque currencyCode[4];
// AccountID issuer;
// }
//
// ===========================================================================
xdr.struct("CurrencyAlphaNum", [["currencyCode", xdr.opaque(4)], ["issuer", xdr.lookup("AccountId")]]);
// === xdr source ============================================================
//
// union Currency switch (CurrencyType type)
// {
// case CURRENCY_TYPE_NATIVE:
// void;
//
// case CURRENCY_TYPE_ALPHANUM:
// struct
// {
// opaque currencyCode[4];
// AccountID issuer;
// } alphaNum;
//
// // add other currency types here in the future
// };
//
// ===========================================================================
xdr.union("Currency", {
switchOn: xdr.lookup("CurrencyType"),
switchName: "type",
switches: {
currencyTypeNative: xdr["void"](),
currencyTypeAlphanum: "alphaNum" },
arms: {
alphaNum: xdr.lookup("CurrencyAlphaNum") } });
// === xdr source ============================================================
//
// struct Price
// {
// int32 n; // numerator
// int32 d; // denominator
// };
//
// ===========================================================================
xdr.struct("Price", [["n", xdr.lookup("Int32")], ["d", xdr.lookup("Int32")]]);
});
module.exports = types;
// commenting below until recursive lookups are supported
//["innerSets", xdr.varArray(xdr.lookup("ScpQuorumSet"), 2147483647)],
/***/ },
/* 34 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _defaults = __webpack_require__(35)["default"];
var _interopRequireWildcard = __webpack_require__(37)["default"];
Object.defineProperty(exports, "__esModule", {
value: true
});
_defaults(exports, _interopRequireWildcard(__webpack_require__(38)));
var _config = __webpack_require__(74);
_defaults(exports, _interopRequireWildcard(_config));
var config = _config.config;
/***/ },
/* 35 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _core = __webpack_require__(36)["default"];
exports["default"] = function (obj, defaults) {
var keys = _core.Object.getOwnPropertyNames(defaults);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
var value = _core.Object.getOwnPropertyDescriptor(defaults, key);
if (value && value.configurable && obj[key] === undefined) {
Object.defineProperty(obj, key, value);
}
}
return obj;
};
exports.__esModule = true;
/***/ },
/* 36 */
/***/ function(module, exports, __webpack_require__) {
/**
* Core.js 0.6.1
* https://github.com/zloirock/core-js
* License: http://rock.mit-license.org
* © 2015 Denis Pushkarev
*/
!function(global, framework, undefined){
'use strict';
/******************************************************************************
* Module : common *
******************************************************************************/
// Shortcuts for [[Class]] & property names
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'
// Aliases global objects and prototypes
, 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
, RangeError = global.RangeError
, setTimeout = global.setTimeout
, setImmediate = global.setImmediate
, clearImmediate = global.clearImmediate
, parseInt = global.parseInt
, isFinite = global.isFinite
, process = global[PROCESS]
, nextTick = process && process.nextTick
, document = global.document
, html = document && document.documentElement
, navigator = global.navigator
, define = global.define
, console = global.console || {}
, ArrayProto = Array[PROTOTYPE]
, ObjectProto = Object[PROTOTYPE]
, FunctionProto = Function[PROTOTYPE]
, Infinity = 1 / 0
, DOT = '.';
// http://jsperf.com/core-js-isobject
function isObject(it){
return it !== null && (typeof it == 'object' || typeof it == 'function');
}
function isFunction(it){
return typeof it == 'function';
}
// Native function?
var isNative = ctx(/./.test, /\[native code\]\s*\}\s*$/, 1);
// Object internal [[Class]] or toStringTag
// http://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring
var 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 toString.call(it).slice(8, -1);
}
function classof(it){
var O, T;
return it == undefined ? it === undefined ? 'Undefined' : 'Null'
: typeof (T = (O = Object(it))[SYMBOL_TAG]) == 'string' ? T : cof(O);
}
// Function
var call = FunctionProto.call
, apply = FunctionProto.apply
, REFERENCE_GET;
// Partial apply
function part(/* ...args */){
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(/* ...args */){
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);
}
}
// Optional / simple context binding
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(/* ...args */){
return fn.apply(that, arguments);
}
}
// Fast apply
// http://jsperf.lnkit.com/fast-apply/5
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);
}
// Object:
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)
// Dummy, fix for not array-like ES3 string in es5 module
, 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);
}
// 19.1.2.1 Object.assign(target, source, ...)
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;
}
// Array
// array('str1,str2,str3') => ['str1', 'str2', 'str3']
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];
/*
* 0 -> forEach
* 1 -> map
* 2 -> filter
* 3 -> some
* 4 -> every
* 5 -> find
* 6 -> findIndex
*/
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/*, that = undefined */){
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; // map
else if(res)switch(type){
case 3: return true; // some
case 5: return val; // find
case 6: return index; // findIndex
case 2: result.push(val); // filter
} else if(isEvery)return false; // every
}
}
return isFindIndex ? -1 : isSome || isEvery ? isEvery : result;
}
}
function createArrayContains(isContains){
return function(el /*, fromIndex = 0 */){
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){
// strange IE quirks mode bug -> use typeof vs isFunction
return typeof A == 'function' ? A : B;
}
// Math
var MAX_SAFE_INTEGER = 0x1fffffffffffff // pow(2, 53) - 1 == 9007199254740991
, pow = Math.pow
, abs = Math.abs
, 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);
}
// 20.1.2.4 Number.isNaN(number)
function sameNaN(number){
return number != number;
}
// 7.1.4 ToInteger
function toInteger(it){
return isNaN(it) ? 0 : trunc(it);
}
// 7.1.15 ToLength
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 lz(num){
return num > 9 ? num : '0' + num;
}
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 < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
? toString ? s.charAt(i) : a
: toString ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
}
}
// Assertion & errors
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!");
}
// Property descriptors & Symbol
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);
}
// The engine works fine with descriptors? Thank's IE8 for his funny defineProperty.
var DESC = !!function(){
try {
return defineProperty({}, 'a', {get: function(){ return 2 }}).a == 2;
} catch(e){}
}()
, 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_TAG = getWellKnownSymbol(TO_STRING_TAG)
, SYMBOL_SPECIES = getWellKnownSymbol('species')
, SYMBOL_ITERATOR;
function setSpecies(C){
if(DESC && (framework || !isNative(C)))defineProperty(C, SYMBOL_SPECIES, {
configurable: true,
get: returnThis
});
}
/******************************************************************************
* Module : common.export *
******************************************************************************/
var NODE = cof(process) == PROCESS
, core = {}
, path = framework ? global : core
, old = global.core
, exportGlobal
// type bitmap
, 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){
// there is a similar native
own = !(type & FORCED) && target && key in target
&& (!isFunction(target[key]) || isNative(target[key]));
// export native or passed
out = (own ? target : source)[key];
// prevent global pollution for namespaces
if(!framework && isGlobal && !isFunction(target[key]))exp = source[key];
// bind timers to global for call from export context
else if(type & BIND && own)exp = ctx(out, global);
// wrap global constructors for prevent change them in library
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;
// extend global
if(framework && target && !own){
if(isGlobal)target[key] = out;
else delete target[key] && hidden(target, key, out);
}
// export
if(exports[key] != out)hidden(exports, key, exp);
}
}
// CommonJS export
if(typeof module != 'undefined' && module.exports)module.exports = core;
// RequireJS export
else if(isFunction(define) && define.amd)define(function(){return core});
// Export to global object
else exportGlobal = true;
if(exportGlobal || framework){
core.noConflict = function(){
global.core = old;
return core;
}
global.core = core;
}
/******************************************************************************
* Module : common.iterators *
******************************************************************************/
SYMBOL_ITERATOR = getWellKnownSymbol(ITERATOR);
var ITER = safeSymbol('iter')
, KEY = 1
, VALUE = 2
, Iterators = {}
, IteratorPrototype = {}
// Safari has byggy iterators w/o `next`
, BUGGY_ITERATORS = 'keys' in ArrayProto && !('next' in [].keys());
// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
setIterator(IteratorPrototype, returnThis);
function setIterator(O, value){
hidden(O, SYMBOL_ITERATOR, value);
// Add iterator for FF iterator protocol
FF_ITERATOR in ArrayProto && 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){
// Define iterator
setIterator(proto, iter);
if(iter !== value){
var iterProto = getPrototypeOf(iter.call(new Constructor));
// Set @@toStringTag to native iterators
setToStringTag(iterProto, NAME + ' Iterator', true);
// FF fix
has(proto, FF_ITERATOR) && setIterator(iterProto, returnThis);
}
}
// Plug for library
Iterators[NAME] = iter;
// FF & v8 fix
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 checkDangerIterClosing(fn){
var danger = true;
var O = {
next: function(){ throw 1 },
'return': function(){ danger = false }
};
O[SYMBOL_ITERATOR] = returnThis;
try {
fn(O);
} catch(e){}
return danger;
}
function closeIterator(iterator){
var ret = iterator['return'];
if(ret !== undefined)ret.call(iterator);
}
function safeIterClose(exec, iterator){
try {
exec(iterator);
} catch(e){
closeIterator(iterator);
throw e;
}
}
function forOf(iterable, entries, fn, that){
safeIterClose(function(iterator){
var f = ctx(fn, that, entries ? 2 : 1)
, step;
while(!(step = iterator.next()).done)if(stepCall(f, step.value, entries) === false){
return closeIterator(iterator);
}
}, getIterator(iterable));
}
/******************************************************************************
* Module : es6.symbol *
******************************************************************************/
// ECMAScript 6 symbols shim
!function(TAG, SymbolRegistry, AllSymbols, setter){
// 19.4.1.1 Symbol([description])
if(!isNative(Symbol)){
Symbol = function(description){
assert(!(this instanceof Symbol), SYMBOL + ' is not a ' + CONSTRUCTOR);
var tag = uid(description)
, sym = set(create(Symbol[PROTOTYPE]), TAG, tag);
AllSymbols[tag] = sym;
DESC && setter && defineProperty(ObjectProto, tag, {
configurable: true,
set: function(value){
hidden(this, tag, value);
}
});
return sym;
}
hidden(Symbol[PROTOTYPE], TO_STRING, function(){
return this[TAG];
});
}
$define(GLOBAL + WRAP, {Symbol: Symbol});
var symbolStatics = {
// 19.4.2.1 Symbol.for(key)
'for': function(key){
return has(SymbolRegistry, key += '')
? SymbolRegistry[key]
: SymbolRegistry[key] = Symbol(key);
},
// 19.4.2.4 Symbol.iterator
iterator: SYMBOL_ITERATOR || getWellKnownSymbol(ITERATOR),
// 19.4.2.5 Symbol.keyFor(sym)
keyFor: part.call(keyOf, SymbolRegistry),
// 19.4.2.10 Symbol.species
species: SYMBOL_SPECIES,
// 19.4.2.13 Symbol.toStringTag
toStringTag: SYMBOL_TAG = getWellKnownSymbol(TO_STRING_TAG, true),
// 19.4.2.14 Symbol.unscopables
unscopables: SYMBOL_UNSCOPABLES,
pure: safeSymbol,
set: set,
useSetter: function(){setter = true},
useSimple: function(){setter = false}
};
// 19.4.2.2 Symbol.hasInstance
// 19.4.2.3 Symbol.isConcatSpreadable
// 19.4.2.6 Symbol.match
// 19.4.2.8 Symbol.replace
// 19.4.2.9 Symbol.search
// 19.4.2.11 Symbol.split
// 19.4.2.12 Symbol.toPrimitive
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, {
// 19.1.2.7 Object.getOwnPropertyNames(O)
getOwnPropertyNames: function(it){
var names = getNames(toObject(it)), result = [], key, i = 0;
while(names.length > i)has(AllSymbols, key = names[i++]) || result.push(key);
return result;
},
// 19.1.2.8 Object.getOwnPropertySymbols(O)
getOwnPropertySymbols: function(it){
var names = getNames(toObject(it)), result = [], key, i = 0;
while(names.length > i)has(AllSymbols, key = names[i++]) && result.push(AllSymbols[key]);
return result;
}
});
// 20.2.1.9 Math[@@toStringTag]
setToStringTag(Math, MATH, true);
// 24.3.3 JSON[@@toStringTag]
setToStringTag(global.JSON, 'JSON', true);
}(safeSymbol('tag'), {}, {}, true);
/******************************************************************************
* Module : es6.object.statics *
******************************************************************************/
!function(){
var objectStatic = {
// 19.1.3.1 Object.assign(target, source)
assign: assign,
// 19.1.3.10 Object.is(value1, value2)
is: function(x, y){
return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
}
};
// 19.1.3.19 Object.setPrototypeOf(O, proto)
// Works with __proto__ only. Old v8 can't works with null proto objects.
'__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);
}();
/******************************************************************************
* Module : es6.object.statics-accept-primitives *
******************************************************************************/
!function(){
// Object static methods accept primitives
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');
}();
/******************************************************************************
* Module : es6.number.statics *
******************************************************************************/
!function(isInteger){
$define(STATIC, NUMBER, {
// 20.1.2.1 Number.EPSILON
EPSILON: pow(2, -52),
// 20.1.2.2 Number.isFinite(number)
isFinite: function(it){
return typeof it == 'number' && isFinite(it);
},
// 20.1.2.3 Number.isInteger(number)
isInteger: isInteger,
// 20.1.2.4 Number.isNaN(number)
isNaN: sameNaN,
// 20.1.2.5 Number.isSafeInteger(number)
isSafeInteger: function(number){
return isInteger(number) && abs(number) <= MAX_SAFE_INTEGER;
},
// 20.1.2.6 Number.MAX_SAFE_INTEGER
MAX_SAFE_INTEGER: MAX_SAFE_INTEGER,
// 20.1.2.10 Number.MIN_SAFE_INTEGER
MIN_SAFE_INTEGER: -MAX_SAFE_INTEGER,
// 20.1.2.12 Number.parseFloat(string)
parseFloat: parseFloat,
// 20.1.2.13 Number.parseInt(string, radix)
parseInt: parseInt
});
// 20.1.2.3 Number.isInteger(number)
}(Number.isInteger || function(it){
return !isObject(it) && isFinite(it) && floor(it) === it;
});
/******************************************************************************
* Module : es6.math *
******************************************************************************/
// ECMAScript 6 shim
!function(){
// 20.2.2.28 Math.sign(x)
var E = Math.E
, exp = Math.exp
, log = Math.log
, sqrt = Math.sqrt
, sign = Math.sign || function(x){
return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1;
};
// 20.2.2.5 Math.asinh(x)
function asinh(x){
return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : log(x + sqrt(x * x + 1));
}
// 20.2.2.14 Math.expm1(x)
function expm1(x){
return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : exp(x) - 1;
}
$define(STATIC, MATH, {
// 20.2.2.3 Math.acosh(x)
acosh: function(x){
return (x = +x) < 1 ? NaN : isFinite(x) ? log(x / E + sqrt(x + 1) * sqrt(x - 1) / E) + 1 : x;
},
// 20.2.2.5 Math.asinh(x)
asinh: asinh,
// 20.2.2.7 Math.atanh(x)
atanh: function(x){
return (x = +x) == 0 ? x : log((1 + x) / (1 - x)) / 2;
},
// 20.2.2.9 Math.cbrt(x)
cbrt: function(x){
return sign(x = +x) * pow(abs(x), 1 / 3);
},
// 20.2.2.11 Math.clz32(x)
clz32: function(x){
return (x >>>= 0) ? 32 - x[TO_STRING](2).length : 32;
},
// 20.2.2.12 Math.cosh(x)
cosh: function(x){
return (exp(x = +x) + exp(-x)) / 2;
},
// 20.2.2.14 Math.expm1(x)
expm1: expm1,
// 20.2.2.16 Math.fround(x)
// TODO: fallback for IE9-
fround: function(x){
return new Float32Array([x])[0];
},
// 20.2.2.17 Math.hypot([value1[, value2[, … ]]])
hypot: function(value1, value2){
var sum = 0
, len1 = arguments.length
, len2 = len1
, args = Array(len1)
, larg = -Infinity
, arg;
while(len1--){
arg = args[len1] = +arguments[len1];
if(arg == Infinity || arg == -Infinity)return Infinity;
if(arg > larg)larg = arg;
}
larg = arg || 1;
while(len2--)sum += pow(args[len2] / larg, 2);
return larg * sqrt(sum);
},
// 20.2.2.18 Math.imul(x, y)
imul: function(x, y){
var UInt16 = 0xffff
, xn = +x
, yn = +y
, xl = UInt16 & xn
, yl = UInt16 & yn;
return 0 | xl * yl + ((UInt16 & xn >>> 16) * yl + xl * (UInt16 & yn >>> 16) << 16 >>> 0);
},
// 20.2.2.20 Math.log1p(x)
log1p: function(x){
return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : log(1 + x);
},
// 20.2.2.21 Math.log10(x)
log10: function(x){
return log(x) / Math.LN10;
},
// 20.2.2.22 Math.log2(x)
log2: function(x){
return log(x) / Math.LN2;
},
// 20.2.2.28 Math.sign(x)
sign: sign,
// 20.2.2.30 Math.sinh(x)
sinh: function(x){
return (abs(x = +x) < 1) ? (expm1(x) - expm1(-x)) / 2 : (exp(x - 1) - exp(-x - 1)) * (E / 2);
},
// 20.2.2.33 Math.tanh(x)
tanh: function(x){
var a = expm1(x = +x)
, b = expm1(-x);
return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(x) + exp(-x));
},
// 20.2.2.34 Math.trunc(x)
trunc: trunc
});
}();
/******************************************************************************
* Module : es6.string *
******************************************************************************/
!function(fromCharCode){
function assertNotRegExp(it){
if(cof(it) == REGEXP)throw TypeError();
}
$define(STATIC, STRING, {
// 21.1.2.2 String.fromCodePoint(...codePoints)
fromCodePoint: function(x){
var res = []
, len = arguments.length
, i = 0
, code
while(len > i){
code = +arguments[i++];
if(toIndex(code, 0x10ffff) !== code)throw RangeError(code + ' is not a valid code point');
res.push(code < 0x10000
? fromCharCode(code)
: fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)
);
} return res.join('');
},
// 21.1.2.4 String.raw(callSite, ...substitutions)
raw: function(callSite){
var raw = toObject(callSite.raw)
, len = toLength(raw.length)
, sln = arguments.length
, res = []
, i = 0;
while(len > i){
res.push(String(raw[i++]));
if(i < sln)res.push(String(arguments[i]));
} return res.join('');
}
});
$define(PROTO, STRING, {
// 21.1.3.3 String.prototype.codePointAt(pos)
codePointAt: createPointAt(false),
// 21.1.3.6 String.prototype.endsWith(searchString [, endPosition])
endsWith: function(searchString /*, endPosition = @length */){
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;
},
// 21.1.3.7 String.prototype.includes(searchString, position = 0)
includes: function(searchString /*, position = 0 */){
assertNotRegExp(searchString);
return !!~String(assertDefined(this)).indexOf(searchString, arguments[1]);
},
// 21.1.3.13 String.prototype.repeat(count)
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;
},
// 21.1.3.18 String.prototype.startsWith(searchString [, position ])
startsWith: function(searchString /*, position = 0 */){
assertNotRegExp(searchString);
var that = String(assertDefined(this))
, index = toLength(min(arguments[1], that.length));
searchString += '';
return that.slice(index, index + searchString.length) === searchString;
}
});
}(String.fromCharCode);
/******************************************************************************
* Module : es6.array.statics *
******************************************************************************/
!function(){
$define(STATIC + FORCED * checkDangerIterClosing(Array.from), ARRAY, {
// 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)
from: function(arrayLike/*, mapfn = undefined, thisArg = undefined*/){
var O = Object(assertDefined(arrayLike))
, mapfn = arguments[1]
, mapping = mapfn !== undefined
, f = mapping ? ctx(mapfn, arguments[2], 2) : undefined
, index = 0
, length, result, step;
if(isIterable(O)){
result = new (generic(this, Array));
safeIterClose(function(iterator){
for(; !(step = iterator.next()).done; index++){
result[index] = mapping ? f(step.value, index) : step.value;
}
}, getIterator(O));
} else {
result = new (generic(this, Array))(length = toLength(O.length));
for(; length > index; index++){
result[index] = mapping ? f(O[index], index) : O[index];
}
}
result.length = index;
return result;
}
});
$define(STATIC, ARRAY, {
// 22.1.2.3 Array.of( ...items)
of: function(/* ...args */){
var index = 0
, length = arguments.length
, result = new (generic(this, Array))(length);
while(length > index)result[index] = arguments[index++];
result.length = length;
return result;
}
});
setSpecies(Array);
}();
/******************************************************************************
* Module : es6.array.prototype *
******************************************************************************/
!function(){
$define(PROTO, ARRAY, {
// 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length)
copyWithin: function(target /* = 0 */, start /* = 0, end = @length */){
var O = Object(assertDefined(this))
, len = toLength(O.length)
, to = toIndex(target, len)
, from = toIndex(start, len)
, end = arguments[2]
, fin = end === undefined ? len : toIndex(end, len)
, count = 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;
},
// 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length)
fill: function(value /*, start = 0, end = @length */){
var O = Object(assertDefined(this))
, length = toLength(O.length)
, index = toIndex(arguments[1], length)
, end = arguments[2]
, endPos = end === undefined ? length : toIndex(end, length);
while(endPos > index)O[index++] = value;
return O;
},
// 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined)
find: createArrayMethod(5),
// 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined)
findIndex: createArrayMethod(6)
});
if(framework){
// 22.1.3.31 Array.prototype[@@unscopables]
forEach.call(array('find,findIndex,fill,copyWithin,entries,keys,values'), function(it){
ArrayUnscopables[it] = true;
});
SYMBOL_UNSCOPABLES in ArrayProto || hidden(ArrayProto, SYMBOL_UNSCOPABLES, ArrayUnscopables);
}
}();
/******************************************************************************
* Module : es6.iterators *
******************************************************************************/
!function(at){
// 22.1.3.4 Array.prototype.entries()
// 22.1.3.13 Array.prototype.keys()
// 22.1.3.29 Array.prototype.values()
// 22.1.3.30 Array.prototype[@@iterator]()
defineStdIterators(Array, ARRAY, function(iterated, kind){
set(this, ITER, {o: toObject(iterated), i: 0, k: kind});
// 22.1.5.2.1 %ArrayIteratorPrototype%.next()
}, function(){
var iter = this[ITER]
, O = iter.o
, kind = iter.k
, index = iter.i++;
if(!O || index >= O.length){
iter.o = undefined;
return iterResult(1);
}
if(kind == KEY) return iterResult(0, index);
if(kind == VALUE)return iterResult(0, O[index]);
return iterResult(0, [index, O[index]]);
}, VALUE);
// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
Iterators[ARGUMENTS] = Iterators[ARRAY];
// 21.1.3.27 String.prototype[@@iterator]()
defineStdIterators(String, STRING, function(iterated){
set(this, ITER, {o: String(iterated), i: 0});
// 21.1.5.2.1 %StringIteratorPrototype%.next()
}, function(){
var iter = this[ITER]
, O = iter.o
, index = iter.i
, point;
if(index >= O.length)return iterResult(1);
point = at.call(O, index);
iter.i += point.length;
return iterResult(0, point);
});
}(createPointAt(true));
/******************************************************************************
* Module : web.immediate *
******************************************************************************/
// setImmediate shim
// Node.js 0.9+ & IE10+ has setImmediate, else:
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);
}
// Node.js 0.8-
if(NODE){
defer = function(id){
nextTick(part.call(run, id));
}
// Modern browsers, skip implementation for WebWorkers
// IE8 has postMessage, but it's sync & typeof its postMessage is object
} else if(addEventListener && isFunction(postMessage) && !global.importScripts){
defer = function(id){
postMessage(id, '*');
}
addEventListener('message', listner, false);
// WebWorkers
} else if(isFunction(MessageChannel)){
channel = new MessageChannel;
port = channel.port2;
channel.port1.onmessage = listner;
defer = ctx(port.postMessage, port, 1);
// IE8-
} else if(document && ONREADYSTATECHANGE in document[CREATE_ELEMENT]('script')){
defer = function(id){
html.appendChild(document[CREATE_ELEMENT]('script'))[ONREADYSTATECHANGE] = function(){
html.removeChild(this);
run(id);
}
}
// Rest old browsers
} else {
defer = function(id){
setTimeout(run, 0, id);
}
}
}('onreadystatechange');
$define(GLOBAL + BIND, {
setImmediate: setImmediate,
clearImmediate: clearImmediate
});
/******************************************************************************
* Module : es6.promise *
******************************************************************************/
// ES6 promises shim
// Based on https://github.com/getify/native-promise-only/
!function(Promise, test){
isFunction(Promise) && isFunction(Promise.resolve)
&& Promise.resolve(test = new Promise(function(){})) == test
|| function(asap, RECORD){
function isThenable(it){
var then;
if(isObject(it))then = it.then;
return isFunction(then) ? then : false;
}
function handledRejectionOrHasOnRejected(promise){
var record = promise[RECORD]
, chain = record.c
, i = 0
, react;
if(record.h)return true;
while(chain.length > i){
react = chain[i++];
if(react.fail || handledRejectionOrHasOnRejected(react.P))return true;
}
}
function notify(record, reject){
var chain = record.c;
if(reject || chain.length)asap(function(){
var promise = record.p
, value = record.v
, ok = record.s == 1
, i = 0;
if(reject && !handledRejectionOrHasOnRejected(promise)){
setTimeout(function(){
if(!handledRejectionOrHasOnRejected(promise)){
if(NODE){
if(!process.emit('unhandledRejection', value, promise)){
// default node.js behavior
}
} else if(isFunction(console.error)){
console.error('Unhandled promise rejection', value);
}
}
}, 1e3);
} else while(chain.length > i)!function(react){
var cb = ok ? react.ok : react.fail
, ret, then;
try {
if(cb){
if(!ok)record.h = true;
ret = cb === true ? value : cb(value);
if(ret === react.P){
react.rej(TypeError(PROMISE + '-chain cycle'));
} else if(then = isThenable(ret)){
then.call(ret, react.res, react.rej);
} else react.res(ret);
} else react.rej(value);
} catch(err){
react.rej(err);
}
}(chain[i++]);
chain.length = 0;
});
}
function resolve(value){
var record = this
, then, wrapper;
if(record.d)return;
record.d = true;
record = record.r || record; // unwrap
try {
if(then = isThenable(value)){
wrapper = {r: record, d: false}; // wrap
then.call(value, ctx(resolve, wrapper, 1), ctx(reject, wrapper, 1));
} else {
record.v = value;
record.s = 1;
notify(record);
}
} catch(err){
reject.call(wrapper || {r: record, d: false}, err); // wrap
}
}
function reject(value){
var record = this;
if(record.d)return;
record.d = true;
record = record.r || record; // unwrap
record.v = value;
record.s = 2;
notify(record, true);
}
function getConstructor(C){
var S = assertObject(C)[SYMBOL_SPECIES];
return S != undefined ? S : C;
}
// 25.4.3.1 Promise(executor)
Promise = function(executor){
assertFunction(executor);
assertInstance(this, Promise, PROMISE);
var record = {
p: this, // promise
c: [], // chain
s: 0, // state
d: false, // done
v: undefined, // value
h: false // handled rejection
};
hidden(this, RECORD, record);
try {
executor(ctx(resolve, record, 1), ctx(reject, record, 1));
} catch(err){
reject.call(record, err);
}
}
assignHidden(Promise[PROTOTYPE], {
// 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
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);
}), record = this[RECORD];
record.c.push(react);
record.s && notify(record);
return P;
},
// 25.4.5.1 Promise.prototype.catch(onRejected)
'catch': function(onRejected){
return this.then(undefined, onRejected);
}
});
assignHidden(Promise, {
// 25.4.4.1 Promise.all(iterable)
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);
});
},
// 25.4.4.4 Promise.race(iterable)
race: function(iterable){
var Promise = getConstructor(this);
return new Promise(function(resolve, reject){
forOf(iterable, false, function(promise){
Promise.resolve(promise).then(resolve, reject);
});
});
},
// 25.4.4.5 Promise.reject(r)
reject: function(r){
return new (getConstructor(this))(function(resolve, reject){
reject(r);
});
},
// 25.4.4.6 Promise.resolve(x)
resolve: function(x){
return isObject(x) && RECORD in x && getPrototypeOf(x) === this[PROTOTYPE]
? x : new (getConstructor(this))(function(resolve, reject){
resolve(x);
});
}
});
}(nextTick || setImmediate, safeSymbol('record'));
setToStringTag(Promise, PROMISE);
setSpecies(Promise);
$define(GLOBAL + FORCED * !isNative(Promise), {Promise: Promise});
}(global[PROMISE]);
/******************************************************************************
* Module : es6.collections *
******************************************************************************/
// ECMAScript 6 collections shim
!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')))){
// create collection constructor
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 || !DESC || defineProperty(C[PROTOTYPE], 'size', {get: function(){
return assertDefined(this[SIZE]);
}});
} else {
var Native = C
, inst = new C
, chain = inst[ADDER](isWeak ? {} : -0, 1)
, buggyZero;
// wrap to init collections from iterable
if(checkDangerIterClosing(function(O){ new C(O) })){
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;
});
// fix converting -0 key to +0
if(buggyZero){
fixSVZ('delete');
fixSVZ('has');
isMap && fixSVZ('get');
}
// + fix .add & .set for chaining
if(buggyZero || chain !== inst)fixSVZ(ADDER, true);
}
setToStringTag(C, NAME);
setSpecies(C);
O[NAME] = C;
$define(GLOBAL + WRAP + FORCED * !isNative(C), O);
// add .keys, .values, .entries, [@@iterator]
// 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11
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;
// revert to the last existing entry
while(entry && entry.r)entry = entry.p;
// get next entry
if(!iter.o || !(iter.l = entry = entry ? entry.n : iter.o[FIRST])){
// or finish the iteration
iter.o = undefined;
return iterResult(1);
}
// return step by kind
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){
// return primitive with prefix
if(!isObject(it))return (typeof it == 'string' ? 'S' : 'P') + it;
// can't set id to frozen object
if(isFrozen(it))return 'F';
if(!has(it, UID)){
// not necessary to add id
if(!create)return 'E';
// add missing object id
hidden(it, UID, ++uid);
// return object id with prefix
} return 'O' + it[UID];
}
function getEntry(that, key){
// fast case
var index = fastKey(key), entry;
if(index != 'F')return that[O1][index];
// frozen object case
for(entry = that[FIRST]; entry; entry = entry.n){
if(entry.k == key)return entry;
}
}
function def(that, key, value){
var entry = getEntry(that, key)
, prev, index;
// change existing entry
if(entry)entry.v = value;
// create new entry
else {
that[LAST] = entry = {
i: index = fastKey(key, true), // <- index
k: key, // <- key
v: value, // <- value
p: prev = that[LAST], // <- previous entry
n: undefined, // <- next entry
r: false // <- removed
};
if(!that[FIRST])that[FIRST] = entry;
if(prev)prev.n = entry;
that[SIZE]++;
// add to index
if(index != 'F')that[O1][index] = entry;
} return that;
}
var collectionMethods = {
// 23.1.3.1 Map.prototype.clear()
// 23.2.3.2 Set.prototype.clear()
clear: function(){
for(var that = this, data = that[O1], entry = that[FIRST]; entry; entry = entry.n){
entry.r = true;
if(entry.p)entry.p = entry.p.n = undefined;
delete data[entry.i];
}
that[FIRST] = that[LAST] = undefined;
that[SIZE] = 0;
},
// 23.1.3.3 Map.prototype.delete(key)
// 23.2.3.4 Set.prototype.delete(value)
'delete': function(key){
var that = this
, entry = getEntry(that, key);
if(entry){
var next = entry.n
, prev = entry.p;
delete that[O1][entry.i];
entry.r = true;
if(prev)prev.n = next;
if(next)next.p = prev;
if(that[FIRST] == entry)that[FIRST] = next;
if(that[LAST] == entry)that[LAST] = prev;
that[SIZE]--;
} return !!entry;
},
// 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
// 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
forEach: function(callbackfn /*, that = undefined */){
var f = ctx(callbackfn, arguments[1], 3)
, entry;
while(entry = entry ? entry.n : this[FIRST]){
f(entry.v, entry.k, this);
// revert to the last existing entry
while(entry && entry.r)entry = entry.p;
}
},
// 23.1.3.7 Map.prototype.has(key)
// 23.2.3.7 Set.prototype.has(value)
has: function(key){
return !!getEntry(this, key);
}
}
// 23.1 Map Objects
Map = getCollection(Map, MAP, {
// 23.1.3.6 Map.prototype.get(key)
get: function(key){
var entry = getEntry(this, key);
return entry && entry.v;
},
// 23.1.3.9 Map.prototype.set(key, value)
set: function(key, value){
return def(this, key === 0 ? 0 : key, value);
}
}, collectionMethods, true);
// 23.2 Set Objects
Set = getCollection(Set, SET, {
// 23.2.3.1 Set.prototype.add(value)
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 = {
// 23.3.3.2 WeakMap.prototype.delete(key)
// 23.4.3.3 WeakSet.prototype.delete(value)
'delete': function(key){
if(!isObject(key))return false;
if(isFrozen(key))return leakStore(this)['delete'](key);
return has(key, WEAK) && has(key[WEAK], this[UID]) && delete key[WEAK][this[UID]];
},
// 23.3.3.4 WeakMap.prototype.has(key)
// 23.4.3.4 WeakSet.prototype.has(value)
has: function(key){
if(!isObject(key))return false;
if(isFrozen(key))return leakStore(this).has(key);
return has(key, WEAK) && has(key[WEAK], this[UID]);
}
};
// 23.3 WeakMap Objects
WeakMap = getCollection(WeakMap, WEAKMAP, {
// 23.3.3.3 WeakMap.prototype.get(key)
get: function(key){
if(isObject(key)){
if(isFrozen(key))return leakStore(this).get(key);
if(has(key, WEAK))return key[WEAK][this[UID]];
}
},
// 23.3.3.5 WeakMap.prototype.set(key, value)
set: function(key, value){
return defWeak(this, key, value);
}
}, weakMethods, true, true);
// IE11 WeakMap frozen keys fix
if(framework && new WeakMap().set(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){
// store frozen objects on leaky map
if(isObject(a) && isFrozen(a)){
var result = leakStore(this)[key](a, b);
return key == 'set' ? this : result;
// store all the rest on native weakmap
} return method.call(this, a, b);
};
});
}
// 23.4 WeakSet Objects
WeakSet = getCollection(WeakSet, WEAKSET, {
// 23.4.3.1 WeakSet.prototype.add(value)
add: function(value){
return defWeak(this, value, true);
}
}, weakMethods, false, true);
}();
/******************************************************************************
* Module : es6.reflect *
******************************************************************************/
!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/*, receiver*/){
var receiver = arguments.length < 3 ? target : arguments[2]
, desc = getOwnDescriptor(assertObject(target), propertyKey), proto;
if(desc)return has(desc, 'value')
? desc.value
: desc.get === undefined
? undefined
: desc.get.call(receiver);
return isObject(proto = getPrototypeOf(target))
? reflectGet(proto, propertyKey, receiver)
: undefined;
}
function reflectSet(target, propertyKey, V/*, receiver*/){
var receiver = arguments.length < 4 ? target : arguments[3]
, ownDesc = getOwnDescriptor(assertObject(target), propertyKey)
, existingDescriptor, proto;
if(!ownDesc){
if(isObject(proto = getPrototypeOf(target))){
return reflectSet(proto, propertyKey, V, receiver);
}
ownDesc = descriptor(0);
}
if(has(ownDesc, 'value')){
if(ownDesc.writable === false || !isObject(receiver))return false;
existingDescriptor = getOwnDescriptor(receiver, propertyKey) || descriptor(0);
existingDescriptor.value = V;
return defineProperty(receiver, propertyKey, existingDescriptor), true;
}
return ownDesc.set === undefined
? false
: (ownDesc.set.call(receiver, V), true);
}
var isExtensible = Object.isExtensible || returnIt;
var reflect = {
// 26.1.1 Reflect.apply(target, thisArgument, argumentsList)
apply: ctx(call, apply, 3),
// 26.1.2 Reflect.construct(target, argumentsList [, newTarget])
construct: function(target, argumentsList /*, newTarget*/){
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;
},
// 26.1.3 Reflect.defineProperty(target, propertyKey, attributes)
defineProperty: wrap(defineProperty),
// 26.1.4 Reflect.deleteProperty(target, propertyKey)
deleteProperty: function(target, propertyKey){
var desc = getOwnDescriptor(assertObject(target), propertyKey);
return desc && !desc.configurable ? false : delete target[propertyKey];
},
// 26.1.5 Reflect.enumerate(target)
enumerate: function(target){
return new Enumerate(assertObject(target));
},
// 26.1.6 Reflect.get(target, propertyKey [, receiver])
get: reflectGet,
// 26.1.7 Reflect.getOwnPropertyDescriptor(target, propertyKey)
getOwnPropertyDescriptor: function(target, propertyKey){
return getOwnDescriptor(assertObject(target), propertyKey);
},
// 26.1.8 Reflect.getPrototypeOf(target)
getPrototypeOf: function(target){
return getPrototypeOf(assertObject(target));
},
// 26.1.9 Reflect.has(target, propertyKey)
has: function(target, propertyKey){
return propertyKey in target;
},
// 26.1.10 Reflect.isExtensible(target)
isExtensible: function(target){
return !!isExtensible(assertObject(target));
},
// 26.1.11 Reflect.ownKeys(target)
ownKeys: ownKeys,
// 26.1.12 Reflect.preventExtensions(target)
preventExtensions: wrap(Object.preventExtensions || returnIt),
// 26.1.13 Reflect.set(target, propertyKey, V [, receiver])
set: reflectSet
}
// 26.1.14 Reflect.setPrototypeOf(target, proto)
if(setPrototypeOf)reflect.setPrototypeOf = function(target, proto){
return setPrototypeOf(assertObject(target), proto), true;
};
$define(GLOBAL, {Reflect: {}});
$define(STATIC, 'Reflect', reflect);
}();
/******************************************************************************
* Module : es7.proposals *
******************************************************************************/
!function(){
$define(PROTO, ARRAY, {
// https://github.com/domenic/Array.prototype.includes
includes: createArrayContains(true)
});
$define(PROTO, STRING, {
// https://github.com/mathiasbynens/String.prototype.at
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, {
// https://gist.github.com/WebReflection/9353781
getOwnPropertyDescriptors: function(object){
var O = toObject(object)
, result = {};
forEach.call(ownKeys(O), function(key){
defineProperty(result, key, descriptor(0, getOwnDescriptor(O, key)));
});
return result;
},
// https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-04/apr-9.md#51-objectentries-objectvalues
values: createObjectToArray(false),
entries: createObjectToArray(true)
});
$define(STATIC, REGEXP, {
// https://gist.github.com/kangax/9698100
escape: createReplacer(/([\\\-[\]{}()*+?.,^$|])/g, '\\$1', true)
});
}();
/******************************************************************************
* Module : es7.abstract-refs *
******************************************************************************/
// https://github.com/zenparsing/es-abstract-refs
!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');
/******************************************************************************
* Module : core.dict *
******************************************************************************/
!function(DICT){
Dict = function(iterable){
var dict = create(null);
if(iterable != undefined){
if(isIterable(iterable)){
forOf(iterable, true, function(key, value){
dict[key] = value;
});
} else assign(dict, iterable);
}
return dict;
}
Dict[PROTOTYPE] = null;
function DictIterator(iterated, kind){
set(this, ITER, {o: toObject(iterated), a: getKeys(iterated), i: 0, k: kind});
}
createIterator(DictIterator, DICT, function(){
var iter = this[ITER]
, O = iter.o
, keys = iter.a
, kind = iter.k
, key;
do {
if(iter.i >= keys.length){
iter.o = undefined;
return iterResult(1);
}
} while(!has(O, key = keys[iter.i++]));
if(kind == KEY) return iterResult(0, key);
if(kind == VALUE)return iterResult(0, O[key]);
return iterResult(0, [key, O[key]]);
});
function createDictIter(kind){
return function(it){
return new DictIterator(it, kind);
}
}
/*
* 0 -> forEach
* 1 -> map
* 2 -> filter
* 3 -> some
* 4 -> every
* 5 -> find
* 6 -> findKey
* 7 -> mapPairs
*/
function createDictMethod(type){
var isMap = type == 1
, isEvery = type == 4;
return function(object, callbackfn, that /* = undefined */){
var f = ctx(callbackfn, that, 3)
, O = toObject(object)
, result = isMap || type == 7 || type == 2 ? new (generic(this, Dict)) : undefined
, key, val, res;
for(key in O)if(has(O, key)){
val = O[key];
res = f(val, key, object);
if(type){
if(isMap)result[key] = res; // map
else if(res)switch(type){
case 2: result[key] = val; break // filter
case 3: return true; // some
case 5: return val; // find
case 6: return key; // findKey
case 7: result[res[0]] = res[1]; // mapPairs
} else if(isEvery)return false; // every
}
}
return type == 3 || isEvery ? isEvery : result;
}
}
function createDictReduce(isTurn){
return function(object, mapfn, init){
assertFunction(mapfn);
var O = toObject(object)
, keys = getKeys(O)
, length = keys.length
, i = 0
, memo, key, result;
if(isTurn)memo = init == undefined ? new (generic(this, Dict)) : Object(init);
else if(arguments.length < 3){
assert(length, REDUCE_ERROR);
memo = O[keys[i++]];
} else memo = Object(init);
while(length > i)if(has(O, key = keys[i++])){
result = mapfn(memo, O[key], key, object);
if(isTurn){
if(result === false)break;
} else memo = result;
}
return memo;
}
}
var findKey = createDictMethod(6);
function includes(object, el){
return (el == el ? keyOf(object, el) : findKey(object, sameNaN)) !== undefined;
}
var dictMethods = {
keys: createDictIter(KEY),
values: createDictIter(VALUE),
entries: createDictIter(KEY+VALUE),
forEach: createDictMethod(0),
map: createDictMethod(1),
filter: createDictMethod(2),
some: createDictMethod(3),
every: createDictMethod(4),
find: createDictMethod(5),
findKey: findKey,
mapPairs:createDictMethod(7),
reduce: createDictReduce(false),
turn: createDictReduce(true),
keyOf: keyOf,
includes:includes,
// Has / get / set own property
has: has,
get: get,
set: createDefiner(0),
isDict: function(it){
return isObject(it) && getPrototypeOf(it) === Dict[PROTOTYPE];
}
};
if(REFERENCE_GET)for(var key in dictMethods)!function(fn){
function method(){
for(var args = [this], i = 0; i < arguments.length;)args.push(arguments[i++]);
return invoke(fn, args);
}
fn[REFERENCE_GET] = function(){
return method;
}
}(dictMethods[key]);
$define(GLOBAL + FORCED, {Dict: assignHidden(Dict, dictMethods)});
}('Dict');
/******************************************************************************
* Module : core.$for *
******************************************************************************/
!function(ENTRIES, FN){
function $for(iterable, entries){
if(!(this instanceof $for))return new $for(iterable, entries);
this[ITER] = getIterator(iterable);
this[ENTRIES] = !!entries;
}
createIterator($for, 'Wrapper', function(){
return this[ITER].next();
});
var $forProto = $for[PROTOTYPE];
setIterator($forProto, function(){
return this[ITER]; // unwrap
});
function createChainIterator(next){
function Iter(I, fn, that){
this[ITER] = getIterator(I);
this[ENTRIES] = I[ENTRIES];
this[FN] = ctx(fn, that, I[ENTRIES] ? 2 : 1);
}
createIterator(Iter, 'Chain', next, $forProto);
setIterator(Iter[PROTOTYPE], returnThis); // override $forProto iterator
return Iter;
}
var MapIter = createChainIterator(function(){
var step = this[ITER].next();
return step.done ? step : iterResult(0, stepCall(this[FN], step.value, this[ENTRIES]));
});
var FilterIter = createChainIterator(function(){
for(;;){
var step = this[ITER].next();
if(step.done || stepCall(this[FN], step.value, this[ENTRIES]))return step;
}
});
assignHidden($forProto, {
of: function(fn, that){
forOf(this, this[ENTRIES], fn, that);
},
array: function(fn, that){
var result = [];
forOf(fn != undefined ? this.map(fn, that) : this, false, push, result);
return result;
},
filter: function(fn, that){
return new FilterIter(this, fn, that);
},
map: function(fn, that){
return new MapIter(this, fn, that);
}
});
$for.isIterable = isIterable;
$for.getIterator = getIterator;
$define(GLOBAL + FORCED, {$for: $for});
}('entries', safeSymbol('fn'));
/******************************************************************************
* Module : core.delay *
******************************************************************************/
// https://esdiscuss.org/topic/promise-returning-delay-function
$define(GLOBAL + FORCED, {
delay: function(time){
return new Promise(function(resolve){
setTimeout(resolve, time, true);
});
}
});
/******************************************************************************
* Module : core.binding *
******************************************************************************/
!function(_, toLocaleString){
// Placeholder
core._ = path._ = path._ || {};
$define(PROTO + FORCED, FUNCTION, {
part: part,
only: function(numberArguments, that /* = @ */){
var fn = assertFunction(this)
, n = toLength(numberArguments)
, isThat = arguments.length > 1;
return function(/* ...args */){
var length = min(n, arguments.length)
, args = Array(length)
, i = 0;
while(length > i)args[i] = arguments[i++];
return invoke(fn, args, isThat ? that : this);
}
}
});
function tie(key){
var that = this
, bound = {};
return hidden(that, _, function(key){
if(key === undefined || !(key in that))return toLocaleString.call(that);
return has(bound, key) ? bound[key] : (bound[key] = ctx(that[key], that, -1));
})[_](key);
}
hidden(path._, TO_STRING, function(){
return _;
});
hidden(ObjectProto, _, tie);
DESC || hidden(ArrayProto, _, tie);
// IE8- dirty hack - redefined toLocaleString is not enumerable
}(DESC ? uid('tie') : TO_LOCALE, ObjectProto[TO_LOCALE]);
/******************************************************************************
* Module : core.object *
******************************************************************************/
!function(){
function define(target, mixin){
var keys = ownKeys(toObject(mixin))
, length = keys.length
, i = 0, key;
while(length > i)defineProperty(target, key = keys[i++], getOwnDescriptor(mixin, key));
return target;
};
$define(STATIC + FORCED, OBJECT, {
isObject: isObject,
classof: classof,
define: define,
make: function(proto, mixin){
return define(create(proto), mixin);
}
});
}();
/******************************************************************************
* Module : core.array *
******************************************************************************/
$define(PROTO + FORCED, ARRAY, {
turn: function(fn, target /* = [] */){
assertFunction(fn);
var memo = target == undefined ? [] : Object(target)
, O = ES5Object(this)
, length = toLength(O.length)
, index = 0;
while(length > index)if(fn(memo, O[index], index++, this) === false)break;
return memo;
}
});
if(framework)ArrayUnscopables.turn = true;
/******************************************************************************
* Module : core.number *
******************************************************************************/
!function(numberMethods){
function NumberIterator(iterated){
set(this, ITER, {l: toLength(iterated), i: 0});
}
createIterator(NumberIterator, NUMBER, function(){
var iter = this[ITER]
, i = iter.i++;
return i < iter.l ? iterResult(0, i) : iterResult(1);
});
defineIterator(Number, NUMBER, function(){
return new NumberIterator(this);
});
numberMethods.random = function(lim /* = 0 */){
var a = +this
, b = lim == undefined ? 0 : +lim
, m = min(a, b);
return random() * (max(a, b) - m) + m;
};
forEach.call(array(
// ES3:
'round,floor,ceil,abs,sin,asin,cos,acos,tan,atan,exp,sqrt,max,min,pow,atan2,' +
// ES6:
'acosh,asinh,atanh,cbrt,clz32,cosh,expm1,hypot,imul,log1p,log10,log2,sign,sinh,tanh,trunc'
), function(key){
var fn = Math[key];
if(fn)numberMethods[key] = function(/* ...args */){
// ie9- dont support strict mode & convert `this` to object -> convert it to number
var args = [+this]
, i = 0;
while(arguments.length > i)args.push(arguments[i++]);
return invoke(fn, args);
}
}
);
$define(PROTO + FORCED, NUMBER, numberMethods);
}({});
/******************************************************************************
* Module : core.string *
******************************************************************************/
!function(){
var escapeHTMLDict = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": '''
}, unescapeHTMLDict = {}, key;
for(key in escapeHTMLDict)unescapeHTMLDict[escapeHTMLDict[key]] = key;
$define(PROTO + FORCED, STRING, {
escapeHTML: createReplacer(/[&<>"']/g, escapeHTMLDict),
unescapeHTML: createReplacer(/&(?:amp|lt|gt|quot|apos);/g, unescapeHTMLDict)
});
}();
/******************************************************************************
* Module : core.date *
******************************************************************************/
!function(formatRegExp, flexioRegExp, locales, current, SECONDS, MINUTES, HOURS, MONTH, YEAR){
function createFormat(prefix){
return function(template, locale /* = current */){
var that = this
, dict = locales[has(locales, locale) ? locale : current];
function get(unit){
return that[prefix + unit]();
}
return String(template).replace(formatRegExp, function(part){
switch(part){
case 's' : return get(SECONDS); // Seconds : 0-59
case 'ss' : return lz(get(SECONDS)); // Seconds : 00-59
case 'm' : return get(MINUTES); // Minutes : 0-59
case 'mm' : return lz(get(MINUTES)); // Minutes : 00-59
case 'h' : return get(HOURS); // Hours : 0-23
case 'hh' : return lz(get(HOURS)); // Hours : 00-23
case 'D' : return get(DATE); // Date : 1-31
case 'DD' : return lz(get(DATE)); // Date : 01-31
case 'W' : return dict[0][get('Day')]; // Day : Понедельник
case 'N' : return get(MONTH) + 1; // Month : 1-12
case 'NN' : return lz(get(MONTH) + 1); // Month : 01-12
case 'M' : return dict[2][get(MONTH)]; // Month : Январь
case 'MM' : return dict[1][get(MONTH)]; // Month : Января
case 'Y' : return get(YEAR); // Year : 2014
case 'YY' : return lz(get(YEAR) % 100); // Year : 14
} return part;
});
}
}
function addLocale(lang, locale){
function split(index){
var result = [];
forEach.call(array(locale.months), function(it){
result.push(it.replace(flexioRegExp, '$' + index));
});
return result;
}
locales[lang] = [array(locale.weekdays), split(1), split(2)];
return core;
}
$define(PROTO + FORCED, DATE, {
format: createFormat('get'),
formatUTC: createFormat('getUTC')
});
addLocale(current, {
weekdays: 'Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday',
months: 'January,February,March,April,May,June,July,August,September,October,November,December'
});
addLocale('ru', {
weekdays: 'Воскресенье,Понедельник,Вторник,Среда,Четверг,Пятница,Суббота',
months: 'Январ:я|ь,Феврал:я|ь,Март:а|,Апрел:я|ь,Ма:я|й,Июн:я|ь,' +
'Июл:я|ь,Август:а|,Сентябр:я|ь,Октябр:я|ь,Ноябр:я|ь,Декабр:я|ь'
});
core.locale = function(locale){
return has(locales, locale) ? current = locale : current;
};
core.addLocale = addLocale;
}(/\b\w\w?\b/g, /:(.*)\|(.*)$/, {}, 'en', 'Seconds', 'Minutes', 'Hours', 'Month', 'FullYear');
/******************************************************************************
* Module : core.global *
******************************************************************************/
$define(GLOBAL + FORCED, {global: global});
/******************************************************************************
* Module : js.array.statics *
******************************************************************************/
// JavaScript 1.6 / Strawman array statics shim
!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);
}({});
/******************************************************************************
* Module : web.dom.itarable *
******************************************************************************/
!function(NodeList){
if(framework && NodeList && !(SYMBOL_ITERATOR in NodeList[PROTOTYPE])){
hidden(NodeList[PROTOTYPE], SYMBOL_ITERATOR, Iterators[ARRAY]);
}
Iterators.NodeList = Iterators[ARRAY];
}(global.NodeList);
/******************************************************************************
* Module : core.log *
******************************************************************************/
!function(log, enabled){
// Methods from https://github.com/DeveloperToolsWG/console-object/blob/master/api.md
forEach.call(array('assert,clear,count,debug,dir,dirxml,error,exception,' +
'group,groupCollapsed,groupEnd,info,isIndependentlyComposed,log,' +
'markTimeline,profile,profileEnd,table,time,timeEnd,timeline,' +
'timelineEnd,timeStamp,trace,warn'), function(key){
log[key] = function(){
if(enabled && key in console)return apply.call(console[key], console, arguments);
};
});
$define(GLOBAL + FORCED, {log: assign(log.log, log, {
enable: function(){
enabled = true;
},
disable: function(){
enabled = false;
}
})});
}({}, true);
}(typeof self != 'undefined' && self.Math === Math ? self : Function('return this')(), false);
module.exports = { "default": module.exports, __esModule: true };
/***/ },
/* 37 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
exports["default"] = function (obj) {
return obj && obj.__esModule ? obj : {
"default": obj
};
};
exports.__esModule = true;
/***/ },
/* 38 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _defaults = __webpack_require__(35)["default"];
var _interopRequireWildcard = __webpack_require__(37)["default"];
Object.defineProperty(exports, "__esModule", {
value: true
});
_defaults(exports, _interopRequireWildcard(__webpack_require__(53)));
_defaults(exports, _interopRequireWildcard(__webpack_require__(54)));
_defaults(exports, _interopRequireWildcard(__webpack_require__(40)));
_defaults(exports, _interopRequireWildcard(__webpack_require__(59)));
_defaults(exports, _interopRequireWildcard(__webpack_require__(60)));
_defaults(exports, _interopRequireWildcard(__webpack_require__(61)));
_defaults(exports, _interopRequireWildcard(__webpack_require__(62)));
_defaults(exports, _interopRequireWildcard(__webpack_require__(63)));
_defaults(exports, _interopRequireWildcard(__webpack_require__(39)));
_defaults(exports, _interopRequireWildcard(__webpack_require__(64)));
_defaults(exports, _interopRequireWildcard(__webpack_require__(65)));
_defaults(exports, _interopRequireWildcard(__webpack_require__(66)));
_defaults(exports, _interopRequireWildcard(__webpack_require__(67)));
_defaults(exports, _interopRequireWildcard(__webpack_require__(68)));
_defaults(exports, _interopRequireWildcard(__webpack_require__(69)));
_defaults(exports, _interopRequireWildcard(__webpack_require__(70)));
_defaults(exports, _interopRequireWildcard(__webpack_require__(71)));
_defaults(exports, _interopRequireWildcard(__webpack_require__(73)));
/***/ },
/* 39 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(Buffer) {"use strict";
var _classCallCheck = __webpack_require__(44)["default"];
var _createClass = __webpack_require__(46)["default"];
var _interopRequire = __webpack_require__(41)["default"];
Object.defineProperty(exports, "__esModule", {
value: true
});
var Int = __webpack_require__(53).Int;
var UnsignedInt = __webpack_require__(40).UnsignedInt;
var calculatePadding = __webpack_require__(52).calculatePadding;
var isString = __webpack_require__(14).isString;
var includeIoMixin = _interopRequire(__webpack_require__(42));
var String = exports.String = (function () {
function String() {
var maxLength = arguments[0] === undefined ? UnsignedInt.MAX_VALUE : arguments[0];
_classCallCheck(this, String);
this._maxLength = maxLength;
}
_createClass(String, {
read: {
value: function read(io) {
var length = Int.read(io);
if (length > this._maxLength) {
throw new Error("XDR Read Error: Saw " + length + " length String," + ("max allowed is " + this._maxLength));
}
var padding = calculatePadding(length);
var result = io.slice(length);
io.slice(padding); //consume padding
return result.buffer().toString("ascii");
}
},
write: {
value: function write(value, io) {
if (value.length > this._maxLength) {
throw new Error("XDR Write Error: Got " + value.length + " bytes," + ("max allows is " + this._maxLength));
}
if (!isString(value)) {
throw new Error("XDR Write Error: " + value + " is not a string,");
}
var buffer = new Buffer(value, "ascii");
Int.write(value.length, io);
io.writeBufferPadded(buffer);
}
},
isValid: {
value: function isValid(value) {
return isString(value) && value.length <= this._maxLength;
}
}
});
return String;
})();
includeIoMixin(String.prototype);
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(9).Buffer))
/***/ },
/* 40 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = __webpack_require__(41)["default"];
Object.defineProperty(exports, "__esModule", {
value: true
});
var isNumber = __webpack_require__(14).isNumber;
var includeIoMixin = _interopRequire(__webpack_require__(42));
var UnsignedInt = {
read: function read(io) {
return io.readUInt32BE();
},
write: function write(value, io) {
if (!isNumber(value)) {
throw new Error("XDR Write Error: not a number");
}
if (Math.floor(value) !== value) {
throw new Error("XDR Write Error: not an integer");
}
if (value < 0) {
throw new Error("XDR Write Error: negative number " + value);
}
io.writeUInt32BE(value);
},
isValid: function isValid(value) {
if (!isNumber(value)) {
return false;
}
if (Math.floor(value) !== value) {
return false;
}
return value >= UnsignedInt.MIN_VALUE && value <= UnsignedInt.MAX_VALUE;
} };
exports.UnsignedInt = UnsignedInt;
UnsignedInt.MAX_VALUE = Math.pow(2, 32) - 1;
UnsignedInt.MIN_VALUE = 0;
includeIoMixin(UnsignedInt);
/***/ },
/* 41 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
exports["default"] = function (obj) {
return obj && obj.__esModule ? obj["default"] : obj;
};
exports.__esModule = true;
/***/ },
/* 42 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
module.exports = includeIoMixin;
var Cursor = __webpack_require__(43).Cursor;
var _lodash = __webpack_require__(14);
var extend = _lodash.extend;
var isFunction = _lodash.isFunction;
//TODO: build a system to grow a buffer as we write to it
var BUFFER_SIZE = Math.pow(2, 16);
var staticMethods = {
toXDR: function toXDR(val) {
var cursor = new Cursor(BUFFER_SIZE);
this.write(val, cursor);
var bytesWritten = cursor.tell();
cursor.rewind();
return cursor.slice(bytesWritten).buffer();
},
fromXDR: function fromXDR(buffer) {
var cursor = new Cursor(buffer);
var result = this.read(cursor);
//TODO: error out if the entire buffer isn't consumed
return result;
} };
var instanceMethods = {
toXDR: function toXDR() {
var format = arguments[0] === undefined ? "raw" : arguments[0];
var buffer = this.constructor.toXDR(this);
switch (format) {
case "raw":
return buffer;
case "hex":
return buffer.toString("hex");
case "base64":
return buffer.toString("base64");
default:
throw new Error("Invalid format " + format + ", must be \"raw\", \"hex\", \"base64\"");
}
}
};
function includeIoMixin(obj) {
extend(obj, staticMethods);
if (isFunction(obj)) {
extend(obj.prototype, instanceMethods);
}
}
/***/ },
/* 43 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(Buffer) {"use strict";
var _classCallCheck = __webpack_require__(44)["default"];
var _inherits = __webpack_require__(45)["default"];
var _createClass = __webpack_require__(46)["default"];
var _interopRequire = __webpack_require__(41)["default"];
Object.defineProperty(exports, "__esModule", {
value: true
});
var BaseCursor = _interopRequire(__webpack_require__(47));
var calculatePadding = __webpack_require__(52).calculatePadding;
var Cursor = exports.Cursor = (function (_BaseCursor) {
function Cursor() {
_classCallCheck(this, Cursor);
if (_BaseCursor != null) {
_BaseCursor.apply(this, arguments);
}
}
_inherits(Cursor, _BaseCursor);
_createClass(Cursor, {
writeBufferPadded: {
value: function writeBufferPadded(buffer) {
var padding = calculatePadding(buffer.length);
var paddingBuffer = new Buffer(padding);
paddingBuffer.fill(0);
return this.copyFrom(new Cursor(buffer)).copyFrom(new Cursor(paddingBuffer));
}
}
});
return Cursor;
})(BaseCursor);
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(9).Buffer))
/***/ },
/* 44 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
exports["default"] = function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
exports.__esModule = true;
/***/ },
/* 45 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
exports["default"] = 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;
};
exports.__esModule = true;
/***/ },
/* 46 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
exports["default"] = (function () {
function defineProperties(target, props) {
for (var key in props) {
var prop = props[key];
prop.configurable = true;
if (prop.value) prop.writable = true;
}
Object.defineProperties(target, props);
}
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
})();
exports.__esModule = true;
/***/ },
/* 47 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(Buffer) {var Cursor = function(buffer)
{
if (!(this instanceof Cursor))
{
return new Cursor(buffer);
}
if (!(buffer instanceof Buffer))
{
buffer = new Buffer(buffer);
}
this._setBuffer(buffer);
this.rewind();
};
Cursor.prototype._setBuffer = function(buffer)
{
this._buffer = buffer;
this.length = buffer.length;
};
Cursor.prototype.buffer = function()
{
return this._buffer;
};
Cursor.prototype.tap = function(cb)
{
cb(this);
return this;
};
Cursor.prototype.clone = function(newIndex)
{
var c = new this.constructor(this.buffer());
c.seek(arguments.length === 0 ? this.tell() : newIndex);
return c;
};
Cursor.prototype.tell = function()
{
return this._index;
};
Cursor.prototype.seek = function(op, index)
{
if (arguments.length == 1)
{
index = op;
op = '=';
}
if (op == '+')
{
this._index += index;
}
else if (op == '-')
{
this._index -= index;
}
else
{
this._index = index;
}
return this;
};
Cursor.prototype.rewind = function()
{
return this.seek(0);
};
Cursor.prototype.eof = function()
{
return this.tell() == this.buffer().length;
};
Cursor.prototype.write = function(string, length, encoding)
{
return this.seek('+', this.buffer().write(string, this.tell(), length, encoding));
};
Cursor.prototype.fill = function(value, length)
{
if (arguments.length == 1)
{
length = this.buffer().length - this.tell();
}
this.buffer().fill(value, this.tell(), this.tell() + length);
this.seek('+', length);
return this;
};
Cursor.prototype.slice = function(length)
{
if (arguments.length === 0)
{
length = this.length - this.tell();
}
var c = new this.constructor(this.buffer().slice(this.tell(), this.tell() + length));
this.seek('+', length);
return c;
};
Cursor.prototype.copyFrom = function(source)
{
var buf = source instanceof Buffer ? source: source.buffer();
buf.copy(this.buffer(), this.tell(), 0, buf.length);
this.seek('+', buf.length);
return this;
};
Cursor.prototype.concat = function(list)
{
for (var i in list)
{
if (list[i] instanceof Cursor)
{
list[i] = list[i].buffer();
}
}
list.unshift(this.buffer());
var b = Buffer.concat(list);
this._setBuffer(b);
return this;
};
Cursor.prototype.toString = function(encoding, length)
{
if (arguments.length === 0)
{
encoding = 'utf8';
length = this.buffer().length - this.tell();
}
else if (arguments.length === 1)
{
length = this.buffer().length - this.tell();
}
var val = this.buffer().toString(encoding, this.tell(), this.tell() + length);
this.seek('+', length);
return val;
};
[
[1, ['readInt8', 'readUInt8']],
[2, ['readInt16BE', 'readInt16LE', 'readUInt16BE', 'readUInt16LE']],
[4, ['readInt32BE', 'readInt32LE', 'readUInt32BE', 'readUInt32LE', 'readFloatBE', 'readFloatLE']],
[8, ['readDoubleBE', 'readDoubleLE']]
].forEach(function(arr)
{
arr[1].forEach(function(method)
{
Cursor.prototype[method] = function()
{
var val = this.buffer()[method](this.tell());
this.seek('+', arr[0]);
return val;
};
});
});
[
[1, ['writeInt8', 'writeUInt8']],
[2, ['writeInt16BE', 'writeInt16LE', 'writeUInt16BE', 'writeUInt16LE']],
[4, ['writeInt32BE', 'writeInt32LE', 'writeUInt32BE', 'writeUInt32LE', 'writeFloatBE', 'writeFloatLE']],
[8, ['writeDoubleBE', 'writeDoubleLE']]
].forEach(function(arr)
{
arr[1].forEach(function(method)
{
Cursor.prototype[method] = function(val)
{
val = this.buffer()[method](val, this.tell());
this.seek('+', arr[0]);
return this;
};
});
});
//basic extend functionality to facilitate
//writing your own cursor while still providing
//access to low level r/w functionality
Cursor.extend = function(C, proto)
{
var parent = this;
if (arguments.length === 1)
{
proto = C;
C = null;
}
proto = proto || {};
C = C || function ctor(buffer)
{
if (!(this instanceof C))
{
return new C(buffer);
}
parent.call(this, buffer);
};
__webpack_require__(48).inherits(C, parent);
C.extend = parent.extend;
C.define = parent.define;
for (var i in proto)
{
C.define(i, proto[i]);
}
return C;
};
Cursor.define = function(name, fn)
{
var proto = this.prototype[name];
this.prototype[name] = proto && function()
{
this.__super = proto;
return fn.apply(this, arguments);
} || fn;
};
module.exports = Cursor;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(9).Buffer))
/***/ },
/* 48 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global, 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.
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;
};
// Mark that a method should not be used.
// Returns a modified function which warns once by default.
// If --no-deprecation is set, then it is a no-op.
exports.deprecate = function(fn, msg) {
// Allow for deprecating things in the process of starting up.
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];
};
/**
* Echos the value of a value. Trys to print the value out
* in the best way possible given the different types.
*
* @param {Object} obj The object to print out.
* @param {Object} opts Optional options object that alters the output.
*/
/* legacy: obj, showHidden, depth, colors*/
function inspect(obj, opts) {
// default options
var ctx = {
seen: [],
stylize: stylizeNoColor
};
// legacy...
if (arguments.length >= 3) ctx.depth = arguments[2];
if (arguments.length >= 4) ctx.colors = arguments[3];
if (isBoolean(opts)) {
// legacy...
ctx.showHidden = opts;
} else if (opts) {
// got an "options" object
exports._extend(ctx, opts);
}
// set default options
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;
// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
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]
};
// Don't use 'blue' not visible on cmd.exe
inspect.styles = {
'special': 'cyan',
'number': 'yellow',
'boolean': 'yellow',
'undefined': 'grey',
'null': 'bold',
'string': 'green',
'date': 'magenta',
// "name": intentionally not styling
'regexp': 'red'
};
function stylizeWithColor(str, styleType) {
var style = inspect.styles[styleType];
if (style) {
return '\u001b[' + inspect.colors[style][0] + 'm' + str +
'\u001b[' + 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) {
// Provide a hook for user-specified inspect functions.
// Check that value is an object with an inspect function on it
if (ctx.customInspect &&
value &&
isFunction(value.inspect) &&
// Filter out the util module, it's inspect function is special
value.inspect !== exports.inspect &&
// Also filter out any prototype objects using the circular check.
!(value.constructor && value.constructor.prototype === value)) {
var ret = value.inspect(recurseTimes, ctx);
if (!isString(ret)) {
ret = formatValue(ctx, ret, recurseTimes);
}
return ret;
}
// Primitive types cannot have properties
var primitive = formatPrimitive(ctx, value);
if (primitive) {
return primitive;
}
// Look up the keys of the object.
var keys = Object.keys(value);
var visibleKeys = arrayToHash(keys);
if (ctx.showHidden) {
keys = Object.getOwnPropertyNames(value);
}
// IE doesn't make error fields non-enumerable
// http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
if (isError(value)
&& (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
return formatError(value);
}
// Some type of object without properties can be shortcutted.
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 = ['{', '}'];
// Make Array say that they are Array
if (isArray(value)) {
array = true;
braces = ['[', ']'];
}
// Make functions say that they are functions
if (isFunction(value)) {
var n = value.name ? ': ' + value.name : '';
base = ' [Function' + n + ']';
}
// Make RegExps say that they are RegExps
if (isRegExp(value)) {
base = ' ' + RegExp.prototype.toString.call(value);
}
// Make dates with properties first say the date
if (isDate(value)) {
base = ' ' + Date.prototype.toUTCString.call(value);
}
// Make error with message first say the error
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');
// For some reason typeof null is "object", so special case here.
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];
}
// NOTE: These type checking functions intentionally don't use `instanceof`
// because it is fragile and can be easily faked with `Object.create()`.
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' || // ES6 symbol
typeof arg === 'undefined';
}
exports.isPrimitive = isPrimitive;
exports.isBuffer = __webpack_require__(50);
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'];
// 26 Feb 16:19:34
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(' ');
}
// log is just a thin wrapper to console.log that prepends a timestamp
exports.log = function() {
console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
};
/**
* Inherit the prototype methods from one constructor into another.
*
* The Function.prototype.inherits from lang.js rewritten as a standalone
* function (not on Function.prototype). NOTE: If this file is to be loaded
* during bootstrapping this function needs to be rewritten using some native
* functions as prototype setup using normal JavaScript does not work as
* expected during bootstrapping (see mirror.js in r114903).
*
* @param {function} ctor Constructor function which needs to inherit the
* prototype.
* @param {function} superCtor Constructor function to inherit prototype from.
*/
exports.inherits = __webpack_require__(51);
exports._extend = function(origin, add) {
// Don't do anything if add isn't an object
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);
}
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()), __webpack_require__(49)))
/***/ },
/* 49 */
/***/ function(module, exports, __webpack_require__) {
// shim for using process in browser
var process = module.exports = {};
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}
function drainQueue() {
if (draining) {
return;
}
var timeout = setTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
while (++queueIndex < len) {
currentQueue[queueIndex].run();
}
queueIndex = -1;
len = queue.length;
}
currentQueue = null;
draining = false;
clearTimeout(timeout);
}
process.nextTick = function (fun) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
setTimeout(drainQueue, 0);
}
};
// v8 likes predictible objects
function Item(fun, array) {
this.fun = fun;
this.array = array;
}
Item.prototype.run = function () {
this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.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; };
/***/ },
/* 50 */
/***/ function(module, exports, __webpack_require__) {
module.exports = function isBuffer(arg) {
return arg && typeof arg === 'object'
&& typeof arg.copy === 'function'
&& typeof arg.fill === 'function'
&& typeof arg.readUInt8 === 'function';
}
/***/ },
/* 51 */
/***/ function(module, exports, __webpack_require__) {
if (typeof Object.create === 'function') {
// implementation from standard node.js 'util' module
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 {
// old school shim for old browsers
module.exports = function inherits(ctor, superCtor) {
ctor.super_ = superCtor
var TempCtor = function () {}
TempCtor.prototype = superCtor.prototype
ctor.prototype = new TempCtor()
ctor.prototype.constructor = ctor
}
}
/***/ },
/* 52 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
exports.calculatePadding = calculatePadding;
Object.defineProperty(exports, "__esModule", {
value: true
});
function calculatePadding(length) {
switch (length % 4) {
case 0:
return 0;
case 1:
return 3;
case 2:
return 2;
case 3:
return 1;
}
}
/***/ },
/* 53 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = __webpack_require__(41)["default"];
Object.defineProperty(exports, "__esModule", {
value: true
});
var isNumber = __webpack_require__(14).isNumber;
var includeIoMixin = _interopRequire(__webpack_require__(42));
var Int = {
read: function read(io) {
return io.readInt32BE();
},
write: function write(value, io) {
if (!isNumber(value)) {
throw new Error("XDR Write Error: not a number");
}
if (Math.floor(value) !== value) {
throw new Error("XDR Write Error: not an integer");
}
io.writeInt32BE(value);
},
isValid: function isValid(value) {
if (!isNumber(value)) {
return false;
}
if (Math.floor(value) !== value) {
return false;
}
return value >= Int.MIN_VALUE && value <= Int.MAX_VALUE;
} };
exports.Int = Int;
Int.MAX_VALUE = Math.pow(2, 31) - 1;
Int.MIN_VALUE = -Math.pow(2, 31);
includeIoMixin(Int);
/***/ },
/* 54 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _classCallCheck = __webpack_require__(44)["default"];
var _inherits = __webpack_require__(45)["default"];
var _get = __webpack_require__(55)["default"];
var _createClass = __webpack_require__(46)["default"];
var _core = __webpack_require__(36)["default"];
var _interopRequire = __webpack_require__(41)["default"];
Object.defineProperty(exports, "__esModule", {
value: true
});
var Long = _interopRequire(__webpack_require__(56));
var includeIoMixin = _interopRequire(__webpack_require__(42));
var Hyper = exports.Hyper = (function (_Long) {
function Hyper(low, high) {
_classCallCheck(this, Hyper);
_get(_core.Object.getPrototypeOf(Hyper.prototype), "constructor", this).call(this, low, high, false);
}
_inherits(Hyper, _Long);
_createClass(Hyper, null, {
read: {
value: function read(io) {
var high = io.readInt32BE();
var low = io.readInt32BE();
return this.fromBits(low, high);
}
},
write: {
value: function write(value, io) {
if (!(value instanceof this)) {
throw new Error("XDR Write Error: " + value + " is not a Hyper");
}
io.writeInt32BE(value.high);
io.writeInt32BE(value.low);
}
},
fromString: {
value: function fromString(string) {
var result = _get(_core.Object.getPrototypeOf(Hyper), "fromString", this).call(this, string, false);
return new this(result.low, result.high);
}
},
fromBits: {
value: function fromBits(low, high) {
var result = _get(_core.Object.getPrototypeOf(Hyper), "fromBits", this).call(this, low, high, false);
return new this(result.low, result.high);
}
},
isValid: {
value: function isValid(value) {
return value instanceof this;
}
}
});
return Hyper;
})(Long);
includeIoMixin(Hyper);
Hyper.MAX_VALUE = new Hyper(Long.MAX_VALUE.low, Long.MAX_VALUE.high);
Hyper.MIN_VALUE = new Hyper(Long.MIN_VALUE.low, Long.MIN_VALUE.high);
/***/ },
/* 55 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _core = __webpack_require__(36)["default"];
exports["default"] = function get(_x, _x2, _x3) {
var _again = true;
_function: while (_again) {
_again = false;
var object = _x,
property = _x2,
receiver = _x3;
desc = parent = getter = undefined;
var desc = _core.Object.getOwnPropertyDescriptor(object, property);
if (desc === undefined) {
var parent = _core.Object.getPrototypeOf(object);
if (parent === null) {
return undefined;
} else {
_x = parent;
_x2 = property;
_x3 = receiver;
_again = true;
continue _function;
}
} else if ("value" in desc && desc.writable) {
return desc.value;
} else {
var getter = desc.get;
if (getter === undefined) {
return undefined;
}
return getter.call(receiver);
}
}
};
exports.__esModule = true;
/***/ },
/* 56 */
/***/ function(module, exports, __webpack_require__) {
/*
Copyright 2013 Daniel Wirtz <dcode@dcode.io>
Copyright 2009 The Closure Library Authors. All Rights Reserved.
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.
*/
module.exports = __webpack_require__(57);
/***/ },
/* 57 */
/***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(module) {/*
Copyright 2013 Daniel Wirtz <dcode@dcode.io>
Copyright 2009 The Closure Library Authors. All Rights Reserved.
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.
*/
/**
* @license Long.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
* Released under the Apache License, Version 2.0
* see: https://github.com/dcodeIO/Long.js for details
*/
(function(global) {
"use strict";
/**
* Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.
* See the from* functions below for more convenient ways of constructing Longs.
* @exports Long
* @class A Long class for representing a 64 bit two's-complement integer value.
* @param {number} low The low (signed) 32 bits of the long
* @param {number} high The high (signed) 32 bits of the long
* @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
* @constructor
*/
var Long = function(low, high, unsigned) {
/**
* The low 32 bits as a signed value.
* @type {number}
* @expose
*/
this.low = low|0;
/**
* The high 32 bits as a signed value.
* @type {number}
* @expose
*/
this.high = high|0;
/**
* Whether unsigned or not.
* @type {boolean}
* @expose
*/
this.unsigned = !!unsigned;
};
// The internal representation of a long is the two given signed, 32-bit values.
// We use 32-bit pieces because these are the size of integers on which
// Javascript performs bit-operations. For operations like addition and
// multiplication, we split each number into 16 bit pieces, which can easily be
// multiplied within Javascript's floating-point representation without overflow
// or change in sign.
//
// In the algorithms below, we frequently reduce the negative case to the
// positive case by negating the input(s) and then post-processing the result.
// Note that we must ALWAYS check specially whether those values are MIN_VALUE
// (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as
// a positive number, it overflows back into a negative). Not handling this
// case would often result in infinite recursion.
//
// Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*
// methods on which they depend.
/**
* Tests if the specified object is a Long.
* @param {*} obj Object
* @returns {boolean}
* @expose
*/
Long.isLong = function(obj) {
return (obj && obj instanceof Long) === true;
};
/**
* A cache of the Long representations of small integer values.
* @type {!Object}
* @inner
*/
var INT_CACHE = {};
/**
* A cache of the Long representations of small unsigned integer values.
* @type {!Object}
* @inner
*/
var UINT_CACHE = {};
/**
* Returns a Long representing the given 32 bit integer value.
* @param {number} value The 32 bit integer in question
* @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
* @returns {!Long} The corresponding Long value
* @expose
*/
Long.fromInt = function(value, unsigned) {
var obj, cachedObj;
if (!unsigned) {
value = value | 0;
if (-128 <= value && value < 128) {
cachedObj = INT_CACHE[value];
if (cachedObj)
return cachedObj;
}
obj = new Long(value, value < 0 ? -1 : 0, false);
if (-128 <= value && value < 128)
INT_CACHE[value] = obj;
return obj;
} else {
value = value >>> 0;
if (0 <= value && value < 256) {
cachedObj = UINT_CACHE[value];
if (cachedObj)
return cachedObj;
}
obj = new Long(value, (value | 0) < 0 ? -1 : 0, true);
if (0 <= value && value < 256)
UINT_CACHE[value] = obj;
return obj;
}
};
/**
* Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
* @param {number} value The number in question
* @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
* @returns {!Long} The corresponding Long value
* @expose
*/
Long.fromNumber = function(value, unsigned) {
unsigned = !!unsigned;
if (isNaN(value) || !isFinite(value))
return Long.ZERO;
if (!unsigned && value <= -TWO_PWR_63_DBL)
return Long.MIN_VALUE;
if (!unsigned && value + 1 >= TWO_PWR_63_DBL)
return Long.MAX_VALUE;
if (unsigned && value >= TWO_PWR_64_DBL)
return Long.MAX_UNSIGNED_VALUE;
if (value < 0)
return Long.fromNumber(-value, unsigned).negate();
return new Long((value % TWO_PWR_32_DBL) | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);
};
/**
* Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is
* assumed to use 32 bits.
* @param {number} lowBits The low 32 bits
* @param {number} highBits The high 32 bits
* @param {boolean=} unsigned Whether unsigned or not, defaults to `false` for signed
* @returns {!Long} The corresponding Long value
* @expose
*/
Long.fromBits = function(lowBits, highBits, unsigned) {
return new Long(lowBits, highBits, unsigned);
};
/**
* Returns a Long representation of the given string, written using the specified radix.
* @param {string} str The textual representation of the Long
* @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to `false` for signed
* @param {number=} radix The radix in which the text is written (2-36), defaults to 10
* @returns {!Long} The corresponding Long value
* @expose
*/
Long.fromString = function(str, unsigned, radix) {
if (str.length === 0)
throw Error('number format error: empty string');
if (str === "NaN" || str === "Infinity" || str === "+Infinity" || str === "-Infinity")
return Long.ZERO;
if (typeof unsigned === 'number') // For goog.math.long compatibility
radix = unsigned,
unsigned = false;
radix = radix || 10;
if (radix < 2 || 36 < radix)
throw Error('radix out of range: ' + radix);
var p;
if ((p = str.indexOf('-')) > 0)
throw Error('number format error: interior "-" character: ' + str);
else if (p === 0)
return Long.fromString(str.substring(1), unsigned, radix).negate();
// Do several (8) digits each time through the loop, so as to
// minimize the calls to the very expensive emulated div.
var radixToPower = Long.fromNumber(Math.pow(radix, 8));
var result = Long.ZERO;
for (var i = 0; i < str.length; i += 8) {
var size = Math.min(8, str.length - i);
var value = parseInt(str.substring(i, i + size), radix);
if (size < 8) {
var power = Long.fromNumber(Math.pow(radix, size));
result = result.multiply(power).add(Long.fromNumber(value));
} else {
result = result.multiply(radixToPower);
result = result.add(Long.fromNumber(value));
}
}
result.unsigned = unsigned;
return result;
};
/**
* Converts the specified value to a Long.
* @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value
* @returns {!Long}
* @expose
*/
Long.fromValue = function(val) {
if (typeof val === 'number')
return Long.fromNumber(val);
if (typeof val === 'string')
return Long.fromString(val);
if (Long.isLong(val))
return val;
// Throws for not an object (undefined, null):
return new Long(val.low, val.high, val.unsigned);
};
// NOTE: the compiler should inline these constant values below and then remove these variables, so there should be
// no runtime penalty for these.
/**
* @type {number}
* @const
* @inner
*/
var TWO_PWR_16_DBL = 1 << 16;
/**
* @type {number}
* @const
* @inner
*/
var TWO_PWR_24_DBL = 1 << 24;
/**
* @type {number}
* @const
* @inner
*/
var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
/**
* @type {number}
* @const
* @inner
*/
var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
/**
* @type {number}
* @const
* @inner
*/
var TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;
/**
* @type {!Long}
* @const
* @inner
*/
var TWO_PWR_24 = Long.fromInt(TWO_PWR_24_DBL);
/**
* Signed zero.
* @type {!Long}
* @expose
*/
Long.ZERO = Long.fromInt(0);
/**
* Unsigned zero.
* @type {!Long}
* @expose
*/
Long.UZERO = Long.fromInt(0, true);
/**
* Signed one.
* @type {!Long}
* @expose
*/
Long.ONE = Long.fromInt(1);
/**
* Unsigned one.
* @type {!Long}
* @expose
*/
Long.UONE = Long.fromInt(1, true);
/**
* Signed negative one.
* @type {!Long}
* @expose
*/
Long.NEG_ONE = Long.fromInt(-1);
/**
* Maximum signed value.
* @type {!Long}
* @expose
*/
Long.MAX_VALUE = Long.fromBits(0xFFFFFFFF|0, 0x7FFFFFFF|0, false);
/**
* Maximum unsigned value.
* @type {!Long}
* @expose
*/
Long.MAX_UNSIGNED_VALUE = Long.fromBits(0xFFFFFFFF|0, 0xFFFFFFFF|0, true);
/**
* Minimum signed value.
* @type {!Long}
* @expose
*/
Long.MIN_VALUE = Long.fromBits(0, 0x80000000|0, false);
/**
* Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
* @returns {number}
* @expose
*/
Long.prototype.toInt = function() {
return this.unsigned ? this.low >>> 0 : this.low;
};
/**
* Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
* @returns {number}
* @expose
*/
Long.prototype.toNumber = function() {
if (this.unsigned) {
return ((this.high >>> 0) * TWO_PWR_32_DBL) + (this.low >>> 0);
}
return this.high * TWO_PWR_32_DBL + (this.low >>> 0);
};
/**
* Converts the Long to a string written in the specified radix.
* @param {number=} radix Radix (2-36), defaults to 10
* @returns {string}
* @override
* @throws {RangeError} If `radix` is out of range
* @expose
*/
Long.prototype.toString = function(radix) {
radix = radix || 10;
if (radix < 2 || 36 < radix)
throw RangeError('radix out of range: ' + radix);
if (this.isZero())
return '0';
var rem;
if (this.isNegative()) { // Unsigned Longs are never negative
if (this.equals(Long.MIN_VALUE)) {
// We need to change the Long value before it can be negated, so we remove
// the bottom-most digit in this base and then recurse to do the rest.
var radixLong = Long.fromNumber(radix);
var div = this.div(radixLong);
rem = div.multiply(radixLong).subtract(this);
return div.toString(radix) + rem.toInt().toString(radix);
} else
return '-' + this.negate().toString(radix);
}
// Do several (6) digits each time through the loop, so as to
// minimize the calls to the very expensive emulated div.
var radixToPower = Long.fromNumber(Math.pow(radix, 6), this.unsigned);
rem = this;
var result = '';
while (true) {
var remDiv = rem.div(radixToPower),
intval = rem.subtract(remDiv.multiply(radixToPower)).toInt() >>> 0,
digits = intval.toString(radix);
rem = remDiv;
if (rem.isZero())
return digits + result;
else {
while (digits.length < 6)
digits = '0' + digits;
result = '' + digits + result;
}
}
};
/**
* Gets the high 32 bits as a signed integer.
* @returns {number} Signed high bits
* @expose
*/
Long.prototype.getHighBits = function() {
return this.high;
};
/**
* Gets the high 32 bits as an unsigned integer.
* @returns {number} Unsigned high bits
* @expose
*/
Long.prototype.getHighBitsUnsigned = function() {
return this.high >>> 0;
};
/**
* Gets the low 32 bits as a signed integer.
* @returns {number} Signed low bits
* @expose
*/
Long.prototype.getLowBits = function() {
return this.low;
};
/**
* Gets the low 32 bits as an unsigned integer.
* @returns {number} Unsigned low bits
* @expose
*/
Long.prototype.getLowBitsUnsigned = function() {
return this.low >>> 0;
};
/**
* Gets the number of bits needed to represent the absolute value of this Long.
* @returns {number}
* @expose
*/
Long.prototype.getNumBitsAbs = function() {
if (this.isNegative()) // Unsigned Longs are never negative
return this.equals(Long.MIN_VALUE) ? 64 : this.negate().getNumBitsAbs();
var val = this.high != 0 ? this.high : this.low;
for (var bit = 31; bit > 0; bit--)
if ((val & (1 << bit)) != 0)
break;
return this.high != 0 ? bit + 33 : bit + 1;
};
/**
* Tests if this Long's value equals zero.
* @returns {boolean}
* @expose
*/
Long.prototype.isZero = function() {
return this.high === 0 && this.low === 0;
};
/**
* Tests if this Long's value is negative.
* @returns {boolean}
* @expose
*/
Long.prototype.isNegative = function() {
return !this.unsigned && this.high < 0;
};
/**
* Tests if this Long's value is positive.
* @returns {boolean}
* @expose
*/
Long.prototype.isPositive = function() {
return this.unsigned || this.high >= 0;
};
/**
* Tests if this Long's value is odd.
* @returns {boolean}
* @expose
*/
Long.prototype.isOdd = function() {
return (this.low & 1) === 1;
};
/**
* Tests if this Long's value is even.
* @returns {boolean}
* @expose
*/
Long.prototype.isEven = function() {
return (this.low & 1) === 0;
};
/**
* Tests if this Long's value equals the specified's.
* @param {!Long|number|string} other Other value
* @returns {boolean}
* @expose
*/
Long.prototype.equals = function(other) {
if (!Long.isLong(other))
other = Long.fromValue(other);
if (this.unsigned !== other.unsigned && (this.high >>> 31) === 1 && (other.high >>> 31) === 1)
return false;
return this.high === other.high && this.low === other.low;
};
/**
* Tests if this Long's value differs from the specified's.
* @param {!Long|number|string} other Other value
* @returns {boolean}
* @expose
*/
Long.prototype.notEquals = function(other) {
if (!Long.isLong(other))
other = Long.fromValue(other);
return !this.equals(other);
};
/**
* Tests if this Long's value is less than the specified's.
* @param {!Long|number|string} other Other value
* @returns {boolean}
* @expose
*/
Long.prototype.lessThan = function(other) {
if (!Long.isLong(other))
other = Long.fromValue(other);
return this.compare(other) < 0;
};
/**
* Tests if this Long's value is less than or equal the specified's.
* @param {!Long|number|string} other Other value
* @returns {boolean}
* @expose
*/
Long.prototype.lessThanOrEqual = function(other) {
if (!Long.isLong(other))
other = Long.fromValue(other);
return this.compare(other) <= 0;
};
/**
* Tests if this Long's value is greater than the specified's.
* @param {!Long|number|string} other Other value
* @returns {boolean}
* @expose
*/
Long.prototype.greaterThan = function(other) {
if (!Long.isLong(other))
other = Long.fromValue(other);
return this.compare(other) > 0;
};
/**
* Tests if this Long's value is greater than or equal the specified's.
* @param {!Long|number|string} other Other value
* @returns {boolean}
* @expose
*/
Long.prototype.greaterThanOrEqual = function(other) {
return this.compare(other) >= 0;
};
/**
* Compares this Long's value with the specified's.
* @param {!Long|number|string} other Other value
* @returns {number} 0 if they are the same, 1 if the this is greater and -1
* if the given one is greater
* @expose
*/
Long.prototype.compare = function(other) {
if (this.equals(other))
return 0;
var thisNeg = this.isNegative(),
otherNeg = other.isNegative();
if (thisNeg && !otherNeg)
return -1;
if (!thisNeg && otherNeg)
return 1;
// At this point the sign bits are the same
if (!this.unsigned)
return this.subtract(other).isNegative() ? -1 : 1;
// Both are positive if at least one is unsigned
return (other.high >>> 0) > (this.high >>> 0) || (other.high === this.high && (other.low >>> 0) > (this.low >>> 0)) ? -1 : 1;
};
/**
* Negates this Long's value.
* @returns {!Long} Negated Long
* @expose
*/
Long.prototype.negate = function() {
if (!this.unsigned && this.equals(Long.MIN_VALUE))
return Long.MIN_VALUE;
return this.not().add(Long.ONE);
};
/**
* Returns the sum of this and the specified Long.
* @param {!Long|number|string} addend Addend
* @returns {!Long} Sum
* @expose
*/
Long.prototype.add = function(addend) {
if (!Long.isLong(addend))
addend = Long.fromValue(addend);
// Divide each number into 4 chunks of 16 bits, and then sum the chunks.
var a48 = this.high >>> 16;
var a32 = this.high & 0xFFFF;
var a16 = this.low >>> 16;
var a00 = this.low & 0xFFFF;
var b48 = addend.high >>> 16;
var b32 = addend.high & 0xFFFF;
var b16 = addend.low >>> 16;
var b00 = addend.low & 0xFFFF;
var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
c00 += a00 + b00;
c16 += c00 >>> 16;
c00 &= 0xFFFF;
c16 += a16 + b16;
c32 += c16 >>> 16;
c16 &= 0xFFFF;
c32 += a32 + b32;
c48 += c32 >>> 16;
c32 &= 0xFFFF;
c48 += a48 + b48;
c48 &= 0xFFFF;
return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
};
/**
* Returns the difference of this and the specified Long.
* @param {!Long|number|string} subtrahend Subtrahend
* @returns {!Long} Difference
* @expose
*/
Long.prototype.subtract = function(subtrahend) {
if (!Long.isLong(subtrahend))
subtrahend = Long.fromValue(subtrahend);
return this.add(subtrahend.negate());
};
/**
* Returns the product of this and the specified Long.
* @param {!Long|number|string} multiplier Multiplier
* @returns {!Long} Product
* @expose
*/
Long.prototype.multiply = function(multiplier) {
if (this.isZero())
return Long.ZERO;
if (!Long.isLong(multiplier))
multiplier = Long.fromValue(multiplier);
if (multiplier.isZero())
return Long.ZERO;
if (this.equals(Long.MIN_VALUE))
return multiplier.isOdd() ? Long.MIN_VALUE : Long.ZERO;
if (multiplier.equals(Long.MIN_VALUE))
return this.isOdd() ? Long.MIN_VALUE : Long.ZERO;
if (this.isNegative()) {
if (multiplier.isNegative())
return this.negate().multiply(multiplier.negate());
else
return this.negate().multiply(multiplier).negate();
} else if (multiplier.isNegative())
return this.multiply(multiplier.negate()).negate();
// If both longs are small, use float multiplication
if (this.lessThan(TWO_PWR_24) && multiplier.lessThan(TWO_PWR_24))
return Long.fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);
// Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.
// We can skip products that would overflow.
var a48 = this.high >>> 16;
var a32 = this.high & 0xFFFF;
var a16 = this.low >>> 16;
var a00 = this.low & 0xFFFF;
var b48 = multiplier.high >>> 16;
var b32 = multiplier.high & 0xFFFF;
var b16 = multiplier.low >>> 16;
var b00 = multiplier.low & 0xFFFF;
var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
c00 += a00 * b00;
c16 += c00 >>> 16;
c00 &= 0xFFFF;
c16 += a16 * b00;
c32 += c16 >>> 16;
c16 &= 0xFFFF;
c16 += a00 * b16;
c32 += c16 >>> 16;
c16 &= 0xFFFF;
c32 += a32 * b00;
c48 += c32 >>> 16;
c32 &= 0xFFFF;
c32 += a16 * b16;
c48 += c32 >>> 16;
c32 &= 0xFFFF;
c32 += a00 * b32;
c48 += c32 >>> 16;
c32 &= 0xFFFF;
c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
c48 &= 0xFFFF;
return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
};
/**
* Returns this Long divided by the specified.
* @param {!Long|number|string} divisor Divisor
* @returns {!Long} Quotient
* @expose
*/
Long.prototype.div = function(divisor) {
if (!Long.isLong(divisor))
divisor = Long.fromValue(divisor);
if (divisor.isZero())
throw(new Error('division by zero'));
if (this.isZero())
return this.unsigned ? Long.UZERO : Long.ZERO;
var approx, rem, res;
if (this.equals(Long.MIN_VALUE)) {
if (divisor.equals(Long.ONE) || divisor.equals(Long.NEG_ONE))
return Long.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE
else if (divisor.equals(Long.MIN_VALUE))
return Long.ONE;
else {
// At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.
var halfThis = this.shiftRight(1);
approx = halfThis.div(divisor).shiftLeft(1);
if (approx.equals(Long.ZERO)) {
return divisor.isNegative() ? Long.ONE : Long.NEG_ONE;
} else {
rem = this.subtract(divisor.multiply(approx));
res = approx.add(rem.div(divisor));
return res;
}
}
} else if (divisor.equals(Long.MIN_VALUE))
return this.unsigned ? Long.UZERO : Long.ZERO;
if (this.isNegative()) {
if (divisor.isNegative())
return this.negate().div(divisor.negate());
return this.negate().div(divisor).negate();
} else if (divisor.isNegative())
return this.div(divisor.negate()).negate();
// Repeat the following until the remainder is less than other: find a
// floating-point that approximates remainder / other *from below*, add this
// into the result, and subtract it from the remainder. It is critical that
// the approximate value is less than or equal to the real value so that the
// remainder never becomes negative.
res = Long.ZERO;
rem = this;
while (rem.greaterThanOrEqual(divisor)) {
// Approximate the result of division. This may be a little greater or
// smaller than the actual value.
approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));
// We will tweak the approximate result by changing it in the 48-th digit or
// the smallest non-fractional digit, whichever is larger.
var log2 = Math.ceil(Math.log(approx) / Math.LN2),
delta = (log2 <= 48) ? 1 : Math.pow(2, log2 - 48),
// Decrease the approximation until it is smaller than the remainder. Note
// that if it is too large, the product overflows and is negative.
approxRes = Long.fromNumber(approx),
approxRem = approxRes.multiply(divisor);
while (approxRem.isNegative() || approxRem.greaterThan(rem)) {
approx -= delta;
approxRes = Long.fromNumber(approx, this.unsigned);
approxRem = approxRes.multiply(divisor);
}
// We know the answer can't be zero... and actually, zero would cause
// infinite recursion since we would make no progress.
if (approxRes.isZero())
approxRes = Long.ONE;
res = res.add(approxRes);
rem = rem.subtract(approxRem);
}
return res;
};
/**
* Returns this Long modulo the specified.
* @param {!Long|number|string} divisor Divisor
* @returns {!Long} Remainder
* @expose
*/
Long.prototype.modulo = function(divisor) {
if (!Long.isLong(divisor))
divisor = Long.fromValue(divisor);
return this.subtract(this.div(divisor).multiply(divisor));
};
/**
* Returns the bitwise NOT of this Long.
* @returns {!Long}
* @expose
*/
Long.prototype.not = function() {
return Long.fromBits(~this.low, ~this.high, this.unsigned);
};
/**
* Returns the bitwise AND of this Long and the specified.
* @param {!Long|number|string} other Other Long
* @returns {!Long}
* @expose
*/
Long.prototype.and = function(other) {
if (!Long.isLong(other))
other = Long.fromValue(other);
return Long.fromBits(this.low & other.low, this.high & other.high, this.unsigned);
};
/**
* Returns the bitwise OR of this Long and the specified.
* @param {!Long|number|string} other Other Long
* @returns {!Long}
* @expose
*/
Long.prototype.or = function(other) {
if (!Long.isLong(other))
other = Long.fromValue(other);
return Long.fromBits(this.low | other.low, this.high | other.high, this.unsigned);
};
/**
* Returns the bitwise XOR of this Long and the given one.
* @param {!Long|number|string} other Other Long
* @returns {!Long}
* @expose
*/
Long.prototype.xor = function(other) {
if (!Long.isLong(other))
other = Long.fromValue(other);
return Long.fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);
};
/**
* Returns this Long with bits shifted to the left by the given amount.
* @param {number|!Long} numBits Number of bits
* @returns {!Long} Shifted Long
* @expose
*/
Long.prototype.shiftLeft = function(numBits) {
if (Long.isLong(numBits))
numBits = numBits.toInt();
if ((numBits &= 63) === 0)
return this;
else if (numBits < 32)
return Long.fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);
else
return Long.fromBits(0, this.low << (numBits - 32), this.unsigned);
};
/**
* Returns this Long with bits arithmetically shifted to the right by the given amount.
* @param {number|!Long} numBits Number of bits
* @returns {!Long} Shifted Long
* @expose
*/
Long.prototype.shiftRight = function(numBits) {
if (Long.isLong(numBits))
numBits = numBits.toInt();
if ((numBits &= 63) === 0)
return this;
else if (numBits < 32)
return Long.fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);
else
return Long.fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);
};
/**
* Returns this Long with bits logically shifted to the right by the given amount.
* @param {number|!Long} numBits Number of bits
* @returns {!Long} Shifted Long
* @expose
*/
Long.prototype.shiftRightUnsigned = function(numBits) {
if (Long.isLong(numBits))
numBits = numBits.toInt();
numBits &= 63;
if (numBits === 0)
return this;
else {
var high = this.high;
if (numBits < 32) {
var low = this.low;
return Long.fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned);
} else if (numBits === 32)
return Long.fromBits(high, 0, this.unsigned);
else
return Long.fromBits(high >>> (numBits - 32), 0, this.unsigned);
}
};
/**
* Converts this Long to signed.
* @returns {!Long} Signed long
* @expose
*/
Long.prototype.toSigned = function() {
if (!this.unsigned)
return this;
return new Long(this.low, this.high, false);
};
/**
* Converts this Long to unsigned.
* @returns {!Long} Unsigned long
* @expose
*/
Long.prototype.toUnsigned = function() {
if (this.unsigned)
return this;
return new Long(this.low, this.high, true);
};
/* CommonJS */ if ("function" === 'function' && typeof module === 'object' && module && typeof exports === 'object' && exports)
module["exports"] = Long;
/* AMD */ else if ("function" === 'function' && __webpack_require__(58)["amd"])
!(__WEBPACK_AMD_DEFINE_RESULT__ = function() { return Long; }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
/* Global */ else
(global["dcodeIO"] = global["dcodeIO"] || {})["Long"] = Long;
})(this);
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(15)(module)))
/***/ },
/* 58 */
/***/ function(module, exports, __webpack_require__) {
module.exports = function() { throw new Error("define cannot be used indirect"); };
/***/ },
/* 59 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _classCallCheck = __webpack_require__(44)["default"];
var _inherits = __webpack_require__(45)["default"];
var _get = __webpack_require__(55)["default"];
var _createClass = __webpack_require__(46)["default"];
var _core = __webpack_require__(36)["default"];
var _interopRequire = __webpack_require__(41)["default"];
Object.defineProperty(exports, "__esModule", {
value: true
});
var Long = _interopRequire(__webpack_require__(56));
var includeIoMixin = _interopRequire(__webpack_require__(42));
var UnsignedHyper = exports.UnsignedHyper = (function (_Long) {
function UnsignedHyper(low, high) {
_classCallCheck(this, UnsignedHyper);
_get(_core.Object.getPrototypeOf(UnsignedHyper.prototype), "constructor", this).call(this, low, high, true);
}
_inherits(UnsignedHyper, _Long);
_createClass(UnsignedHyper, null, {
read: {
value: function read(io) {
var high = io.readInt32BE();
var low = io.readInt32BE();
return this.fromBits(low, high);
}
},
write: {
value: function write(value, io) {
if (!(value instanceof this)) {
throw new Error("XDR Write Error: " + value + " is not an UnsignedHyper");
}
io.writeInt32BE(value.high);
io.writeInt32BE(value.low);
}
},
fromString: {
value: function fromString(string) {
var result = _get(_core.Object.getPrototypeOf(UnsignedHyper), "fromString", this).call(this, string, true);
return new this(result.low, result.high);
}
},
fromBits: {
value: function fromBits(low, high) {
var result = _get(_core.Object.getPrototypeOf(UnsignedHyper), "fromBits", this).call(this, low, high, true);
return new this(result.low, result.high);
}
},
isValid: {
value: function isValid(value) {
return value instanceof this;
}
}
});
return UnsignedHyper;
})(Long);
includeIoMixin(UnsignedHyper);
UnsignedHyper.MAX_VALUE = new UnsignedHyper(Long.MAX_UNSIGNED_VALUE.low, Long.MAX_UNSIGNED_VALUE.high);
UnsignedHyper.MIN_VALUE = new UnsignedHyper(Long.MIN_VALUE.low, Long.MIN_VALUE.high);
/***/ },
/* 60 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = __webpack_require__(41)["default"];
Object.defineProperty(exports, "__esModule", {
value: true
});
var isNumber = __webpack_require__(14).isNumber;
var includeIoMixin = _interopRequire(__webpack_require__(42));
var Float = {
read: function read(io) {
return io.readFloatBE();
},
write: function write(value, io) {
if (!isNumber(value)) {
throw new Error("XDR Write Error: not a number");
}
io.writeFloatBE(value);
},
isValid: function isValid(value) {
return isNumber(value);
} };
exports.Float = Float;
includeIoMixin(Float);
/***/ },
/* 61 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = __webpack_require__(41)["default"];
Object.defineProperty(exports, "__esModule", {
value: true
});
var isNumber = __webpack_require__(14).isNumber;
var includeIoMixin = _interopRequire(__webpack_require__(42));
var Double = {
read: function read(io) {
return io.readDoubleBE();
},
write: function write(value, io) {
if (!isNumber(value)) {
throw new Error("XDR Write Error: not a number");
}
io.writeDoubleBE(value);
},
isValid: function isValid(value) {
return isNumber(value);
} };
exports.Double = Double;
includeIoMixin(Double);
/***/ },
/* 62 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = __webpack_require__(41)["default"];
Object.defineProperty(exports, "__esModule", {
value: true
});
var includeIoMixin = _interopRequire(__webpack_require__(42));
var Quadruple = {
/* jshint unused: false */
read: function read(io) {
throw new Error("XDR Read Error: quadruple not supported");
},
write: function write(value, io) {
throw new Error("XDR Write Error: quadruple not supported");
},
isValid: function isValid(value) {
return false;
} };
exports.Quadruple = Quadruple;
includeIoMixin(Quadruple);
/***/ },
/* 63 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = __webpack_require__(41)["default"];
Object.defineProperty(exports, "__esModule", {
value: true
});
var Int = __webpack_require__(53).Int;
var isBoolean = __webpack_require__(14).isBoolean;
var includeIoMixin = _interopRequire(__webpack_require__(42));
var Bool = {
read: function read(io) {
var value = Int.read(io);
switch (value) {
case 0:
return false;
case 1:
return true;
default:
throw new Error("XDR Read Error: Got " + value + " when trying to read a bool");
}
},
write: function write(value, io) {
var intVal = value ? 1 : 0;
return Int.write(intVal, io);
},
isValid: function isValid(value) {
return isBoolean(value);
}
};
exports.Bool = Bool;
includeIoMixin(Bool);
/***/ },
/* 64 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(Buffer) {"use strict";
var _classCallCheck = __webpack_require__(44)["default"];
var _createClass = __webpack_require__(46)["default"];
var _interopRequire = __webpack_require__(41)["default"];
Object.defineProperty(exports, "__esModule", {
value: true
});
var calculatePadding = __webpack_require__(52).calculatePadding;
var includeIoMixin = _interopRequire(__webpack_require__(42));
var Opaque = exports.Opaque = (function () {
function Opaque(length) {
_classCallCheck(this, Opaque);
this._length = length;
this._padding = calculatePadding(length);
}
_createClass(Opaque, {
read: {
value: function read(io) {
var result = io.slice(this._length);
io.slice(this._padding); //consume padding
return result.buffer();
}
},
write: {
value: function write(value, io) {
if (value.length !== this._length) {
throw new Error("XDR Write Error: Got " + value.length + " bytes, expected " + this._length);
}
io.writeBufferPadded(value);
}
},
isValid: {
value: function isValid(value) {
return Buffer.isBuffer(value) && value.length === this._length;
}
}
});
return Opaque;
})();
includeIoMixin(Opaque.prototype);
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(9).Buffer))
/***/ },
/* 65 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(Buffer) {"use strict";
var _classCallCheck = __webpack_require__(44)["default"];
var _createClass = __webpack_require__(46)["default"];
var _interopRequire = __webpack_require__(41)["default"];
Object.defineProperty(exports, "__esModule", {
value: true
});
var Int = __webpack_require__(53).Int;
var UnsignedInt = __webpack_require__(40).UnsignedInt;
var calculatePadding = __webpack_require__(52).calculatePadding;
var includeIoMixin = _interopRequire(__webpack_require__(42));
var VarOpaque = exports.VarOpaque = (function () {
function VarOpaque() {
var maxLength = arguments[0] === undefined ? UnsignedInt.MAX_VALUE : arguments[0];
_classCallCheck(this, VarOpaque);
this._maxLength = maxLength;
}
_createClass(VarOpaque, {
read: {
value: function read(io) {
var length = Int.read(io);
if (length > this._maxLength) {
throw new Error("XDR Read Error: Saw " + length + " length VarOpaque," + ("max allowed is " + this._maxLength));
}
var padding = calculatePadding(length);
var result = io.slice(length);
io.slice(padding); //consume padding
return result.buffer();
}
},
write: {
value: function write(value, io) {
if (value.length > this._maxLength) {
throw new Error("XDR Write Error: Got " + value.length + " bytes," + ("max allows is " + this._maxLength));
}
Int.write(value.length, io);
io.writeBufferPadded(value);
}
},
isValid: {
value: function isValid(value) {
return Buffer.isBuffer(value) && value.length <= this._maxLength;
}
}
});
return VarOpaque;
})();
includeIoMixin(VarOpaque.prototype);
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(9).Buffer))
/***/ },
/* 66 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _classCallCheck = __webpack_require__(44)["default"];
var _createClass = __webpack_require__(46)["default"];
var _interopRequire = __webpack_require__(41)["default"];
Object.defineProperty(exports, "__esModule", {
value: true
});
var _lodash = __webpack_require__(14);
var all = _lodash.all;
var each = _lodash.each;
var times = _lodash.times;
var isArray = _lodash.isArray;
var includeIoMixin = _interopRequire(__webpack_require__(42));
var Array = exports.Array = (function () {
function Array(childType, length) {
_classCallCheck(this, Array);
this._childType = childType;
this._length = length;
}
_createClass(Array, {
read: {
value: function read(io) {
var _this = this;
return times(this._length, function () {
return _this._childType.read(io);
});
}
},
write: {
value: function write(value, io) {
var _this = this;
if (!isArray(value)) {
throw new Error("XDR Write Error: value is not array");
}
if (value.length !== this._length) {
throw new Error("XDR Write Error: Got array of size " + value.length + "," + ("expected " + this._length));
}
each(value, function (child) {
return _this._childType.write(child, io);
});
}
},
isValid: {
value: function isValid(value) {
var _this = this;
if (!isArray(value)) {
return false;
}
if (value.length !== this._length) {
return false;
}
return all(value, function (child) {
return _this._childType.isValid(child);
});
}
}
});
return Array;
})();
includeIoMixin(Array.prototype);
/***/ },
/* 67 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _classCallCheck = __webpack_require__(44)["default"];
var _createClass = __webpack_require__(46)["default"];
var _interopRequire = __webpack_require__(41)["default"];
Object.defineProperty(exports, "__esModule", {
value: true
});
var Int = __webpack_require__(53).Int;
var UnsignedInt = __webpack_require__(40).UnsignedInt;
var _lodash = __webpack_require__(14);
var all = _lodash.all;
var each = _lodash.each;
var times = _lodash.times;
var isArray = _lodash.isArray;
var includeIoMixin = _interopRequire(__webpack_require__(42));
var VarArray = exports.VarArray = (function () {
function VarArray(childType) {
var maxLength = arguments[1] === undefined ? UnsignedInt.MAX_VALUE : arguments[1];
_classCallCheck(this, VarArray);
this._childType = childType;
this._maxLength = maxLength;
}
_createClass(VarArray, {
read: {
value: function read(io) {
var _this = this;
var length = Int.read(io);
if (length > this._maxLength) {
throw new Error("XDR Read Error: Saw " + length + " length VarArray," + ("max allowed is " + this._maxLength));
}
return times(length, function () {
return _this._childType.read(io);
});
}
},
write: {
value: function write(value, io) {
var _this = this;
if (!isArray(value)) {
throw new Error("XDR Write Error: value is not array");
}
if (value.length > this._maxLength) {
throw new Error("XDR Write Error: Got array of size " + value.length + "," + ("max allowed is " + this._maxLength));
}
Int.write(value.length, io);
each(value, function (child) {
return _this._childType.write(child, io);
});
}
},
isValid: {
value: function isValid(value) {
var _this = this;
if (!isArray(value)) {
return false;
}
if (value.length > this._maxLength) {
return false;
}
return all(value, function (child) {
return _this._childType.isValid(child);
});
}
}
});
return VarArray;
})();
includeIoMixin(VarArray.prototype);
/***/ },
/* 68 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _classCallCheck = __webpack_require__(44)["default"];
var _createClass = __webpack_require__(46)["default"];
var _interopRequire = __webpack_require__(41)["default"];
Object.defineProperty(exports, "__esModule", {
value: true
});
var Bool = __webpack_require__(63).Bool;
var _lodash = __webpack_require__(14);
var isNull = _lodash.isNull;
var isUndefined = _lodash.isUndefined;
var includeIoMixin = _interopRequire(__webpack_require__(42));
var Option = exports.Option = (function () {
function Option(childType) {
_classCallCheck(this, Option);
this._childType = childType;
}
_createClass(Option, {
read: {
value: function read(io) {
if (Bool.read(io)) {
return this._childType.read(io);
}
}
},
write: {
value: function write(value, io) {
var isPresent = !(isNull(value) || isUndefined(value));
Bool.write(isPresent, io);
if (isPresent) {
this._childType.write(value, io);
}
}
},
isValid: {
value: function isValid(value) {
if (isNull(value)) {
return true;
}
if (isUndefined(value)) {
return true;
}
return this._childType.isValid(value);
}
}
});
return Option;
})();
includeIoMixin(Option.prototype);
/***/ },
/* 69 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _interopRequire = __webpack_require__(41)["default"];
Object.defineProperty(exports, "__esModule", {
value: true
});
var isUndefined = __webpack_require__(14).isUndefined;
var includeIoMixin = _interopRequire(__webpack_require__(42));
var Void = {
/* jshint unused: false */
read: function read(io) {
return undefined;
},
write: function write(value, io) {
if (!isUndefined(value)) {
throw new Error("XDR Write Error: trying to write value to a void slot");
}
},
isValid: function isValid(value) {
return isUndefined(value);
} };
exports.Void = Void;
includeIoMixin(Void);
/***/ },
/* 70 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _classCallCheck = __webpack_require__(44)["default"];
var _createClass = __webpack_require__(46)["default"];
var _inherits = __webpack_require__(45)["default"];
var _get = __webpack_require__(55)["default"];
var _core = __webpack_require__(36)["default"];
var _interopRequire = __webpack_require__(41)["default"];
Object.defineProperty(exports, "__esModule", {
value: true
});
var Int = __webpack_require__(53).Int;
var _lodash = __webpack_require__(14);
var each = _lodash.each;
var vals = _lodash.values;
var includeIoMixin = _interopRequire(__webpack_require__(42));
var Enum = exports.Enum = (function () {
function Enum(name, value) {
_classCallCheck(this, Enum);
this.name = name;
this.value = value;
}
_createClass(Enum, null, {
read: {
value: function read(io) {
var intVal = Int.read(io);
if (!this._byValue.has(intVal)) {
throw new Error("XDR Read Error: Unknown " + this.enumName + " member for value " + intVal);
}
return this._byValue.get(intVal);
}
},
write: {
value: function write(value, io) {
if (!(value instanceof this)) {
throw new Error("XDR Write Error: Unknown " + value + " is not a " + this.enumName);
}
Int.write(value.value, io);
}
},
isValid: {
value: function isValid(value) {
return value instanceof this;
}
},
members: {
value: function members() {
return this._members;
}
},
values: {
value: function values() {
return vals(this._members);
}
},
fromName: {
value: function fromName(name) {
var result = this._members[name];
if (!result) {
throw new Error("" + name + " is not a member of " + this.enumName);
}
return result;
}
},
create: {
value: function create(name, members) {
var ChildEnum = (function (_Enum) {
var _class = function ChildEnum() {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_classCallCheck(this, _class);
_get(_core.Object.getPrototypeOf(_class.prototype), "constructor", this).apply(this, args);
};
_inherits(_class, _Enum);
return _class;
})(Enum);
ChildEnum.enumName = name;
ChildEnum._members = {};
ChildEnum._byValue = new _core.Map();
each(members, function (value, key) {
var inst = new ChildEnum(key, value);
ChildEnum._members[key] = inst;
ChildEnum._byValue.set(value, inst);
ChildEnum[key] = function () {
return inst;
};
});
return ChildEnum;
}
}
});
return Enum;
})();
includeIoMixin(Enum);
/***/ },
/* 71 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _classCallCheck = __webpack_require__(44)["default"];
var _createClass = __webpack_require__(46)["default"];
var _inherits = __webpack_require__(45)["default"];
var _get = __webpack_require__(55)["default"];
var _slicedToArray = __webpack_require__(72)["default"];
var _core = __webpack_require__(36)["default"];
var _interopRequire = __webpack_require__(41)["default"];
Object.defineProperty(exports, "__esModule", {
value: true
});
var _lodash = __webpack_require__(14);
var each = _lodash.each;
var map = _lodash.map;
var isUndefined = _lodash.isUndefined;
var zipObject = _lodash.zipObject;
var includeIoMixin = _interopRequire(__webpack_require__(42));
var Struct = exports.Struct = (function () {
function Struct(attributes) {
_classCallCheck(this, Struct);
this._attributes = attributes || {};
}
_createClass(Struct, null, {
read: {
value: function read(io) {
var fields = map(this._fields, function (field) {
var _field = _slicedToArray(field, 2);
var name = _field[0];
var type = _field[1];
var value = type.read(io);
return [name, value];
});
return new this(zipObject(fields));
}
},
write: {
value: function write(value, io) {
if (!(value instanceof this)) {
throw new Error("XDR Write Error: " + value + " is not a " + this.structName);
}
each(this._fields, function (field) {
var _field = _slicedToArray(field, 2);
var name = _field[0];
var type = _field[1];
var attribute = value._attributes[name];
type.write(attribute, io);
});
}
},
isValid: {
value: function isValid(value) {
return value instanceof this;
}
},
create: {
value: function create(name, fields) {
var ChildStruct = (function (_Struct) {
var _class = function ChildStruct() {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_classCallCheck(this, _class);
_get(_core.Object.getPrototypeOf(_class.prototype), "constructor", this).apply(this, args);
};
_inherits(_class, _Struct);
return _class;
})(Struct);
ChildStruct.structName = name;
ChildStruct._fields = fields;
each(fields, function (field) {
var _field = _slicedToArray(field, 1);
var fieldName = _field[0];
ChildStruct.prototype[fieldName] = readOrWriteAttribute(fieldName);
});
return ChildStruct;
}
}
});
return Struct;
})();
includeIoMixin(Struct);
function readOrWriteAttribute(name) {
return function (value) {
if (!isUndefined(value)) {
this._attributes[name] = value;
}
return this._attributes[name];
};
}
/***/ },
/* 72 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _core = __webpack_require__(36)["default"];
exports["default"] = function (arr, i) {
if (Array.isArray(arr)) {
return arr;
} else if (_core.$for.isIterable(Object(arr))) {
var _arr = [];
for (var _iterator = _core.$for.getIterator(arr), _step; !(_step = _iterator.next()).done;) {
_arr.push(_step.value);
if (i && _arr.length === i) break;
}
return _arr;
} else {
throw new TypeError("Invalid attempt to destructure non-iterable instance");
}
};
exports.__esModule = true;
/***/ },
/* 73 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _classCallCheck = __webpack_require__(44)["default"];
var _createClass = __webpack_require__(46)["default"];
var _inherits = __webpack_require__(45)["default"];
var _get = __webpack_require__(55)["default"];
var _core = __webpack_require__(36)["default"];
var _interopRequire = __webpack_require__(41)["default"];
Object.defineProperty(exports, "__esModule", {
value: true
});
var _lodash = __webpack_require__(14);
var each = _lodash.each;
var isUndefined = _lodash.isUndefined;
var Void = __webpack_require__(69).Void;
var includeIoMixin = _interopRequire(__webpack_require__(42));
var Union = exports.Union = (function () {
function Union(aSwitch, value) {
_classCallCheck(this, Union);
this.set(aSwitch, value);
}
_createClass(Union, {
set: {
value: function set(aSwitch, value) {
if (!(aSwitch instanceof this.constructor._switchOn)) {
aSwitch = this.constructor._switchOn.fromName(aSwitch);
}
this._switch = aSwitch;
this._arm = this.constructor.armForSwitch(this._switch);
this._armType = this.constructor.armTypeForArm(this._arm);
this._value = value;
}
},
get: {
value: function get() {
var armName = arguments[0] === undefined ? this._arm : arguments[0];
if (this._arm !== Void && this._arm !== armName) {
throw new Error("" + armName + " not set");
}
return this._value;
}
},
"switch": {
value: function _switch() {
return this._switch;
}
},
arm: {
value: function arm() {
return this._arm;
}
},
armType: {
value: function armType() {
return this._armType;
}
},
value: {
value: function value() {
return this._value;
}
}
}, {
armForSwitch: {
value: function armForSwitch(aSwitch) {
var arm = this._switches.get(aSwitch);
if (isUndefined(arm)) {
throw new Error("Bad union switch: " + aSwitch);
}
return arm;
}
},
armTypeForArm: {
value: function armTypeForArm(arm) {
if (arm === Void) {
return Void;
} else {
return this._arms[arm];
}
}
},
read: {
value: function read(io) {
var aSwitch = this._switchOn.read(io);
var arm = this.armForSwitch(aSwitch);
var armType = this.armTypeForArm(arm);
var value = armType.read(io);
return new this(aSwitch, value);
}
},
write: {
value: function write(value, io) {
if (!(value instanceof this)) {
throw new Error("XDR Write Error: " + value + " is not a " + this.unionName);
}
this._switchOn.write(value["switch"](), io);
value.armType().write(value.value(), io);
}
},
isValid: {
value: function isValid(value) {
return value instanceof this;
}
},
create: {
value: function create(name, config) {
var ChildUnion = (function (_Union) {
var _class = function ChildUnion() {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_classCallCheck(this, _class);
_get(_core.Object.getPrototypeOf(_class.prototype), "constructor", this).apply(this, args);
};
_inherits(_class, _Union);
return _class;
})(Union);
ChildUnion.unionName = name;
ChildUnion._switchOn = config.switchOn;
ChildUnion._switches = new _core.Map();
ChildUnion._arms = config.arms;
each(ChildUnion._switchOn.values(), function (aSwitch) {
// build the enum => arm map
var arm = config.switches[aSwitch.name] || config.defaultArm;
ChildUnion._switches.set(aSwitch, arm);
// Add enum-based constrocutors
ChildUnion[aSwitch.name] = function (value) {
return new ChildUnion(aSwitch, value);
};
// Add enum-based "set" helpers
ChildUnion.prototype[aSwitch.name] = function (value) {
return this.set(aSwitch, value);
};
});
// Add arm accessor helpers
each(ChildUnion._arms, function (type, name) {
if (type === Void) {
return;
}
ChildUnion.prototype[name] = function () {
return this.get(name);
};
});
return ChildUnion;
}
}
});
return Union;
})();
includeIoMixin(Union);
/***/ },
/* 74 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _classCallCheck = __webpack_require__(44)["default"];
var _createClass = __webpack_require__(46)["default"];
var _inherits = __webpack_require__(45)["default"];
var _toConsumableArray = __webpack_require__(75)["default"];
var _interopRequireWildcard = __webpack_require__(37)["default"];
var _interopRequire = __webpack_require__(41)["default"];
exports.config = config;
Object.defineProperty(exports, "__esModule", {
value: true
});
var XDR = _interopRequireWildcard(__webpack_require__(38));
var _lodash = __webpack_require__(14);
var isUndefined = _lodash.isUndefined;
var isPlainObject = _lodash.isPlainObject;
var isArray = _lodash.isArray;
var each = _lodash.each;
var map = _lodash.map;
var pick = _lodash.pick;
var sequencify = _interopRequire(__webpack_require__(76));
// types is the root
var types = {};
function config(fn) {
if (fn) {
var builder = new TypeBuilder(types);
fn(builder);
builder.resolve();
}
return types;
}
var Reference = (function () {
function Reference() {
_classCallCheck(this, Reference);
}
_createClass(Reference, {
resolve: {
/* jshint unused: false */
value: function resolve(definitions) {
throw new Error("implement resolve in child class");
}
}
});
return Reference;
})();
var SimpleReference = (function (_Reference) {
function SimpleReference(name) {
_classCallCheck(this, SimpleReference);
this.name = name;
}
_inherits(SimpleReference, _Reference);
_createClass(SimpleReference, {
resolve: {
value: function resolve(definitions) {
return definitions[this.name];
}
}
});
return SimpleReference;
})(Reference);
var ArrayReference = (function (_Reference2) {
function ArrayReference(childReference, length) {
var variable = arguments[2] === undefined ? false : arguments[2];
_classCallCheck(this, ArrayReference);
this.childReference = childReference;
this.length = length;
this.variable = variable;
this.name = childReference.name;
}
_inherits(ArrayReference, _Reference2);
_createClass(ArrayReference, {
resolve: {
value: function resolve(definitions) {
var resolvedChild = this.childReference.resolve(definitions);
if (this.variable) {
return new XDR.VarArray(resolvedChild, this.length);
} else {
return new XDR.Array(resolvedChild, this.length);
}
}
}
});
return ArrayReference;
})(Reference);
var OptionReference = (function (_Reference3) {
function OptionReference(childReference) {
_classCallCheck(this, OptionReference);
this.childReference = childReference;
this.name = childReference.name;
}
_inherits(OptionReference, _Reference3);
_createClass(OptionReference, {
resolve: {
value: function resolve(definitions) {
var resolvedChild = this.childReference.resolve(definitions);
return new XDR.Option(resolvedChild);
}
}
});
return OptionReference;
})(Reference);
var Definition = (function () {
function Definition(constructor, name) {
var _this = this;
for (var _len = arguments.length, config = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
config[_key - 2] = arguments[_key];
}
_classCallCheck(this, Definition);
this.constructor = constructor;
this.name = name;
this.config = config;
this.dep = [];
// walk the defintion config for Reference objects, push their names onto
// this.deps so we can use sequencify to order our resolutions
this._walkConfig(this.config, function (value) {
if (value instanceof Reference) {
_this.dep.push(value.name);
}
});
}
_createClass(Definition, {
create: {
value: function create(deps) {
this._walkConfig(this.config, function (value, key, parent) {
if (!(value instanceof Reference)) {
return;
}
var dep = value.resolve(deps);
if (!dep) {
// throw if the reference couldn't be resolved
throw new Error("XDR Error:" + value.name + " could not be resolved.");
} else {
// overwrite the reference with the concrete value
parent[key] = dep;
}
});
// actually create the concrete definition
return this.constructor.apply(this, [this.name].concat(_toConsumableArray(this.config)));
}
},
_walkConfig: {
value: function _walkConfig(current, fn) {
var _this = this;
each(current, function (value, key) {
fn(value, key, current);
// recurse if the value is a nested object
if (isPlainObject(value) || isArray(value)) {
_this._walkConfig(value, fn);
}
});
}
}
});
return Definition;
})();
var TypeBuilder = (function () {
function TypeBuilder(destination) {
_classCallCheck(this, TypeBuilder);
this._destination = destination;
this._definitions = {};
}
_createClass(TypeBuilder, {
"enum": {
value: function _enum(name, members) {
var result = new Definition(XDR.Enum.create, name, members);
this.define(name, result);
}
},
struct: {
value: function struct(name, members) {
var result = new Definition(XDR.Struct.create, name, members);
this.define(name, result);
}
},
union: {
value: function union(name, config) {
var result = new Definition(XDR.Union.create, name, config);
this.define(name, result);
}
},
typedef: {
value: function typedef(name, config) {
// let the reference resoltion system do it's thing
// the "constructor" for a typedef just returns the resolved value
var createTypedef = function (name, args) {
return args;
};
var result = new Definition(createTypedef, name, config);
this.define(name, result);
}
},
"const": {
value: function _const(name, config) {
var createConst = function (name, args) {
return args;
};
var result = new Definition(createConst, name, config);
this.define(name, result);
}
},
"void": {
value: function _void() {
return XDR.Void;
}
},
bool: {
value: function bool() {
return XDR.Bool;
}
},
int: {
value: function int() {
return XDR.Int;
}
},
hyper: {
value: function hyper() {
return XDR.Hyper;
}
},
uint: {
value: function uint() {
return XDR.UnsignedInt;
}
},
uhyper: {
value: function uhyper() {
return XDR.UnsignedHyper;
}
},
float: {
value: function float() {
return XDR.Float;
}
},
double: {
value: function double() {
return XDR.Double;
}
},
quadruple: {
value: function quadruple() {
return XDR.Quadruple;
}
},
string: {
value: function string(length) {
return new XDR.String(length);
}
},
opaque: {
value: function opaque(length) {
return new XDR.Opaque(length);
}
},
varOpaque: {
value: function varOpaque(length) {
return new XDR.VarOpaque(length);
}
},
array: {
value: function array(childType, length) {
if (childType instanceof Reference) {
return new ArrayReference(childType, length);
} else {
return new XDR.Array(childType, length);
}
}
},
varArray: {
value: function varArray(childType, maxLength) {
if (childType instanceof Reference) {
return new ArrayReference(childType, maxLength, true);
} else {
return new XDR.VarArray(childType, maxLength);
}
}
},
option: {
value: function option(childType) {
if (childType instanceof Reference) {
return new OptionReference(childType);
} else {
return new XDR.Option(childType);
}
}
},
define: {
value: function define(name, definition) {
if (isUndefined(this._destination[name])) {
this._definitions[name] = definition;
} else {
throw new Error("XDR Error:" + name + " is already defined");
}
}
},
lookup: {
value: function lookup(name) {
return new SimpleReference(name);
}
},
resolve: {
value: function resolve() {
var _this = this;
var sequence = [];
sequencify(this._definitions, map(this._definitions, function (d) {
return d.name;
}), sequence);
each(sequence, function (name) {
var defn = _this._definitions[name];
var deps = pick.apply(undefined, [_this._destination].concat(_toConsumableArray(defn.dep)));
var result = defn.create(deps);
//Ensure we aren't redefining a name
if (!isUndefined(_this._destination[name])) {
throw new Error("XDR Error:" + name + " is already defined");
}
_this._destination[name] = result;
});
}
}
});
return TypeBuilder;
})();
/***/ },
/* 75 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _core = __webpack_require__(36)["default"];
exports["default"] = function (arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
return arr2;
} else {
return _core.Array.from(arr);
}
};
exports.__esModule = true;
/***/ },
/* 76 */
/***/ function(module, exports, __webpack_require__) {
/*jshint node:true */
"use strict";
var sequence = function (tasks, names, results, nest) {
var i, name, node, e, j;
nest = nest || [];
for (i = 0; i < names.length; i++) {
name = names[i];
// de-dup results
if (results.indexOf(name) === -1) {
node = tasks[name];
if (!node) {
e = new Error('task "'+name+'" is not defined');
e.missingTask = name;
e.taskList = [];
for (j in tasks) {
if (tasks.hasOwnProperty(j)) {
e.taskList.push(tasks[j].name);
}
}
throw e;
}
if (nest.indexOf(name) > -1) {
nest.push(name);
e = new Error('Recursive dependencies detected: '+nest.join(' -> '));
e.recursiveTasks = nest;
e.taskList = [];
for (j in tasks) {
if (tasks.hasOwnProperty(j)) {
e.taskList.push(tasks[j].name);
}
}
throw e;
}
if (node.dep.length) {
nest.push(name);
sequence(tasks, node.dep, results, nest); // recurse
nest.pop(name);
}
results.push(name);
}
}
};
module.exports = sequence;
/***/ },
/* 77 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(Buffer) {"use strict";
exports.sign = sign;
exports.verify = verify;
Object.defineProperty(exports, "__esModule", {
value: true
});
// This module provides the signing functionality used by the stellar network
// The code below may look a little strange... this is because we try to provide
// the most efficient signing method possible. First, we try to load the
// native ed25519 package for node.js environments, and if that fails we
// fallback to tweetnacl.js
var actualMethods = {};
function sign(data, secretKey) {
return actualMethods.sign(data, secretKey);
}
function verify(data, signature, publicKey) {
return actualMethods.verify(data, signature, publicKey);
}
// if in node
if (typeof window === "undefined") {
(function () {
// NOTE: we use commonjs style require here because es6 imports
// can only occur at the top level. thanks, obama.
var ed25519 = __webpack_require__(78);
actualMethods.sign = function (data, secretKey) {
data = new Buffer(data);
return ed25519.Sign(data, secretKey);
};
actualMethods.verify = function (data, signature, publicKey) {
data = new Buffer(data);
try {
return ed25519.Verify(data, signature, publicKey);
} catch (e) {
return false;
}
};
})();
} else {
(function () {
// fallback to tweetnacl.js if we're in the browser
var nacl = __webpack_require__(26);
actualMethods.sign = function (data, secretKey) {
data = new Buffer(data);
data = new Uint8Array(data.toJSON().data);
secretKey = new Uint8Array(secretKey.toJSON().data);
var signature = nacl.sign.detached(data, secretKey);
return new Buffer(signature);
};
actualMethods.verify = function (data, signature, publicKey) {
data = new Buffer(data);
data = new Uint8Array(data.toJSON().data);
signature = new Uint8Array(signature.toJSON().data);
publicKey = new Uint8Array(publicKey.toJSON().data);
return nacl.sign.detached.verify(data, signature, publicKey);
};
})();
}
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(9).Buffer))
/***/ },
/* 78 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"./build/Release/native.node\""); e.code = 'MODULE_NOT_FOUND'; throw e; }()));
/***/ },
/* 79 */,
/* 80 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(Buffer) {"use strict";
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; };
var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
Object.defineProperty(exports, "__esModule", {
value: true
});
var _signing = __webpack_require__(77);
var sign = _signing.sign;
var verify = _signing.verify;
var base58 = _interopRequireWildcard(__webpack_require__(8));
var xdr = _interopRequire(__webpack_require__(33));
var nacl = __webpack_require__(26);
var Keypair = exports.Keypair = (function () {
function Keypair(keysAndSeed) {
_classCallCheck(this, Keypair);
this._publicKey = new Buffer(keysAndSeed.publicKey);
if (keysAndSeed.secretSeed) {
this._secretSeed = new Buffer(keysAndSeed.secretSeed);
this._secretKey = new Buffer(keysAndSeed.secretKey);
}
}
_createClass(Keypair, {
publicKey: {
value: function publicKey() {
return this._publicKey;
}
},
publicKeyHint: {
value: function publicKeyHint() {
return this._publicKey.slice(0, 4);
}
},
address: {
value: function address() {
return base58.encodeBase58Check("accountId", this._publicKey);
}
},
seed: {
value: function seed() {
return base58.encodeBase58Check("seed", this._secretSeed);
}
},
rawSeed: {
value: function rawSeed() {
return this._secretSeed;
}
},
canSign: {
value: function canSign() {
return !!this._secretKey;
}
},
sign: {
value: (function (_sign) {
var _signWrapper = function sign(_x) {
return _sign.apply(this, arguments);
};
_signWrapper.toString = function () {
return _sign.toString();
};
return _signWrapper;
})(function (data) {
if (!this.canSign()) {
throw new Error("cannot sign: no secret key available");
}
return sign(data, this._secretKey);
})
},
signDecorated: {
value: function signDecorated(data) {
var signature = this.sign(data);
var hint = this.publicKeyHint();
return new xdr.DecoratedSignature({ hint: hint, signature: signature });
}
}
}, {
fromSeed: {
value: function fromSeed(seed) {
var rawSeed = base58.decodeBase58Check("seed", seed);
return this.fromRawSeed(rawSeed);
}
},
fromRawSeed: {
value: function fromRawSeed(rawSeed) {
rawSeed = new Buffer(rawSeed);
var rawSeedU8 = new Uint8Array(rawSeed);
var keys = nacl.sign.keyPair.fromSeed(rawSeedU8);
keys.secretSeed = rawSeed;
return new this(keys);
}
},
master: {
value: function master() {
return this.fromRawSeed("allmylifemyhearthasbeensearching");
}
},
fromAddress: {
value: function fromAddress(address) {
var publicKey = base58.decodeBase58Check("accountId", address);
return new this({ publicKey: publicKey });
}
},
random: {
value: function random() {
var seed = nacl.randomBytes(32);
return this.fromRawSeed(seed);
}
}
});
return Keypair;
})();
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(9).Buffer))
/***/ }
/******/ ]);
|
ajax/libs/js-data/0.2.0/js-data.js
|
RobLoach/cdnjs
|
/**
* @author Jason Dobry <jason.dobry@gmail.com>
* @file js-data.js
* @version 0.2.0 - Homepage <http://www.js-data.io/>
* @copyright (c) 2014 Jason Dobry
* @license MIT <https://github.com/js-data/js-data/blob/master/LICENSE>
*
* @overview Data store.
*/
!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.JSData=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){
// Copyright 2012 Google 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.
// Modifications
// Copyright 2014 Jason Dobry
//
// Summary of modifications:
// Removed all code related to:
// - ArrayObserver
// - ArraySplice
// - PathObserver
// - CompoundObserver
// - Path
// - ObserverTransform
(function(global) {
'use strict';
// Detect and do basic sanity checking on Object/Array.observe.
function detectObjectObserve() {
if (typeof Object.observe !== 'function' ||
typeof Array.observe !== 'function') {
return false;
}
var records = [];
function callback(recs) {
records = recs;
}
var test = {};
var arr = [];
Object.observe(test, callback);
Array.observe(arr, callback);
test.id = 1;
test.id = 2;
delete test.id;
arr.push(1, 2);
arr.length = 0;
Object.deliverChangeRecords(callback);
if (records.length !== 5)
return false;
if (records[0].type != 'add' ||
records[1].type != 'update' ||
records[2].type != 'delete' ||
records[3].type != 'splice' ||
records[4].type != 'splice') {
return false;
}
Object.unobserve(test, callback);
Array.unobserve(arr, callback);
return true;
}
var hasObserve = detectObjectObserve();
function detectEval() {
// Don't test for eval if we're running in a Chrome App environment.
// We check for APIs set that only exist in a Chrome App context.
if (typeof chrome !== 'undefined' && chrome.app && chrome.app.runtime) {
return false;
}
try {
var f = new Function('', 'return true;');
return f();
} catch (ex) {
return false;
}
}
var hasEval = detectEval();
var createObject = ('__proto__' in {}) ?
function(obj) { return obj; } :
function(obj) {
var proto = obj.__proto__;
if (!proto)
return obj;
var newObject = Object.create(proto);
Object.getOwnPropertyNames(obj).forEach(function(name) {
Object.defineProperty(newObject, name,
Object.getOwnPropertyDescriptor(obj, name));
});
return newObject;
};
var MAX_DIRTY_CHECK_CYCLES = 1000;
function dirtyCheck(observer) {
var cycles = 0;
while (cycles < MAX_DIRTY_CHECK_CYCLES && observer.check_()) {
cycles++;
}
if (global.testingExposeCycleCount)
global.dirtyCheckCycleCount = cycles;
return cycles > 0;
}
function objectIsEmpty(object) {
for (var prop in object)
return false;
return true;
}
function diffIsEmpty(diff) {
return objectIsEmpty(diff.added) &&
objectIsEmpty(diff.removed) &&
objectIsEmpty(diff.changed);
}
function diffObjectFromOldObject(object, oldObject) {
var added = {};
var removed = {};
var changed = {};
for (var prop in oldObject) {
var newValue = object[prop];
if (newValue !== undefined && newValue === oldObject[prop])
continue;
if (!(prop in object)) {
removed[prop] = undefined;
continue;
}
if (newValue !== oldObject[prop])
changed[prop] = newValue;
}
for (var prop in object) {
if (prop in oldObject)
continue;
added[prop] = object[prop];
}
if (Array.isArray(object) && object.length !== oldObject.length)
changed.length = object.length;
return {
added: added,
removed: removed,
changed: changed
};
}
var eomTasks = [];
function runEOMTasks() {
if (!eomTasks.length)
return false;
for (var i = 0; i < eomTasks.length; i++) {
eomTasks[i]();
}
eomTasks.length = 0;
return true;
}
var runEOM = hasObserve ? (function(){
var eomObj = { pingPong: true };
var eomRunScheduled = false;
Object.observe(eomObj, function() {
runEOMTasks();
eomRunScheduled = false;
});
return function(fn) {
eomTasks.push(fn);
if (!eomRunScheduled) {
eomRunScheduled = true;
eomObj.pingPong = !eomObj.pingPong;
}
};
})() :
(function() {
return function(fn) {
eomTasks.push(fn);
};
})();
var observedObjectCache = [];
function newObservedObject() {
var observer;
var object;
var discardRecords = false;
var first = true;
function callback(records) {
if (observer && observer.state_ === OPENED && !discardRecords)
observer.check_(records);
}
return {
open: function(obs) {
if (observer)
throw Error('ObservedObject in use');
if (!first)
Object.deliverChangeRecords(callback);
observer = obs;
first = false;
},
observe: function(obj, arrayObserve) {
object = obj;
if (arrayObserve)
Array.observe(object, callback);
else
Object.observe(object, callback);
},
deliver: function(discard) {
discardRecords = discard;
Object.deliverChangeRecords(callback);
discardRecords = false;
},
close: function() {
observer = undefined;
Object.unobserve(object, callback);
observedObjectCache.push(this);
}
};
}
/*
* The observedSet abstraction is a perf optimization which reduces the total
* number of Object.observe observations of a set of objects. The idea is that
* groups of Observers will have some object dependencies in common and this
* observed set ensures that each object in the transitive closure of
* dependencies is only observed once. The observedSet acts as a write barrier
* such that whenever any change comes through, all Observers are checked for
* changed values.
*
* Note that this optimization is explicitly moving work from setup-time to
* change-time.
*
* TODO(rafaelw): Implement "garbage collection". In order to move work off
* the critical path, when Observers are closed, their observed objects are
* not Object.unobserve(d). As a result, it's possible that if the observedSet
* is kept open, but some Observers have been closed, it could cause "leaks"
* (prevent otherwise collectable objects from being collected). At some
* point, we should implement incremental "gc" which keeps a list of
* observedSets which may need clean-up and does small amounts of cleanup on a
* timeout until all is clean.
*/
function getObservedObject(observer, object, arrayObserve) {
var dir = observedObjectCache.pop() || newObservedObject();
dir.open(observer);
dir.observe(object, arrayObserve);
return dir;
}
var UNOPENED = 0;
var OPENED = 1;
var CLOSED = 2;
var nextObserverId = 1;
function Observer() {
this.state_ = UNOPENED;
this.callback_ = undefined;
this.target_ = undefined; // TODO(rafaelw): Should be WeakRef
this.directObserver_ = undefined;
this.value_ = undefined;
this.id_ = nextObserverId++;
}
Observer.prototype = {
open: function(callback, target) {
if (this.state_ != UNOPENED)
throw Error('Observer has already been opened.');
addToAll(this);
this.callback_ = callback;
this.target_ = target;
this.connect_();
this.state_ = OPENED;
return this.value_;
},
close: function() {
if (this.state_ != OPENED)
return;
removeFromAll(this);
this.disconnect_();
this.value_ = undefined;
this.callback_ = undefined;
this.target_ = undefined;
this.state_ = CLOSED;
},
deliver: function() {
if (this.state_ != OPENED)
return;
dirtyCheck(this);
},
report_: function(changes) {
try {
this.callback_.apply(this.target_, changes);
} catch (ex) {
Observer._errorThrownDuringCallback = true;
console.error('Exception caught during observer callback: ' +
(ex.stack || ex));
}
},
discardChanges: function() {
this.check_(undefined, true);
return this.value_;
}
}
var collectObservers = !hasObserve;
var allObservers;
Observer._allObserversCount = 0;
if (collectObservers) {
allObservers = [];
}
function addToAll(observer) {
Observer._allObserversCount++;
if (!collectObservers)
return;
allObservers.push(observer);
}
function removeFromAll(observer) {
Observer._allObserversCount--;
}
var runningMicrotaskCheckpoint = false;
var hasDebugForceFullDelivery = hasObserve && hasEval && (function() {
try {
eval('%RunMicrotasks()');
return true;
} catch (ex) {
return false;
}
})();
global.Platform = global.Platform || {};
global.Platform.performMicrotaskCheckpoint = function() {
if (runningMicrotaskCheckpoint)
return;
if (hasDebugForceFullDelivery) {
eval('%RunMicrotasks()');
return;
}
if (!collectObservers)
return;
runningMicrotaskCheckpoint = true;
var cycles = 0;
var anyChanged, toCheck;
do {
cycles++;
toCheck = allObservers;
allObservers = [];
anyChanged = false;
for (var i = 0; i < toCheck.length; i++) {
var observer = toCheck[i];
if (observer.state_ != OPENED)
continue;
if (observer.check_())
anyChanged = true;
allObservers.push(observer);
}
if (runEOMTasks())
anyChanged = true;
} while (cycles < MAX_DIRTY_CHECK_CYCLES && anyChanged);
if (global.testingExposeCycleCount)
global.dirtyCheckCycleCount = cycles;
runningMicrotaskCheckpoint = false;
};
if (collectObservers) {
global.Platform.clearObservers = function() {
allObservers = [];
};
}
function ObjectObserver(object) {
Observer.call(this);
this.value_ = object;
this.oldObject_ = undefined;
}
ObjectObserver.prototype = createObject({
__proto__: Observer.prototype,
arrayObserve: false,
connect_: function(callback, target) {
if (hasObserve) {
this.directObserver_ = getObservedObject(this, this.value_,
this.arrayObserve);
} else {
this.oldObject_ = this.copyObject(this.value_);
}
},
copyObject: function(object) {
var copy = Array.isArray(object) ? [] : {};
for (var prop in object) {
copy[prop] = object[prop];
};
if (Array.isArray(object))
copy.length = object.length;
return copy;
},
check_: function(changeRecords, skipChanges) {
var diff;
var oldValues;
if (hasObserve) {
if (!changeRecords)
return false;
oldValues = {};
diff = diffObjectFromChangeRecords(this.value_, changeRecords,
oldValues);
} else {
oldValues = this.oldObject_;
diff = diffObjectFromOldObject(this.value_, this.oldObject_);
}
if (diffIsEmpty(diff))
return false;
if (!hasObserve)
this.oldObject_ = this.copyObject(this.value_);
this.report_([
diff.added || {},
diff.removed || {},
diff.changed || {},
function(property) {
return oldValues[property];
}
]);
return true;
},
disconnect_: function() {
if (hasObserve) {
this.directObserver_.close();
this.directObserver_ = undefined;
} else {
this.oldObject_ = undefined;
}
},
deliver: function() {
if (this.state_ != OPENED)
return;
if (hasObserve)
this.directObserver_.deliver(false);
else
dirtyCheck(this);
},
discardChanges: function() {
if (this.directObserver_)
this.directObserver_.deliver(true);
else
this.oldObject_ = this.copyObject(this.value_);
return this.value_;
}
});
var observerSentinel = {};
var expectedRecordTypes = {
add: true,
update: true,
delete: true
};
function diffObjectFromChangeRecords(object, changeRecords, oldValues) {
var added = {};
var removed = {};
for (var i = 0; i < changeRecords.length; i++) {
var record = changeRecords[i];
if (!expectedRecordTypes[record.type]) {
console.error('Unknown changeRecord type: ' + record.type);
console.error(record);
continue;
}
if (!(record.name in oldValues))
oldValues[record.name] = record.oldValue;
if (record.type == 'update')
continue;
if (record.type == 'add') {
if (record.name in removed)
delete removed[record.name];
else
added[record.name] = true;
continue;
}
// type = 'delete'
if (record.name in added) {
delete added[record.name];
delete oldValues[record.name];
} else {
removed[record.name] = true;
}
}
for (var prop in added)
added[prop] = object[prop];
for (var prop in removed)
removed[prop] = undefined;
var changed = {};
for (var prop in oldValues) {
if (prop in added || prop in removed)
continue;
var newValue = object[prop];
if (oldValues[prop] !== newValue)
changed[prop] = newValue;
}
return {
added: added,
removed: removed,
changed: changed
};
}
global.Observer = Observer;
global.Observer.runEOM_ = runEOM;
global.Observer.observerSentinel_ = observerSentinel; // for testing.
global.Observer.hasObjectObserve = hasObserve;
global.ObjectObserver = ObjectObserver;
})((exports.Number = { isNaN: window.isNaN }) ? exports : exports);
},{}],2:[function(require,module,exports){
"use strict";
var Promise = require("./promise/promise").Promise;
var polyfill = require("./promise/polyfill").polyfill;
exports.Promise = Promise;
exports.polyfill = polyfill;
},{"./promise/polyfill":6,"./promise/promise":7}],3:[function(require,module,exports){
"use strict";
/* global toString */
var isArray = require("./utils").isArray;
var isFunction = require("./utils").isFunction;
/**
Returns a promise that is fulfilled when all the given promises have been
fulfilled, or rejected if any of them become rejected. The return promise
is fulfilled with an array that gives all the values in the order they were
passed in the `promises` array argument.
Example:
```javascript
var promise1 = RSVP.resolve(1);
var promise2 = RSVP.resolve(2);
var promise3 = RSVP.resolve(3);
var promises = [ promise1, promise2, promise3 ];
RSVP.all(promises).then(function(array){
// The array here would be [ 1, 2, 3 ];
});
```
If any of the `promises` given to `RSVP.all` are rejected, the first promise
that is rejected will be given as an argument to the returned promises's
rejection handler. For example:
Example:
```javascript
var promise1 = RSVP.resolve(1);
var promise2 = RSVP.reject(new Error("2"));
var promise3 = RSVP.reject(new Error("3"));
var promises = [ promise1, promise2, promise3 ];
RSVP.all(promises).then(function(array){
// Code here never runs because there are rejected promises!
}, function(error) {
// error.message === "2"
});
```
@method all
@for RSVP
@param {Array} promises
@param {String} label
@return {Promise} promise that is fulfilled when all `promises` have been
fulfilled, or rejected if any of them become rejected.
*/
function all(promises) {
/*jshint validthis:true */
var Promise = this;
if (!isArray(promises)) {
throw new TypeError('You must pass an array to all.');
}
return new Promise(function(resolve, reject) {
var results = [], remaining = promises.length,
promise;
if (remaining === 0) {
resolve([]);
}
function resolver(index) {
return function(value) {
resolveAll(index, value);
};
}
function resolveAll(index, value) {
results[index] = value;
if (--remaining === 0) {
resolve(results);
}
}
for (var i = 0; i < promises.length; i++) {
promise = promises[i];
if (promise && isFunction(promise.then)) {
promise.then(resolver(i), reject);
} else {
resolveAll(i, promise);
}
}
});
}
exports.all = all;
},{"./utils":11}],4:[function(require,module,exports){
(function (process,global){
"use strict";
var browserGlobal = (typeof window !== 'undefined') ? window : {};
var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
var local = (typeof global !== 'undefined') ? global : (this === undefined? window:this);
// node
function useNextTick() {
return function() {
process.nextTick(flush);
};
}
function useMutationObserver() {
var iterations = 0;
var observer = new BrowserMutationObserver(flush);
var node = document.createTextNode('');
observer.observe(node, { characterData: true });
return function() {
node.data = (iterations = ++iterations % 2);
};
}
function useSetTimeout() {
return function() {
local.setTimeout(flush, 1);
};
}
var queue = [];
function flush() {
for (var i = 0; i < queue.length; i++) {
var tuple = queue[i];
var callback = tuple[0], arg = tuple[1];
callback(arg);
}
queue = [];
}
var scheduleFlush;
// Decide what async method to use to triggering processing of queued callbacks:
if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') {
scheduleFlush = useNextTick();
} else if (BrowserMutationObserver) {
scheduleFlush = useMutationObserver();
} else {
scheduleFlush = useSetTimeout();
}
function asap(callback, arg) {
var length = queue.push([callback, arg]);
if (length === 1) {
// If length is 1, that means that we need to schedule an async flush.
// If additional callbacks are queued before the queue is flushed, they
// will be processed by this flush that we are scheduling.
scheduleFlush();
}
}
exports.asap = asap;
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"_process":12}],5:[function(require,module,exports){
"use strict";
var config = {
instrument: false
};
function configure(name, value) {
if (arguments.length === 2) {
config[name] = value;
} else {
return config[name];
}
}
exports.config = config;
exports.configure = configure;
},{}],6:[function(require,module,exports){
(function (global){
"use strict";
/*global self*/
var RSVPPromise = require("./promise").Promise;
var isFunction = require("./utils").isFunction;
function polyfill() {
var local;
if (typeof global !== 'undefined') {
local = global;
} else if (typeof window !== 'undefined' && window.document) {
local = window;
} else {
local = self;
}
var es6PromiseSupport =
"Promise" in local &&
// Some of these methods are missing from
// Firefox/Chrome experimental implementations
"resolve" in local.Promise &&
"reject" in local.Promise &&
"all" in local.Promise &&
"race" in local.Promise &&
// Older version of the spec had a resolver object
// as the arg rather than a function
(function() {
var resolve;
new local.Promise(function(r) { resolve = r; });
return isFunction(resolve);
}());
if (!es6PromiseSupport) {
local.Promise = RSVPPromise;
}
}
exports.polyfill = polyfill;
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"./promise":7,"./utils":11}],7:[function(require,module,exports){
"use strict";
var config = require("./config").config;
var configure = require("./config").configure;
var objectOrFunction = require("./utils").objectOrFunction;
var isFunction = require("./utils").isFunction;
var now = require("./utils").now;
var all = require("./all").all;
var race = require("./race").race;
var staticResolve = require("./resolve").resolve;
var staticReject = require("./reject").reject;
var asap = require("./asap").asap;
var counter = 0;
config.async = asap; // default async is asap;
function Promise(resolver) {
if (!isFunction(resolver)) {
throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
}
if (!(this instanceof Promise)) {
throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
}
this._subscribers = [];
invokeResolver(resolver, this);
}
function invokeResolver(resolver, promise) {
function resolvePromise(value) {
resolve(promise, value);
}
function rejectPromise(reason) {
reject(promise, reason);
}
try {
resolver(resolvePromise, rejectPromise);
} catch(e) {
rejectPromise(e);
}
}
function invokeCallback(settled, promise, callback, detail) {
var hasCallback = isFunction(callback),
value, error, succeeded, failed;
if (hasCallback) {
try {
value = callback(detail);
succeeded = true;
} catch(e) {
failed = true;
error = e;
}
} else {
value = detail;
succeeded = true;
}
if (handleThenable(promise, value)) {
return;
} else if (hasCallback && succeeded) {
resolve(promise, value);
} else if (failed) {
reject(promise, error);
} else if (settled === FULFILLED) {
resolve(promise, value);
} else if (settled === REJECTED) {
reject(promise, value);
}
}
var PENDING = void 0;
var SEALED = 0;
var FULFILLED = 1;
var REJECTED = 2;
function subscribe(parent, child, onFulfillment, onRejection) {
var subscribers = parent._subscribers;
var length = subscribers.length;
subscribers[length] = child;
subscribers[length + FULFILLED] = onFulfillment;
subscribers[length + REJECTED] = onRejection;
}
function publish(promise, settled) {
var child, callback, subscribers = promise._subscribers, detail = promise._detail;
for (var i = 0; i < subscribers.length; i += 3) {
child = subscribers[i];
callback = subscribers[i + settled];
invokeCallback(settled, child, callback, detail);
}
promise._subscribers = null;
}
Promise.prototype = {
constructor: Promise,
_state: undefined,
_detail: undefined,
_subscribers: undefined,
then: function(onFulfillment, onRejection) {
var promise = this;
var thenPromise = new this.constructor(function() {});
if (this._state) {
var callbacks = arguments;
config.async(function invokePromiseCallback() {
invokeCallback(promise._state, thenPromise, callbacks[promise._state - 1], promise._detail);
});
} else {
subscribe(this, thenPromise, onFulfillment, onRejection);
}
return thenPromise;
},
'catch': function(onRejection) {
return this.then(null, onRejection);
}
};
Promise.all = all;
Promise.race = race;
Promise.resolve = staticResolve;
Promise.reject = staticReject;
function handleThenable(promise, value) {
var then = null,
resolved;
try {
if (promise === value) {
throw new TypeError("A promises callback cannot return that same promise.");
}
if (objectOrFunction(value)) {
then = value.then;
if (isFunction(then)) {
then.call(value, function(val) {
if (resolved) { return true; }
resolved = true;
if (value !== val) {
resolve(promise, val);
} else {
fulfill(promise, val);
}
}, function(val) {
if (resolved) { return true; }
resolved = true;
reject(promise, val);
});
return true;
}
}
} catch (error) {
if (resolved) { return true; }
reject(promise, error);
return true;
}
return false;
}
function resolve(promise, value) {
if (promise === value) {
fulfill(promise, value);
} else if (!handleThenable(promise, value)) {
fulfill(promise, value);
}
}
function fulfill(promise, value) {
if (promise._state !== PENDING) { return; }
promise._state = SEALED;
promise._detail = value;
config.async(publishFulfillment, promise);
}
function reject(promise, reason) {
if (promise._state !== PENDING) { return; }
promise._state = SEALED;
promise._detail = reason;
config.async(publishRejection, promise);
}
function publishFulfillment(promise) {
publish(promise, promise._state = FULFILLED);
}
function publishRejection(promise) {
publish(promise, promise._state = REJECTED);
}
exports.Promise = Promise;
},{"./all":3,"./asap":4,"./config":5,"./race":8,"./reject":9,"./resolve":10,"./utils":11}],8:[function(require,module,exports){
"use strict";
/* global toString */
var isArray = require("./utils").isArray;
/**
`RSVP.race` allows you to watch a series of promises and act as soon as the
first promise given to the `promises` argument fulfills or rejects.
Example:
```javascript
var promise1 = new RSVP.Promise(function(resolve, reject){
setTimeout(function(){
resolve("promise 1");
}, 200);
});
var promise2 = new RSVP.Promise(function(resolve, reject){
setTimeout(function(){
resolve("promise 2");
}, 100);
});
RSVP.race([promise1, promise2]).then(function(result){
// result === "promise 2" because it was resolved before promise1
// was resolved.
});
```
`RSVP.race` is deterministic in that only the state of the first completed
promise matters. For example, even if other promises given to the `promises`
array argument are resolved, but the first completed promise has become
rejected before the other promises became fulfilled, the returned promise
will become rejected:
```javascript
var promise1 = new RSVP.Promise(function(resolve, reject){
setTimeout(function(){
resolve("promise 1");
}, 200);
});
var promise2 = new RSVP.Promise(function(resolve, reject){
setTimeout(function(){
reject(new Error("promise 2"));
}, 100);
});
RSVP.race([promise1, promise2]).then(function(result){
// Code here never runs because there are rejected promises!
}, function(reason){
// reason.message === "promise2" because promise 2 became rejected before
// promise 1 became fulfilled
});
```
@method race
@for RSVP
@param {Array} promises array of promises to observe
@param {String} label optional string for describing the promise returned.
Useful for tooling.
@return {Promise} a promise that becomes fulfilled with the value the first
completed promises is resolved with if the first completed promise was
fulfilled, or rejected with the reason that the first completed promise
was rejected with.
*/
function race(promises) {
/*jshint validthis:true */
var Promise = this;
if (!isArray(promises)) {
throw new TypeError('You must pass an array to race.');
}
return new Promise(function(resolve, reject) {
var results = [], promise;
for (var i = 0; i < promises.length; i++) {
promise = promises[i];
if (promise && typeof promise.then === 'function') {
promise.then(resolve, reject);
} else {
resolve(promise);
}
}
});
}
exports.race = race;
},{"./utils":11}],9:[function(require,module,exports){
"use strict";
/**
`RSVP.reject` returns a promise that will become rejected with the passed
`reason`. `RSVP.reject` is essentially shorthand for the following:
```javascript
var promise = new RSVP.Promise(function(resolve, reject){
reject(new Error('WHOOPS'));
});
promise.then(function(value){
// Code here doesn't run because the promise is rejected!
}, function(reason){
// reason.message === 'WHOOPS'
});
```
Instead of writing the above, your code now simply becomes the following:
```javascript
var promise = RSVP.reject(new Error('WHOOPS'));
promise.then(function(value){
// Code here doesn't run because the promise is rejected!
}, function(reason){
// reason.message === 'WHOOPS'
});
```
@method reject
@for RSVP
@param {Any} reason value that the returned promise will be rejected with.
@param {String} label optional string for identifying the returned promise.
Useful for tooling.
@return {Promise} a promise that will become rejected with the given
`reason`.
*/
function reject(reason) {
/*jshint validthis:true */
var Promise = this;
return new Promise(function (resolve, reject) {
reject(reason);
});
}
exports.reject = reject;
},{}],10:[function(require,module,exports){
"use strict";
function resolve(value) {
/*jshint validthis:true */
if (value && typeof value === 'object' && value.constructor === this) {
return value;
}
var Promise = this;
return new Promise(function(resolve) {
resolve(value);
});
}
exports.resolve = resolve;
},{}],11:[function(require,module,exports){
"use strict";
function objectOrFunction(x) {
return isFunction(x) || (typeof x === "object" && x !== null);
}
function isFunction(x) {
return typeof x === "function";
}
function isArray(x) {
return Object.prototype.toString.call(x) === "[object Array]";
}
// Date.now is not available in browsers < IE9
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now#Compatibility
var now = Date.now || function() { return new Date().getTime(); };
exports.objectOrFunction = objectOrFunction;
exports.isFunction = isFunction;
exports.isArray = isArray;
exports.now = now;
},{}],12:[function(require,module,exports){
// shim for using process in browser
var process = module.exports = {};
process.nextTick = (function () {
var canSetImmediate = typeof window !== 'undefined'
&& window.setImmediate;
var canPost = typeof window !== 'undefined'
&& window.postMessage && window.addEventListener
;
if (canSetImmediate) {
return function (f) { return window.setImmediate(f) };
}
if (canPost) {
var queue = [];
window.addEventListener('message', function (ev) {
var source = ev.source;
if ((source === window || source === null) && ev.data === 'process-tick') {
ev.stopPropagation();
if (queue.length > 0) {
var fn = queue.shift();
fn();
}
}
}, true);
return function nextTick(fn) {
queue.push(fn);
window.postMessage('process-tick', '*');
};
}
return function nextTick(fn) {
setTimeout(fn, 0);
};
})();
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.binding = function (name) {
throw new Error('process.binding is not supported');
}
// TODO(shtylman)
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
},{}],13:[function(require,module,exports){
var indexOf = require('./indexOf');
/**
* If array contains values.
*/
function contains(arr, val) {
return indexOf(arr, val) !== -1;
}
module.exports = contains;
},{"./indexOf":16}],14:[function(require,module,exports){
var makeIterator = require('../function/makeIterator_');
/**
* Array filter
*/
function filter(arr, callback, thisObj) {
callback = makeIterator(callback, thisObj);
var results = [];
if (arr == null) {
return results;
}
var i = -1, len = arr.length, value;
while (++i < len) {
value = arr[i];
if (callback(value, i, arr)) {
results.push(value);
}
}
return results;
}
module.exports = filter;
},{"../function/makeIterator_":23}],15:[function(require,module,exports){
/**
* Array forEach
*/
function forEach(arr, callback, thisObj) {
if (arr == null) {
return;
}
var i = -1,
len = arr.length;
while (++i < len) {
// we iterate over sparse items since there is no way to make it
// work properly on IE 7-8. see #64
if ( callback.call(thisObj, arr[i], i, arr) === false ) {
break;
}
}
}
module.exports = forEach;
},{}],16:[function(require,module,exports){
/**
* Array.indexOf
*/
function indexOf(arr, item, fromIndex) {
fromIndex = fromIndex || 0;
if (arr == null) {
return -1;
}
var len = arr.length,
i = fromIndex < 0 ? len + fromIndex : fromIndex;
while (i < len) {
// we iterate over sparse items since there is no way to make it
// work properly on IE 7-8. see #64
if (arr[i] === item) {
return i;
}
i++;
}
return -1;
}
module.exports = indexOf;
},{}],17:[function(require,module,exports){
var filter = require('./filter');
function isValidString(val) {
return (val != null && val !== '');
}
/**
* Joins strings with the specified separator inserted between each value.
* Null values and empty strings will be excluded.
*/
function join(items, separator) {
separator = separator || '';
return filter(items, isValidString).join(separator);
}
module.exports = join;
},{"./filter":14}],18:[function(require,module,exports){
var indexOf = require('./indexOf');
/**
* Remove a single item from the array.
* (it won't remove duplicates, just a single item)
*/
function remove(arr, item){
var idx = indexOf(arr, item);
if (idx !== -1) arr.splice(idx, 1);
}
module.exports = remove;
},{"./indexOf":16}],19:[function(require,module,exports){
/**
* Create slice of source array or array-like object
*/
function slice(arr, start, end){
var len = arr.length;
if (start == null) {
start = 0;
} else if (start < 0) {
start = Math.max(len + start, 0);
} else {
start = Math.min(start, len);
}
if (end == null) {
end = len;
} else if (end < 0) {
end = Math.max(len + end, 0);
} else {
end = Math.min(end, len);
}
var result = [];
while (start < end) {
result.push(arr[start++]);
}
return result;
}
module.exports = slice;
},{}],20:[function(require,module,exports){
/**
* Merge sort (http://en.wikipedia.org/wiki/Merge_sort)
*/
function mergeSort(arr, compareFn) {
if (arr == null) {
return [];
} else if (arr.length < 2) {
return arr;
}
if (compareFn == null) {
compareFn = defaultCompare;
}
var mid, left, right;
mid = ~~(arr.length / 2);
left = mergeSort( arr.slice(0, mid), compareFn );
right = mergeSort( arr.slice(mid, arr.length), compareFn );
return merge(left, right, compareFn);
}
function defaultCompare(a, b) {
return a < b ? -1 : (a > b? 1 : 0);
}
function merge(left, right, compareFn) {
var result = [];
while (left.length && right.length) {
if (compareFn(left[0], right[0]) <= 0) {
// if 0 it should preserve same order (stable)
result.push(left.shift());
} else {
result.push(right.shift());
}
}
if (left.length) {
result.push.apply(result, left);
}
if (right.length) {
result.push.apply(result, right);
}
return result;
}
module.exports = mergeSort;
},{}],21:[function(require,module,exports){
var isFunction = require('../lang/isFunction');
/**
* Creates an object that holds a lookup for the objects in the array.
*/
function toLookup(arr, key) {
var result = {};
if (arr == null) {
return result;
}
var i = -1, len = arr.length, value;
if (isFunction(key)) {
while (++i < len) {
value = arr[i];
result[key(value)] = value;
}
} else {
while (++i < len) {
value = arr[i];
result[value[key]] = value;
}
}
return result;
}
module.exports = toLookup;
},{"../lang/isFunction":30}],22:[function(require,module,exports){
/**
* Returns the first argument provided to it.
*/
function identity(val){
return val;
}
module.exports = identity;
},{}],23:[function(require,module,exports){
var identity = require('./identity');
var prop = require('./prop');
var deepMatches = require('../object/deepMatches');
/**
* Converts argument into a valid iterator.
* Used internally on most array/object/collection methods that receives a
* callback/iterator providing a shortcut syntax.
*/
function makeIterator(src, thisObj){
if (src == null) {
return identity;
}
switch(typeof src) {
case 'function':
// function is the first to improve perf (most common case)
// also avoid using `Function#call` if not needed, which boosts
// perf a lot in some cases
return (typeof thisObj !== 'undefined')? function(val, i, arr){
return src.call(thisObj, val, i, arr);
} : src;
case 'object':
return function(val){
return deepMatches(val, src);
};
case 'string':
case 'number':
return prop(src);
}
}
module.exports = makeIterator;
},{"../object/deepMatches":38,"./identity":22,"./prop":24}],24:[function(require,module,exports){
/**
* Returns a function that gets a property of the passed object
*/
function prop(name){
return function(obj){
return obj[name];
};
}
module.exports = prop;
},{}],25:[function(require,module,exports){
var kindOf = require('./kindOf');
var isPlainObject = require('./isPlainObject');
var mixIn = require('../object/mixIn');
/**
* Clone native types.
*/
function clone(val){
switch (kindOf(val)) {
case 'Object':
return cloneObject(val);
case 'Array':
return cloneArray(val);
case 'RegExp':
return cloneRegExp(val);
case 'Date':
return cloneDate(val);
default:
return val;
}
}
function cloneObject(source) {
if (isPlainObject(source)) {
return mixIn({}, source);
} else {
return source;
}
}
function cloneRegExp(r) {
var flags = '';
flags += r.multiline ? 'm' : '';
flags += r.global ? 'g' : '';
flags += r.ignorecase ? 'i' : '';
return new RegExp(r.source, flags);
}
function cloneDate(date) {
return new Date(+date);
}
function cloneArray(arr) {
return arr.slice();
}
module.exports = clone;
},{"../object/mixIn":44,"./isPlainObject":34,"./kindOf":36}],26:[function(require,module,exports){
var clone = require('./clone');
var forOwn = require('../object/forOwn');
var kindOf = require('./kindOf');
var isPlainObject = require('./isPlainObject');
/**
* Recursively clone native types.
*/
function deepClone(val, instanceClone) {
switch ( kindOf(val) ) {
case 'Object':
return cloneObject(val, instanceClone);
case 'Array':
return cloneArray(val, instanceClone);
default:
return clone(val);
}
}
function cloneObject(source, instanceClone) {
if (isPlainObject(source)) {
var out = {};
forOwn(source, function(val, key) {
this[key] = deepClone(val, instanceClone);
}, out);
return out;
} else if (instanceClone) {
return instanceClone(source);
} else {
return source;
}
}
function cloneArray(arr, instanceClone) {
var out = [],
i = -1,
n = arr.length,
val;
while (++i < n) {
out[i] = deepClone(arr[i], instanceClone);
}
return out;
}
module.exports = deepClone;
},{"../object/forOwn":41,"./clone":25,"./isPlainObject":34,"./kindOf":36}],27:[function(require,module,exports){
var isKind = require('./isKind');
/**
*/
var isArray = Array.isArray || function (val) {
return isKind(val, 'Array');
};
module.exports = isArray;
},{"./isKind":31}],28:[function(require,module,exports){
var isKind = require('./isKind');
/**
*/
function isBoolean(val) {
return isKind(val, 'Boolean');
}
module.exports = isBoolean;
},{"./isKind":31}],29:[function(require,module,exports){
var forOwn = require('../object/forOwn');
var isArray = require('./isArray');
function isEmpty(val){
if (val == null) {
// typeof null == 'object' so we check it first
return true;
} else if ( typeof val === 'string' || isArray(val) ) {
return !val.length;
} else if ( typeof val === 'object' ) {
var result = true;
forOwn(val, function(){
result = false;
return false; // break loop
});
return result;
} else {
return true;
}
}
module.exports = isEmpty;
},{"../object/forOwn":41,"./isArray":27}],30:[function(require,module,exports){
var isKind = require('./isKind');
/**
*/
function isFunction(val) {
return isKind(val, 'Function');
}
module.exports = isFunction;
},{"./isKind":31}],31:[function(require,module,exports){
var kindOf = require('./kindOf');
/**
* Check if value is from a specific "kind".
*/
function isKind(val, kind){
return kindOf(val) === kind;
}
module.exports = isKind;
},{"./kindOf":36}],32:[function(require,module,exports){
var isKind = require('./isKind');
/**
*/
function isNumber(val) {
return isKind(val, 'Number');
}
module.exports = isNumber;
},{"./isKind":31}],33:[function(require,module,exports){
var isKind = require('./isKind');
/**
*/
function isObject(val) {
return isKind(val, 'Object');
}
module.exports = isObject;
},{"./isKind":31}],34:[function(require,module,exports){
/**
* Checks if the value is created by the `Object` constructor.
*/
function isPlainObject(value) {
return (!!value && typeof value === 'object' &&
value.constructor === Object);
}
module.exports = isPlainObject;
},{}],35:[function(require,module,exports){
var isKind = require('./isKind');
/**
*/
function isString(val) {
return isKind(val, 'String');
}
module.exports = isString;
},{"./isKind":31}],36:[function(require,module,exports){
var _rKind = /^\[object (.*)\]$/,
_toString = Object.prototype.toString,
UNDEF;
/**
* Gets the "kind" of value. (e.g. "String", "Number", etc)
*/
function kindOf(val) {
if (val === null) {
return 'Null';
} else if (val === UNDEF) {
return 'Undefined';
} else {
return _rKind.exec( _toString.call(val) )[1];
}
}
module.exports = kindOf;
},{}],37:[function(require,module,exports){
/**
* Typecast a value to a String, using an empty string value for null or
* undefined.
*/
function toString(val){
return val == null ? '' : val.toString();
}
module.exports = toString;
},{}],38:[function(require,module,exports){
var forOwn = require('./forOwn');
var isArray = require('../lang/isArray');
function containsMatch(array, pattern) {
var i = -1, length = array.length;
while (++i < length) {
if (deepMatches(array[i], pattern)) {
return true;
}
}
return false;
}
function matchArray(target, pattern) {
var i = -1, patternLength = pattern.length;
while (++i < patternLength) {
if (!containsMatch(target, pattern[i])) {
return false;
}
}
return true;
}
function matchObject(target, pattern) {
var result = true;
forOwn(pattern, function(val, key) {
if (!deepMatches(target[key], val)) {
// Return false to break out of forOwn early
return (result = false);
}
});
return result;
}
/**
* Recursively check if the objects match.
*/
function deepMatches(target, pattern){
if (target && typeof target === 'object') {
if (isArray(target) && isArray(pattern)) {
return matchArray(target, pattern);
} else {
return matchObject(target, pattern);
}
} else {
return target === pattern;
}
}
module.exports = deepMatches;
},{"../lang/isArray":27,"./forOwn":41}],39:[function(require,module,exports){
var forOwn = require('./forOwn');
var isPlainObject = require('../lang/isPlainObject');
/**
* Mixes objects into the target object, recursively mixing existing child
* objects.
*/
function deepMixIn(target, objects) {
var i = 0,
n = arguments.length,
obj;
while(++i < n){
obj = arguments[i];
if (obj) {
forOwn(obj, copyProp, target);
}
}
return target;
}
function copyProp(val, key) {
var existing = this[key];
if (isPlainObject(val) && isPlainObject(existing)) {
deepMixIn(existing, val);
} else {
this[key] = val;
}
}
module.exports = deepMixIn;
},{"../lang/isPlainObject":34,"./forOwn":41}],40:[function(require,module,exports){
var hasOwn = require('./hasOwn');
var _hasDontEnumBug,
_dontEnums;
function checkDontEnum(){
_dontEnums = [
'toString',
'toLocaleString',
'valueOf',
'hasOwnProperty',
'isPrototypeOf',
'propertyIsEnumerable',
'constructor'
];
_hasDontEnumBug = true;
for (var key in {'toString': null}) {
_hasDontEnumBug = false;
}
}
/**
* Similar to Array/forEach but works over object properties and fixes Don't
* Enum bug on IE.
* based on: http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation
*/
function forIn(obj, fn, thisObj){
var key, i = 0;
// no need to check if argument is a real object that way we can use
// it for arrays, functions, date, etc.
//post-pone check till needed
if (_hasDontEnumBug == null) checkDontEnum();
for (key in obj) {
if (exec(fn, obj, key, thisObj) === false) {
break;
}
}
if (_hasDontEnumBug) {
var ctor = obj.constructor,
isProto = !!ctor && obj === ctor.prototype;
while (key = _dontEnums[i++]) {
// For constructor, if it is a prototype object the constructor
// is always non-enumerable unless defined otherwise (and
// enumerated above). For non-prototype objects, it will have
// to be defined on this object, since it cannot be defined on
// any prototype objects.
//
// For other [[DontEnum]] properties, check if the value is
// different than Object prototype value.
if (
(key !== 'constructor' ||
(!isProto && hasOwn(obj, key))) &&
obj[key] !== Object.prototype[key]
) {
if (exec(fn, obj, key, thisObj) === false) {
break;
}
}
}
}
}
function exec(fn, obj, key, thisObj){
return fn.call(thisObj, obj[key], key, obj);
}
module.exports = forIn;
},{"./hasOwn":42}],41:[function(require,module,exports){
var hasOwn = require('./hasOwn');
var forIn = require('./forIn');
/**
* Similar to Array/forEach but works over object properties and fixes Don't
* Enum bug on IE.
* based on: http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation
*/
function forOwn(obj, fn, thisObj){
forIn(obj, function(val, key){
if (hasOwn(obj, key)) {
return fn.call(thisObj, obj[key], key, obj);
}
});
}
module.exports = forOwn;
},{"./forIn":40,"./hasOwn":42}],42:[function(require,module,exports){
/**
* Safer Object.hasOwnProperty
*/
function hasOwn(obj, prop){
return Object.prototype.hasOwnProperty.call(obj, prop);
}
module.exports = hasOwn;
},{}],43:[function(require,module,exports){
var hasOwn = require('./hasOwn');
var deepClone = require('../lang/deepClone');
var isObject = require('../lang/isObject');
/**
* Deep merge objects.
*/
function merge() {
var i = 1,
key, val, obj, target;
// make sure we don't modify source element and it's properties
// objects are passed by reference
target = deepClone( arguments[0] );
while (obj = arguments[i++]) {
for (key in obj) {
if ( ! hasOwn(obj, key) ) {
continue;
}
val = obj[key];
if ( isObject(val) && isObject(target[key]) ){
// inception, deep merge objects
target[key] = merge(target[key], val);
} else {
// make sure arrays, regexp, date, objects are cloned
target[key] = deepClone(val);
}
}
}
return target;
}
module.exports = merge;
},{"../lang/deepClone":26,"../lang/isObject":33,"./hasOwn":42}],44:[function(require,module,exports){
var forOwn = require('./forOwn');
/**
* Combine properties from all the objects into first one.
* - This method affects target object in place, if you want to create a new Object pass an empty object as first param.
* @param {object} target Target Object
* @param {...object} objects Objects to be combined (0...n objects).
* @return {object} Target Object.
*/
function mixIn(target, objects){
var i = 0,
n = arguments.length,
obj;
while(++i < n){
obj = arguments[i];
if (obj != null) {
forOwn(obj, copyProp, target);
}
}
return target;
}
function copyProp(val, key){
this[key] = val;
}
module.exports = mixIn;
},{"./forOwn":41}],45:[function(require,module,exports){
var forEach = require('../array/forEach');
/**
* Create nested object if non-existent
*/
function namespace(obj, path){
if (!path) return obj;
forEach(path.split('.'), function(key){
if (!obj[key]) {
obj[key] = {};
}
obj = obj[key];
});
return obj;
}
module.exports = namespace;
},{"../array/forEach":15}],46:[function(require,module,exports){
var slice = require('../array/slice');
/**
* Return a copy of the object, filtered to only have values for the whitelisted keys.
*/
function pick(obj, var_keys){
var keys = typeof arguments[1] !== 'string'? arguments[1] : slice(arguments, 1),
out = {},
i = 0, key;
while (key = keys[i++]) {
out[key] = obj[key];
}
return out;
}
module.exports = pick;
},{"../array/slice":19}],47:[function(require,module,exports){
var namespace = require('./namespace');
/**
* set "nested" object property
*/
function set(obj, prop, val){
var parts = (/^(.+)\.(.+)$/).exec(prop);
if (parts){
namespace(obj, parts[1])[parts[2]] = val;
} else {
obj[prop] = val;
}
}
module.exports = set;
},{"./namespace":45}],48:[function(require,module,exports){
var toString = require('../lang/toString');
var replaceAccents = require('./replaceAccents');
var removeNonWord = require('./removeNonWord');
var upperCase = require('./upperCase');
var lowerCase = require('./lowerCase');
/**
* Convert string to camelCase text.
*/
function camelCase(str){
str = toString(str);
str = replaceAccents(str);
str = removeNonWord(str)
.replace(/[\-_]/g, ' ') //convert all hyphens and underscores to spaces
.replace(/\s[a-z]/g, upperCase) //convert first char of each word to UPPERCASE
.replace(/\s+/g, '') //remove spaces
.replace(/^[A-Z]/g, lowerCase); //convert first char to lowercase
return str;
}
module.exports = camelCase;
},{"../lang/toString":37,"./lowerCase":49,"./removeNonWord":52,"./replaceAccents":53,"./upperCase":54}],49:[function(require,module,exports){
var toString = require('../lang/toString');
/**
* "Safer" String.toLowerCase()
*/
function lowerCase(str){
str = toString(str);
return str.toLowerCase();
}
module.exports = lowerCase;
},{"../lang/toString":37}],50:[function(require,module,exports){
var join = require('../array/join');
var slice = require('../array/slice');
/**
* Group arguments as path segments, if any of the args is `null` or an
* empty string it will be ignored from resulting path.
*/
function makePath(var_args){
var result = join(slice(arguments), '/');
// need to disconsider duplicate '/' after protocol (eg: 'http://')
return result.replace(/([^:\/]|^)\/{2,}/g, '$1/');
}
module.exports = makePath;
},{"../array/join":17,"../array/slice":19}],51:[function(require,module,exports){
var toString = require('../lang/toString');
var camelCase = require('./camelCase');
var upperCase = require('./upperCase');
/**
* camelCase + UPPERCASE first char
*/
function pascalCase(str){
str = toString(str);
return camelCase(str).replace(/^[a-z]/, upperCase);
}
module.exports = pascalCase;
},{"../lang/toString":37,"./camelCase":48,"./upperCase":54}],52:[function(require,module,exports){
var toString = require('../lang/toString');
// This pattern is generated by the _build/pattern-removeNonWord.js script
var PATTERN = /[^\x20\x2D0-9A-Z\x5Fa-z\xC0-\xD6\xD8-\xF6\xF8-\xFF]/g;
/**
* Remove non-word chars.
*/
function removeNonWord(str){
str = toString(str);
return str.replace(PATTERN, '');
}
module.exports = removeNonWord;
},{"../lang/toString":37}],53:[function(require,module,exports){
var toString = require('../lang/toString');
/**
* Replaces all accented chars with regular ones
*/
function replaceAccents(str){
str = toString(str);
// verifies if the String has accents and replace them
if (str.search(/[\xC0-\xFF]/g) > -1) {
str = str
.replace(/[\xC0-\xC5]/g, "A")
.replace(/[\xC6]/g, "AE")
.replace(/[\xC7]/g, "C")
.replace(/[\xC8-\xCB]/g, "E")
.replace(/[\xCC-\xCF]/g, "I")
.replace(/[\xD0]/g, "D")
.replace(/[\xD1]/g, "N")
.replace(/[\xD2-\xD6\xD8]/g, "O")
.replace(/[\xD9-\xDC]/g, "U")
.replace(/[\xDD]/g, "Y")
.replace(/[\xDE]/g, "P")
.replace(/[\xE0-\xE5]/g, "a")
.replace(/[\xE6]/g, "ae")
.replace(/[\xE7]/g, "c")
.replace(/[\xE8-\xEB]/g, "e")
.replace(/[\xEC-\xEF]/g, "i")
.replace(/[\xF1]/g, "n")
.replace(/[\xF2-\xF6\xF8]/g, "o")
.replace(/[\xF9-\xFC]/g, "u")
.replace(/[\xFE]/g, "p")
.replace(/[\xFD\xFF]/g, "y");
}
return str;
}
module.exports = replaceAccents;
},{"../lang/toString":37}],54:[function(require,module,exports){
var toString = require('../lang/toString');
/**
* "Safer" String.toUpperCase()
*/
function upperCase(str){
str = toString(str);
return str.toUpperCase();
}
module.exports = upperCase;
},{"../lang/toString":37}],55:[function(require,module,exports){
var DSUtils = require('../../utils');
var DSErrors = require('../../errors');
var promisify = DSUtils.promisify;
function create(resourceName, attrs, options) {
var _this = this;
var definition = _this.definitions[resourceName];
var promise = new DSUtils.Promise(function (resolve, reject) {
options = options || {};
if (!definition) {
reject(new DSErrors.NER(resourceName));
} else {
if (!('cacheResponse' in options)) {
options.cacheResponse = true;
}
if (!('upsert' in options)) {
options.upsert = true;
}
resolve(attrs);
}
});
if (options.upsert && attrs[definition.idAttribute]) {
return _this.update(resourceName, attrs[definition.idAttribute], attrs, options);
} else {
return promise
.then(function (attrs) {
var func = options.beforeValidate ? promisify(options.beforeValidate) : definition.beforeValidate;
return func.call(attrs, resourceName, attrs);
})
.then(function (attrs) {
var func = options.validate ? promisify(options.validate) : definition.validate;
return func.call(attrs, resourceName, attrs);
})
.then(function (attrs) {
var func = options.afterValidate ? promisify(options.afterValidate) : definition.afterValidate;
return func.call(attrs, resourceName, attrs);
})
.then(function (attrs) {
var func = options.beforeCreate ? promisify(options.beforeCreate) : definition.beforeCreate;
return func.call(attrs, resourceName, attrs);
})
.then(function (attrs) {
_this.notify(definition, 'beforeCreate', DSUtils.merge({}, attrs));
return _this.getAdapter(definition, options).create(definition, attrs, options);
})
.then(function (data) {
var func = options.afterCreate ? promisify(options.afterCreate) : definition.afterCreate;
return func.call(data, resourceName, data);
})
.then(function (attrs) {
_this.notify(definition, 'afterCreate', DSUtils.merge({}, attrs));
if (options.cacheResponse) {
var resource = _this.store[resourceName];
var created = _this.inject(definition.name, attrs, options);
var id = created[definition.idAttribute];
resource.completedQueries[id] = new Date().getTime();
resource.previousAttributes[id] = DSUtils.deepMixIn({}, created);
resource.saved[id] = DSUtils.updateTimestamp(resource.saved[id]);
return _this.get(definition.name, id);
} else {
return _this.createInstance(resourceName, attrs, options);
}
});
}
}
module.exports = create;
},{"../../errors":76,"../../utils":78}],56:[function(require,module,exports){
var DSUtils = require('../../utils');
var DSErrors = require('../../errors');
var promisify = DSUtils.promisify;
function destroy(resourceName, id, options) {
var _this = this;
var definition = _this.definitions[resourceName];
var item;
return new DSUtils.Promise(function (resolve, reject) {
options = options || {};
id = DSUtils.resolveId(definition, id);
if (!definition) {
reject(new DSErrors.NER(resourceName));
} else if (!DSUtils.isString(id) && !DSUtils.isNumber(id)) {
reject(new DSErrors.IA('"id" must be a string or a number!'));
} else if (!_this.get(resourceName, id)) {
reject(new DSErrors.R('id "' + id + '" not found in cache!'));
} else {
item = _this.get(resourceName, id);
resolve(item);
}
})
.then(function (attrs) {
var func = options.beforeDestroy ? promisify(options.beforeDestroy) : definition.beforeDestroy;
return func.call(attrs, resourceName, attrs);
})
.then(function (attrs) {
_this.notify(definition, 'beforeDestroy', DSUtils.merge({}, attrs));
return _this.getAdapter(definition, options).destroy(definition, id, options);
})
.then(function () {
var func = options.afterDestroy ? promisify(options.afterDestroy) : definition.afterDestroy;
return func.call(item, resourceName, item);
})
.then(function (item) {
_this.notify(definition, 'afterDestroy', DSUtils.merge({}, item));
_this.eject(resourceName, id);
return id;
});
}
module.exports = destroy;
},{"../../errors":76,"../../utils":78}],57:[function(require,module,exports){
var DSUtils = require('../../utils');
var DSErrors = require('../../errors');
function destroyAll(resourceName, params, options) {
var _this = this;
var definition = _this.definitions[resourceName];
return new DSUtils.Promise(function (resolve, reject) {
if (!definition) {
reject(new DSErrors.NER(resourceName));
} else {
resolve();
}
}).then(function () {
return _this.getAdapter(definition, options).destroyAll(definition, params, options);
}).then(function () {
return _this.ejectAll(resourceName, params);
});
}
module.exports = destroyAll;
},{"../../errors":76,"../../utils":78}],58:[function(require,module,exports){
var DSUtils = require('../../utils');
var DSErrors = require('../../errors');
function find(resourceName, id, options) {
var _this = this;
var definition = _this.definitions[resourceName];
var resource = _this.store[resourceName];
return new DSUtils.Promise(function (resolve, reject) {
options = options || {};
if (!definition) {
reject(new DSErrors.NER(resourceName));
} else if (!DSUtils.isString(id) && !DSUtils.isNumber(id)) {
reject(new DSErrors.IA('"id" must be a string or a number!'));
} else if (!DSUtils.isObject(options)) {
reject(new DSErrors.IA('"options" must be an object!'));
} else {
if (!('cacheResponse' in options)) {
options.cacheResponse = true;
}
if (options.bypassCache || !options.cacheResponse) {
delete resource.completedQueries[id];
}
if (id in resource.completedQueries) {
resolve(_this.get(resourceName, id));
} else {
resolve();
}
}
}).then(function (item) {
if (!(id in resource.completedQueries)) {
if (!(id in resource.pendingQueries)) {
resource.pendingQueries[id] = _this.getAdapter(definition, options).find(definition, id, options)
.then(function (data) {
if (options.cacheResponse) {
// Query is no longer pending
delete resource.pendingQueries[id];
resource.completedQueries[id] = new Date().getTime();
return _this.inject(resourceName, data, options);
} else {
return _this.createInstance(resourceName, data, options);
}
});
}
return resource.pendingQueries[id];
} else {
return item;
}
}).catch(function (err) {
delete resource.pendingQueries[id];
throw err;
});
}
module.exports = find;
},{"../../errors":76,"../../utils":78}],59:[function(require,module,exports){
var DSUtils = require('../../utils');
var DSErrors = require('../../errors');
function processResults(data, resourceName, queryHash, options) {
var _this = this;
var resource = _this.store[resourceName];
var idAttribute = _this.definitions[resourceName].idAttribute;
var date = new Date().getTime();
data = data || [];
// Query is no longer pending
delete resource.pendingQueries[queryHash];
resource.completedQueries[queryHash] = date;
// Update modified timestamp of collection
resource.collectionModified = DSUtils.updateTimestamp(resource.collectionModified);
// Merge the new values into the cache
var injected = _this.inject(resourceName, data, options);
// Make sure each object is added to completedQueries
if (DSUtils.isArray(injected)) {
DSUtils.forEach(injected, function (item) {
if (item && item[idAttribute]) {
resource.completedQueries[item[idAttribute]] = date;
}
});
} else {
console.warn(errorPrefix(resourceName) + 'response is expected to be an array!');
resource.completedQueries[injected[idAttribute]] = date;
}
return injected;
}
function findAll(resourceName, params, options) {
var _this = this;
var definition = _this.definitions[resourceName];
var resource = _this.store[resourceName];
var queryHash;
return new DSUtils.Promise(function (resolve, reject) {
options = options || {};
params = params || {};
if (!_this.definitions[resourceName]) {
reject(new DSErrors.NER(resourceName));
} else if (!DSUtils.isObject(params)) {
reject(new DSErrors.IA('"params" must be an object!'));
} else if (!DSUtils.isObject(options)) {
reject(new DSErrors.IA('"options" must be an object!'));
} else {
if (!('cacheResponse' in options)) {
options.cacheResponse = true;
}
queryHash = DSUtils.toJson(params);
if (options.bypassCache || !options.cacheResponse) {
delete resource.completedQueries[queryHash];
}
if (queryHash in resource.completedQueries) {
resolve(_this.filter(resourceName, params, options));
} else {
resolve();
}
}
}).then(function (items) {
if (!(queryHash in resource.completedQueries)) {
if (!(queryHash in resource.pendingQueries)) {
resource.pendingQueries[queryHash] = _this.getAdapter(definition, options).findAll(definition, params, options)
.then(function (data) {
delete resource.pendingQueries[queryHash];
if (options.cacheResponse) {
return processResults.call(_this, data, resourceName, queryHash, options);
} else {
DSUtils.forEach(data, function (item, i) {
data[i] = _this.createInstance(resourceName, item, options);
});
return data;
}
});
}
return resource.pendingQueries[queryHash];
} else {
return items;
}
}).catch(function (err) {
delete resource.pendingQueries[queryHash];
throw err;
});
}
module.exports = findAll;
},{"../../errors":76,"../../utils":78}],60:[function(require,module,exports){
var DSUtils = require('../../utils');
var DSErrors = require('../../errors');
function refresh(resourceName, id, options) {
var _this = this;
return new DSUtils.Promise(function (resolve, reject) {
options = options || {};
id = DSUtils.resolveId(_this.definitions[resourceName], id);
if (!_this.definitions[resourceName]) {
reject(new _this.errors.NER(resourceName));
} else if (!DSUtils.isString(id) && !DSUtils.isNumber(id)) {
reject(new DSErrors.IA('"id" must be a string or a number!'));
} else if (!DSUtils.isObject(options)) {
reject(new DSErrors.IA('"options" must be an object!'));
} else {
options.bypassCache = true;
resolve(_this.get(resourceName, id));
}
}).then(function (item) {
if (item) {
return _this.find(resourceName, id, options);
} else {
return item;
}
});
}
module.exports = {
create: require('./create'),
destroy: require('./destroy'),
destroyAll: require('./destroyAll'),
find: require('./find'),
findAll: require('./findAll'),
loadRelations: require('./loadRelations'),
refresh: refresh,
save: require('./save'),
update: require('./update'),
updateAll: require('./updateAll')
};
},{"../../errors":76,"../../utils":78,"./create":55,"./destroy":56,"./destroyAll":57,"./find":58,"./findAll":59,"./loadRelations":61,"./save":62,"./update":63,"./updateAll":64}],61:[function(require,module,exports){
var DSUtils = require('../../utils');
var DSErrors = require('../../errors');
function loadRelations(resourceName, instance, relations, options) {
var _this = this;
var definition = _this.definitions[resourceName];
var fields = [];
return new DSUtils.Promise(function (resolve, reject) {
options = options || {};
if (DSUtils.isString(instance) || DSUtils.isNumber(instance)) {
instance = _this.get(resourceName, instance);
}
if (DSUtils.isString(relations)) {
relations = [relations];
}
if (!definition) {
reject(new DSErrors.NER(resourceName));
} else if (!DSUtils.isObject(instance)) {
reject(new DSErrors.IA('"instance(id)" must be a string, number or object!'));
} else if (!DSUtils.isArray(relations)) {
reject(new DSErrors.IA('"relations" must be a string or an array!'));
} else if (!DSUtils.isObject(options)) {
reject(new DSErrors.IA('"options" must be an object!'));
} else {
if (!('findBelongsTo' in options)) {
options.findBelongsTo = true;
}
if (!('findHasMany' in options)) {
options.findHasMany = true;
}
var tasks = [];
DSUtils.forEach(definition.relationList, function (def) {
var relationName = def.relation;
if (DSUtils.contains(relations, relationName)) {
var task;
var params = {};
params[def.foreignKey] = instance[definition.idAttribute];
if (def.type === 'hasMany' && params[def.foreignKey]) {
task = _this.findAll(relationName, params, options);
} else if (def.type === 'hasOne') {
if (def.localKey && instance[def.localKey]) {
task = _this.find(relationName, instance[def.localKey], options);
} else if (def.foreignKey && params[def.foreignKey]) {
task = _this.findAll(relationName, params, options).then(function (hasOnes) {
return hasOnes.length ? hasOnes[0] : null;
});
}
} else if (instance[def.localKey]) {
task = _this.find(relationName, instance[def.localKey], options);
}
if (task) {
tasks.push(task);
fields.push(def.localField);
}
}
});
resolve(tasks);
}
})
.then(function (tasks) {
return DSUtils.Promise.all(tasks);
})
.then(function (loadedRelations) {
DSUtils.forEach(fields, function (field, index) {
instance[field] = loadedRelations[index];
});
return instance;
});
}
module.exports = loadRelations;
},{"../../errors":76,"../../utils":78}],62:[function(require,module,exports){
var DSUtils = require('../../utils');
var DSErrors = require('../../errors');
var promisify = DSUtils.promisify;
function save(resourceName, id, options) {
var _this = this;
var definition = _this.definitions[resourceName];
var item;
return new DSUtils.Promise(function (resolve, reject) {
options = options || {};
id = DSUtils.resolveId(definition, id);
if (!definition) {
reject(new DSErrors.NER(resourceName));
} else if (!DSUtils.isString(id) && !DSUtils.isNumber(id)) {
reject(new DSErrors.IA('"id" must be a string or a number!'));
} else if (!DSUtils.isObject(options)) {
reject(new DSErrors.IA('"options" must be an object!'));
} else if (!_this.get(resourceName, id)) {
reject(new DSErrors.R('id "' + id + '" not found in cache!'));
} else {
item = _this.get(resourceName, id);
if (!('cacheResponse' in options)) {
options.cacheResponse = true;
}
resolve(item);
}
}).then(function (attrs) {
var func = options.beforeValidate ? promisify(options.beforeValidate) : definition.beforeValidate;
return func.call(attrs, resourceName, attrs);
})
.then(function (attrs) {
var func = options.validate ? promisify(options.validate) : definition.validate;
return func.call(attrs, resourceName, attrs);
})
.then(function (attrs) {
var func = options.afterValidate ? promisify(options.afterValidate) : definition.afterValidate;
return func.call(attrs, resourceName, attrs);
})
.then(function (attrs) {
var func = options.beforeUpdate ? promisify(options.beforeUpdate) : definition.beforeUpdate;
return func.call(attrs, resourceName, attrs);
})
.then(function (attrs) {
_this.notify(definition, 'beforeUpdate', DSUtils.merge({}, attrs));
if (options.changesOnly) {
var resource = _this.store[resourceName];
resource.observers[id].deliver();
var toKeep = [];
var changes = _this.changes(resourceName, id);
for (var key in changes.added) {
toKeep.push(key);
}
for (key in changes.changed) {
toKeep.push(key);
}
changes = DSUtils.pick(attrs, toKeep);
if (DSUtils.isEmpty(changes)) {
// no changes, return
return attrs;
} else {
attrs = changes;
}
}
return _this.getAdapter(definition, options).update(definition, id, attrs, options);
})
.then(function (data) {
var func = options.afterUpdate ? promisify(options.afterUpdate) : definition.afterUpdate;
return func.call(data, resourceName, data);
})
.then(function (attrs) {
_this.notify(definition, 'afterUpdate', DSUtils.merge({}, attrs));
if (options.cacheResponse) {
var resource = _this.store[resourceName];
var saved = _this.inject(definition.name, attrs, options);
resource.previousAttributes[id] = DSUtils.deepMixIn({}, saved);
resource.saved[id] = DSUtils.updateTimestamp(resource.saved[id]);
resource.observers[id].discardChanges();
return _this.get(resourceName, id);
} else {
return attrs;
}
});
}
module.exports = save;
},{"../../errors":76,"../../utils":78}],63:[function(require,module,exports){
var DSUtils = require('../../utils');
var DSErrors = require('../../errors');
var promisify = DSUtils.promisify;
function update(resourceName, id, attrs, options) {
var _this = this;
var definition = _this.definitions[resourceName];
return new DSUtils.Promise(function (resolve, reject) {
options = options || {};
id = DSUtils.resolveId(definition, id);
if (!definition) {
reject(new DSErrors.NER(resourceName));
} else if (!DSUtils.isString(id) && !DSUtils.isNumber(id)) {
reject(new DSErrors.IA('"id" must be a string or a number!'));
} else if (!DSUtils.isObject(options)) {
reject(new DSErrors.IA('"options" must be an object!'));
} else {
if (!('cacheResponse' in options)) {
options.cacheResponse = true;
}
resolve(attrs);
}
}).then(function (attrs) {
var func = options.beforeValidate ? promisify(options.beforeValidate) : definition.beforeValidate;
return func.call(attrs, resourceName, attrs);
})
.then(function (attrs) {
var func = options.validate ? promisify(options.validate) : definition.validate;
return func.call(attrs, resourceName, attrs);
})
.then(function (attrs) {
var func = options.afterValidate ? promisify(options.afterValidate) : definition.afterValidate;
return func.call(attrs, resourceName, attrs);
})
.then(function (attrs) {
var func = options.beforeUpdate ? promisify(options.beforeUpdate) : definition.beforeUpdate;
return func.call(attrs, resourceName, attrs);
})
.then(function (attrs) {
_this.notify(definition, 'beforeUpdate', DSUtils.merge({}, attrs));
return _this.getAdapter(definition, options).update(definition, id, attrs, options);
})
.then(function (data) {
var func = options.afterUpdate ? promisify(options.afterUpdate) : definition.afterUpdate;
return func.call(data, resourceName, data);
})
.then(function (attrs) {
_this.notify(definition, 'afterUpdate', DSUtils.merge({}, attrs));
if (options.cacheResponse) {
var resource = _this.store[resourceName];
var updated = _this.inject(definition.name, attrs, options);
var id = updated[definition.idAttribute];
resource.previousAttributes[id] = DSUtils.deepMixIn({}, updated);
resource.saved[id] = DSUtils.updateTimestamp(resource.saved[id]);
resource.observers[id].discardChanges();
return _this.get(definition.name, id);
} else {
return attrs;
}
});
}
module.exports = update;
},{"../../errors":76,"../../utils":78}],64:[function(require,module,exports){
var DSUtils = require('../../utils');
var DSErrors = require('../../errors');
var promisify = DSUtils.promisify;
function updateAll(resourceName, attrs, params, options) {
var _this = this;
var definition = _this.definitions[resourceName];
return new DSUtils.Promise(function (resolve, reject) {
options = options || {};
if (!definition) {
reject(new DSErrors.NER(resourceName));
} else if (!DSUtils.isObject(options)) {
reject(new DSErrors.IA('"options" must be an object!'));
} else {
if (!('cacheResponse' in options)) {
options.cacheResponse = true;
}
resolve(attrs);
}
}).then(function (attrs) {
var func = options.beforeValidate ? promisify(options.beforeValidate) : definition.beforeValidate;
return func.call(attrs, resourceName, attrs);
})
.then(function (attrs) {
var func = options.validate ? promisify(options.validate) : definition.validate;
return func.call(attrs, resourceName, attrs);
})
.then(function (attrs) {
var func = options.afterValidate ? promisify(options.afterValidate) : definition.afterValidate;
return func.call(attrs, resourceName, attrs);
})
.then(function (attrs) {
var func = options.beforeUpdate ? promisify(options.beforeUpdate) : definition.beforeUpdate;
return func.call(attrs, resourceName, attrs);
})
.then(function (attrs) {
_this.notify(definition, 'beforeUpdate', DSUtils.merge({}, attrs));
return _this.getAdapter(definition, options).updateAll(definition, attrs, params, options);
})
.then(function (data) {
var func = options.afterUpdate ? promisify(options.afterUpdate) : definition.afterUpdate;
return func.call(data, resourceName, data);
})
.then(function (data) {
_this.notify(definition, 'afterUpdate', DSUtils.merge({}, attrs));
if (options.cacheResponse) {
return _this.inject(definition.name, data, options);
} else {
return data;
}
});
}
module.exports = updateAll;
},{"../../errors":76,"../../utils":78}],65:[function(require,module,exports){
var DSUtils = require('../utils');
var DSErrors = require('../errors');
var syncMethods = require('./sync_methods');
var asyncMethods = require('./async_methods');
DSUtils.deepFreeze(syncMethods);
DSUtils.deepFreeze(asyncMethods);
DSUtils.deepFreeze(DSErrors);
DSUtils.deepFreeze(DSUtils);
function lifecycleNoopCb(resourceName, attrs, cb) {
cb(null, attrs);
}
function lifecycleNoop(resourceName, attrs) {
return attrs;
}
function Defaults() {
}
var defaultsPrototype = Defaults.prototype;
defaultsPrototype.idAttribute = 'id';
defaultsPrototype.defaultAdapter = 'DSHttpAdapter';
defaultsPrototype.defaultFilter = function (collection, resourceName, params, options) {
var _this = this;
var filtered = collection;
var where = null;
var reserved = {
skip: '',
offset: '',
where: '',
limit: '',
orderBy: '',
sort: ''
};
if (DSUtils.isObject(params.where)) {
where = params.where;
} else {
where = {};
}
if (options.allowSimpleWhere) {
DSUtils.forOwn(params, function (value, key) {
if (!(key in reserved) && !(key in where)) {
where[key] = {
'==': value
};
}
});
}
if (DSUtils.isEmpty(where)) {
where = null;
}
if (where) {
filtered = DSUtils.filter(filtered, function (attrs) {
var first = true;
var keep = true;
DSUtils.forOwn(where, function (clause, field) {
if (DSUtils.isString(clause)) {
clause = {
'===': clause
};
} else if (DSUtils.isNumber(clause) || DSUtils.isBoolean(clause)) {
clause = {
'==': clause
};
}
if (DSUtils.isObject(clause)) {
DSUtils.forOwn(clause, function (val, op) {
if (op === '==') {
keep = first ? (attrs[field] == val) : keep && (attrs[field] == val);
} else if (op === '===') {
keep = first ? (attrs[field] === val) : keep && (attrs[field] === val);
} else if (op === '!=') {
keep = first ? (attrs[field] != val) : keep && (attrs[field] != val);
} else if (op === '!==') {
keep = first ? (attrs[field] !== val) : keep && (attrs[field] !== val);
} else if (op === '>') {
keep = first ? (attrs[field] > val) : keep && (attrs[field] > val);
} else if (op === '>=') {
keep = first ? (attrs[field] >= val) : keep && (attrs[field] >= val);
} else if (op === '<') {
keep = first ? (attrs[field] < val) : keep && (attrs[field] < val);
} else if (op === '<=') {
keep = first ? (attrs[field] <= val) : keep && (attrs[field] <= val);
} else if (op === 'in') {
keep = first ? DSUtils.contains(val, attrs[field]) : keep && DSUtils.contains(val, attrs[field]);
} else if (op === 'notIn') {
keep = first ? !DSUtils.contains(val, attrs[field]) : keep && !DSUtils.contains(val, attrs[field]);
} else if (op === '|==') {
keep = first ? (attrs[field] == val) : keep || (attrs[field] == val);
} else if (op === '|===') {
keep = first ? (attrs[field] === val) : keep || (attrs[field] === val);
} else if (op === '|!=') {
keep = first ? (attrs[field] != val) : keep || (attrs[field] != val);
} else if (op === '|!==') {
keep = first ? (attrs[field] !== val) : keep || (attrs[field] !== val);
} else if (op === '|>') {
keep = first ? (attrs[field] > val) : keep || (attrs[field] > val);
} else if (op === '|>=') {
keep = first ? (attrs[field] >= val) : keep || (attrs[field] >= val);
} else if (op === '|<') {
keep = first ? (attrs[field] < val) : keep || (attrs[field] < val);
} else if (op === '|<=') {
keep = first ? (attrs[field] <= val) : keep || (attrs[field] <= val);
} else if (op === '|in') {
keep = first ? DSUtils.contains(val, attrs[field]) : keep || DSUtils.contains(val, attrs[field]);
} else if (op === '|notIn') {
keep = first ? !DSUtils.contains(val, attrs[field]) : keep || !DSUtils.contains(val, attrs[field]);
}
first = false;
});
}
});
return keep;
});
}
var orderBy = null;
if (DSUtils.isString(params.orderBy)) {
orderBy = [
[params.orderBy, 'ASC']
];
} else if (DSUtils.isArray(params.orderBy)) {
orderBy = params.orderBy;
}
if (!orderBy && DSUtils.isString(params.sort)) {
orderBy = [
[params.sort, 'ASC']
];
} else if (!orderBy && DSUtils.isArray(params.sort)) {
orderBy = params.sort;
}
// Apply 'orderBy'
if (orderBy) {
DSUtils.forEach(orderBy, function (def) {
if (DSUtils.isString(def)) {
def = [def, 'ASC'];
} else if (!DSUtils.isArray(def)) {
throw new _this.errors.IllegalArgumentError('DS.filter(resourceName[, params][, options]): ' + DSUtils.toJson(def) + ': Must be a string or an array!', { params: { 'orderBy[i]': { actual: typeof def, expected: 'string|array' } } });
}
filtered = DSUtils.sort(filtered, function (a, b) {
var cA = a[def[0]], cB = b[def[0]];
if (DSUtils.isString(cA)) {
cA = DSUtils.upperCase(cA);
}
if (DSUtils.isString(cB)) {
cB = DSUtils.upperCase(cB);
}
if (def[1] === 'DESC') {
if (cB < cA) {
return -1;
} else if (cB > cA) {
return 1;
} else {
return 0;
}
} else {
if (cA < cB) {
return -1;
} else if (cA > cB) {
return 1;
} else {
return 0;
}
}
});
});
}
var limit = DSUtils.isNumber(params.limit) ? params.limit : null;
var skip = null;
if (DSUtils.isNumber(params.skip)) {
skip = params.skip;
} else if (DSUtils.isNumber(params.offset)) {
skip = params.offset;
}
// Apply 'limit' and 'skip'
if (limit && skip) {
filtered = DSUtils.slice(filtered, skip, Math.min(filtered.length, skip + limit));
} else if (DSUtils.isNumber(limit)) {
filtered = DSUtils.slice(filtered, 0, Math.min(filtered.length, limit));
} else if (DSUtils.isNumber(skip)) {
if (skip < filtered.length) {
filtered = DSUtils.slice(filtered, skip);
} else {
filtered = [];
}
}
return filtered;
};
defaultsPrototype.baseUrl = '';
defaultsPrototype.endpoint = '';
defaultsPrototype.useClass = true;
defaultsPrototype.keepChangeHistory = false;
defaultsPrototype.resetHistoryOnInject = true;
defaultsPrototype.beforeValidate = lifecycleNoopCb;
defaultsPrototype.validate = lifecycleNoopCb;
defaultsPrototype.afterValidate = lifecycleNoopCb;
defaultsPrototype.beforeCreate = lifecycleNoopCb;
defaultsPrototype.afterCreate = lifecycleNoopCb;
defaultsPrototype.beforeUpdate = lifecycleNoopCb;
defaultsPrototype.afterUpdate = lifecycleNoopCb;
defaultsPrototype.beforeDestroy = lifecycleNoopCb;
defaultsPrototype.afterDestroy = lifecycleNoopCb;
defaultsPrototype.beforeInject = lifecycleNoop;
defaultsPrototype.afterInject = lifecycleNoop;
function DS(options) {
this.store = {};
this.definitions = {};
this.adapters = {};
this.defaults = new Defaults();
DSUtils.deepMixIn(this.defaults, options);
}
var dsPrototype = DS.prototype;
dsPrototype.getAdapter = function (def, options) {
options = options || {};
return this.adapters[options.adapter] || this.adapters[def.defaultAdapter];
};
dsPrototype.notify = function (definition, event) {
var args = Array.prototype.slice.call(arguments, 2);
args.unshift(definition.name);
args.unshift('DS.' + event);
definition.emit.apply(definition, args);
};
dsPrototype.errors = require('../errors');
dsPrototype.utils = DSUtils;
DSUtils.deepMixIn(dsPrototype, syncMethods);
DSUtils.deepMixIn(dsPrototype, asyncMethods);
module.exports = DS;
},{"../errors":76,"../utils":78,"./async_methods":60,"./sync_methods":70}],66:[function(require,module,exports){
/*jshint evil:true*/
var DSUtils = require('../../utils');
var DSErrors = require('../../errors');
function Resource(options) {
DSUtils.deepMixIn(this, options);
if ('endpoint' in options) {
this.endpoint = options.endpoint;
} else {
this.endpoint = this.name;
}
}
var methodsToProxy = [
'changes',
'changeHistory',
'create',
'createInstance',
'destroy',
'destroyAll',
'eject',
'ejectAll',
'filter',
'find',
'findAll',
'get',
'hasChanges',
'inject',
'lastModified',
'lastSaved',
'link',
'linkAll',
'linkInverse',
'loadRelations',
'previous',
'refresh',
'save',
'unlinkInverse',
'update',
'updateAll'
];
function defineResource(definition) {
var _this = this;
var definitions = _this.definitions;
if (DSUtils.isString(definition)) {
definition = {
name: definition.replace(/\s/gi, '')
};
}
if (!DSUtils.isObject(definition)) {
throw new DSErrors.IA('"definition" must be an object!');
} else if (!DSUtils.isString(definition.name)) {
throw new DSErrors.IA('"name" must be a string!');
} else if (_this.store[definition.name]) {
throw new DSErrors.R(definition.name + ' is already registered!');
}
try {
// Inherit from global defaults
Resource.prototype = _this.defaults;
definitions[definition.name] = new Resource(definition);
var def = definitions[definition.name];
if (!DSUtils.isString(def.idAttribute)) {
throw new DSErrors.IA('"idAttribute" must be a string!');
}
// Setup nested parent configuration
if (def.relations) {
def.relationList = [];
def.relationFields = [];
DSUtils.forOwn(def.relations, function (relatedModels, type) {
DSUtils.forOwn(relatedModels, function (defs, relationName) {
if (!DSUtils.isArray(defs)) {
relatedModels[relationName] = [defs];
}
DSUtils.forEach(relatedModels[relationName], function (d) {
d.type = type;
d.relation = relationName;
d.name = def.name;
def.relationList.push(d);
def.relationFields.push(d.localField);
});
});
});
if (def.relations.belongsTo) {
DSUtils.forOwn(def.relations.belongsTo, function (relatedModel, modelName) {
DSUtils.forEach(relatedModel, function (relation) {
if (relation.parent) {
def.parent = modelName;
def.parentKey = relation.localKey;
}
});
});
}
DSUtils.deepFreeze(def.relations);
DSUtils.deepFreeze(def.relationList);
}
def.getEndpoint = function (attrs, options) {
var parent = this.parent;
var parentKey = this.parentKey;
var item;
var endpoint;
var thisEndpoint = options.endpoint || this.endpoint;
var parentDef = definitions[parent];
delete options.endpoint;
options = options || {};
options.params = options.params || {};
if (parent && parentKey && parentDef && options.params[parentKey] !== false) {
if (DSUtils.isNumber(attrs) || DSUtils.isString(attrs)) {
item = _this.get(this.name, attrs);
}
if (DSUtils.isObject(attrs) && parentKey in attrs) {
delete options.params[parentKey];
endpoint = DSUtils.makePath(parentDef.getEndpoint(attrs, options), attrs[parentKey], thisEndpoint);
} else if (item && parentKey in item) {
delete options.params[parentKey];
endpoint = DSUtils.makePath(parentDef.getEndpoint(attrs, options), item[parentKey], thisEndpoint);
} else if (options && options.params[parentKey]) {
endpoint = DSUtils.makePath(parentDef.getEndpoint(attrs, options), options.params[parentKey], thisEndpoint);
delete options.params[parentKey];
}
}
if (options.params[parentKey] === false) {
delete options.params[parentKey];
}
return endpoint || thisEndpoint;
};
// Remove this in v0.11.0 and make a breaking change notice
// the the `filter` option has been renamed to `defaultFilter`
if (def.filter) {
def.defaultFilter = def.filter;
delete def.filter;
}
// Create the wrapper class for the new resource
def.class = DSUtils.pascalCase(definition.name);
eval('function ' + def.class + '() {}');
def[def.class] = eval(def.class);
// Apply developer-defined methods
if (def.methods) {
DSUtils.deepMixIn(def[def.class].prototype, def.methods);
}
// Prepare for computed properties
if (def.computed) {
DSUtils.forOwn(def.computed, function (fn, field) {
if (DSUtils.isFunction(fn)) {
def.computed[field] = [fn];
fn = def.computed[field];
}
if (def.methods && field in def.methods) {
console.warn('Computed property "' + field + '" conflicts with previously defined prototype method!');
}
var deps;
if (fn.length === 1) {
var match = fn[0].toString().match(/function.*?\(([\s\S]*?)\)/);
deps = match[1].split(',');
def.computed[field] = deps.concat(fn);
fn = def.computed[field];
if (deps.length) {
console.warn('Use the computed property array syntax for compatibility with minified code!');
}
}
deps = fn.slice(0, fn.length - 1);
DSUtils.forEach(deps, function (val, index) {
deps[index] = val.trim();
});
fn.deps = DSUtils.filter(deps, function (dep) {
return !!dep;
});
});
def[def.class].prototype.DSCompute = function () {
return _this.compute(def.name, this);
};
}
// Initialize store data for the new resource
_this.store[def.name] = {
collection: [],
completedQueries: {},
pendingQueries: {},
index: {},
modified: {},
saved: {},
previousAttributes: {},
observers: {},
changeHistories: {},
changeHistory: [],
collectionModified: 0
};
// Proxy DS methods with shorthand ones
DSUtils.forEach(methodsToProxy, function (name) {
def[name] = function () {
var args = Array.prototype.slice.call(arguments);
args.unshift(def.name);
return _this[name].apply(_this, args);
};
});
def.beforeValidate = DSUtils.promisify(def.beforeValidate);
def.validate = DSUtils.promisify(def.validate);
def.afterValidate = DSUtils.promisify(def.afterValidate);
def.beforeCreate = DSUtils.promisify(def.beforeCreate);
def.afterCreate = DSUtils.promisify(def.afterCreate);
def.beforeUpdate = DSUtils.promisify(def.beforeUpdate);
def.afterUpdate = DSUtils.promisify(def.afterUpdate);
def.beforeDestroy = DSUtils.promisify(def.beforeDestroy);
def.afterDestroy = DSUtils.promisify(def.afterDestroy);
// Mix-in events
DSUtils.Events(def);
return def;
} catch (err) {
console.error(err);
delete definitions[definition.name];
delete _this.store[definition.name];
throw err;
}
}
module.exports = defineResource;
},{"../../errors":76,"../../utils":78}],67:[function(require,module,exports){
var DSUtils = require('../../utils');
var DSErrors = require('../../errors');
function eject(resourceName, id) {
var _this = this;
var definition = _this.definitions[resourceName];
var resource = _this.store[resourceName];
var item;
var found = false;
id = DSUtils.resolveId(definition, id);
if (!definition) {
throw new DSErrors.NER(resourceName);
} else if (!DSUtils.isString(id) && !DSUtils.isNumber(id)) {
throw new DSErrors.IA('"id" must be a string or a number!');
}
for (var i = 0; i < resource.collection.length; i++) {
if (resource.collection[i][definition.idAttribute] == id) {
item = resource.collection[i];
found = true;
break;
}
}
if (found) {
_this.unlinkInverse(definition.name, id);
resource.collection.splice(i, 1);
resource.observers[id].close();
delete resource.observers[id];
delete resource.index[id];
delete resource.previousAttributes[id];
delete resource.completedQueries[id];
delete resource.pendingQueries[id];
DSUtils.forEach(resource.changeHistories[id], function (changeRecord) {
DSUtils.remove(resource.changeHistory, changeRecord);
});
delete resource.changeHistories[id];
delete resource.modified[id];
delete resource.saved[id];
resource.collectionModified = DSUtils.updateTimestamp(resource.collectionModified);
_this.notify(definition, 'eject', item);
return item;
}
}
module.exports = eject;
},{"../../errors":76,"../../utils":78}],68:[function(require,module,exports){
var DSUtils = require('../../utils');
var DSErrors = require('../../errors');
function ejectAll(resourceName, params) {
var _this = this;
var definition = _this.definitions[resourceName];
params = params || {};
if (!definition) {
throw new DSErrors.NER(resourceName);
} else if (!DSUtils.isObject(params)) {
throw new DSErrors.IA('"params" must be an object!');
}
var resource = _this.store[resourceName];
if (DSUtils.isEmpty(params)) {
resource.completedQueries = {};
}
var queryHash = DSUtils.toJson(params);
var items = _this.filter(definition.name, params);
var ids = DSUtils.toLookup(items, definition.idAttribute);
DSUtils.forOwn(ids, function (item, id) {
_this.eject(definition.name, id);
});
delete resource.completedQueries[queryHash];
resource.collectionModified = DSUtils.updateTimestamp(resource.collectionModified);
_this.notify(definition, 'eject', items);
return items;
}
module.exports = ejectAll;
},{"../../errors":76,"../../utils":78}],69:[function(require,module,exports){
var DSUtils = require('../../utils');
var DSErrors = require('../../errors');
function filter(resourceName, params, options) {
var _this = this;
var definition = _this.definitions[resourceName];
options = options || {};
if (!definition) {
throw new DSErrors.NER(resourceName);
} else if (params && !DSUtils.isObject(params)) {
throw new DSErrors.IA('"params" must be an object!');
} else if (!DSUtils.isObject(options)) {
throw new DSErrors.IA('"options" must be an object!');
}
var resource = _this.store[resourceName];
// Protect against null
params = params || {};
if (!('allowSimpleWhere' in options)) {
options.allowSimpleWhere = true;
}
var queryHash = DSUtils.toJson(params);
if (!(queryHash in resource.completedQueries) && options.loadFromServer) {
// This particular query has never been completed
if (!resource.pendingQueries[queryHash]) {
// This particular query has never even been started
_this.findAll(resourceName, params, options);
}
}
return definition.defaultFilter.call(_this, resource.collection, resourceName, params, options);
}
module.exports = filter;
},{"../../errors":76,"../../utils":78}],70:[function(require,module,exports){
var observe = require('../../../lib/observe-js/observe-js');
var DSUtils = require('../../utils');
var DSErrors = require('../../errors');
function changes(resourceName, id) {
var _this = this;
var definition = _this.definitions[resourceName];
id = DSUtils.resolveId(definition, id);
if (!definition) {
throw new DSErrors.NER(resourceName);
} else if (!DSUtils.isString(id) && !DSUtils.isNumber(id)) {
throw new DSErrors.IA('"id" must be a string or a number!');
}
var item = _this.get(resourceName, id);
if (item) {
_this.store[resourceName].observers[id].deliver();
var diff = DSUtils.diffObjectFromOldObject(item, _this.store[resourceName].previousAttributes[id]);
DSUtils.forOwn(diff, function (changeset, name) {
var toKeep = [];
DSUtils.forOwn(changeset, function (value, field) {
if (!DSUtils.isFunction(value)) {
toKeep.push(field);
}
});
diff[name] = DSUtils.pick(diff[name], toKeep);
});
DSUtils.forEach(definition.relationFields, function (field) {
delete diff.added[field];
delete diff.removed[field];
delete diff.changed[field];
});
return diff;
}
}
function changeHistory(resourceName, id) {
var _this = this;
var definition = _this.definitions[resourceName];
var resource = _this.store[resourceName];
id = DSUtils.resolveId(definition, id);
if (resourceName && !_this.definitions[resourceName]) {
throw new DSErrors.NER(resourceName);
} else if (id && !DSUtils.isString(id) && !DSUtils.isNumber(id)) {
throw new DSErrors.IA('"id" must be a string or a number!');
}
if (!definition.keepChangeHistory) {
console.warn('changeHistory is disabled for this resource!');
} else {
if (resourceName) {
var item = _this.get(resourceName, id);
if (item) {
return resource.changeHistories[id];
}
} else {
return resource.changeHistory;
}
}
}
function createInstance(resourceName, attrs, options) {
var definition = this.definitions[resourceName];
attrs = attrs || {};
options = options || {};
if (!definition) {
throw new DSErrors.NER(resourceName);
} else if (attrs && !DSUtils.isObject(attrs)) {
throw new DSErrors.IA('"attrs" must be an object!');
} else if (!DSUtils.isObject(options)) {
throw new DSErrors.IA('"options" must be an object!');
}
if (!('useClass' in options)) {
options.useClass = definition.useClass;
}
var item;
if (options.useClass) {
var Constructor = definition[definition.class];
item = new Constructor();
} else {
item = {};
}
return DSUtils.deepMixIn(item, attrs);
}
function diffIsEmpty(diff) {
return !(DSUtils.isEmpty(diff.added) &&
DSUtils.isEmpty(diff.removed) &&
DSUtils.isEmpty(diff.changed));
}
function digest() {
observe.Platform.performMicrotaskCheckpoint();
}
function compute(resourceName, instance) {
var _this = this;
var definition = _this.definitions[resourceName];
instance = DSUtils.resolveItem(_this.store[resourceName], instance);
if (!definition) {
throw new DSErrors.NER(resourceName);
} else if (!DSUtils.isObject(instance) && !DSUtils.isString(instance) && !DSUtils.isNumber(instance)) {
throw new DSErrors.IA('"instance" must be an object, string or number!');
}
if (DSUtils.isString(instance) || DSUtils.isNumber(instance)) {
instance = _this.get(resourceName, instance);
}
DSUtils.forOwn(definition.computed, function (fn, field) {
DSUtils.compute.call(instance, fn, field, DSUtils);
});
return instance;
}
function get(resourceName, id, options) {
var _this = this;
options = options || {};
if (!_this.definitions[resourceName]) {
throw new DSErrors.NER(resourceName);
} else if (!DSUtils.isString(id) && !DSUtils.isNumber(id)) {
throw new DSErrors.IA('"id" must be a string or a number!');
} else if (!DSUtils.isObject(options)) {
throw new DSErrors.IA('"options" must be an object!');
}
// cache miss, request resource from server
var item = _this.store[resourceName].index[id];
if (!item && options.loadFromServer) {
_this.find(resourceName, id, options);
}
// return resource from cache
return item;
}
function hasChanges(resourceName, id) {
var _this = this;
id = DSUtils.resolveId(_this.definitions[resourceName], id);
if (!_this.definitions[resourceName]) {
throw new DSErrors.NER(resourceName);
}
// return resource from cache
if (_this.get(resourceName, id)) {
return diffIsEmpty(_this.changes(resourceName, id));
} else {
return false;
}
}
function lastModified(resourceName, id) {
var definition = this.definitions[resourceName];
var resource = this.store[resourceName];
id = DSUtils.resolveId(definition, id);
if (!definition) {
throw new DSErrors.NER(resourceName);
}
if (id) {
if (!(id in resource.modified)) {
resource.modified[id] = 0;
}
return resource.modified[id];
}
return resource.collectionModified;
}
function lastSaved(resourceName, id) {
var definition = this.definitions[resourceName];
var resource = this.store[resourceName];
id = DSUtils.resolveId(definition, id);
if (!definition) {
throw new DSErrors.NER(resourceName);
}
if (!(id in resource.saved)) {
resource.saved[id] = 0;
}
return resource.saved[id];
}
function previous(resourceName, id) {
var _this = this;
var definition = _this.definitions[resourceName];
var resource = _this.store[resourceName];
id = DSUtils.resolveId(definition, id);
if (!definition) {
throw new DSErrors.NER(resourceName);
} else if (!DSUtils.isString(id) && !DSUtils.isNumber(id)) {
throw new DSErrors.IA('"id" must be a string or a number!');
}
// return resource from cache
return resource.previousAttributes[id] ? DSUtils.merge({}, resource.previousAttributes[id]) : undefined;
}
module.exports = {
changes: changes,
changeHistory: changeHistory,
compute: compute,
createInstance: createInstance,
defineResource: require('./defineResource'),
digest: digest,
eject: require('./eject'),
ejectAll: require('./ejectAll'),
filter: require('./filter'),
get: get,
hasChanges: hasChanges,
inject: require('./inject'),
lastModified: lastModified,
lastSaved: lastSaved,
link: require('./link'),
linkAll: require('./linkAll'),
linkInverse: require('./linkInverse'),
previous: previous,
unlinkInverse: require('./unlinkInverse')
};
},{"../../../lib/observe-js/observe-js":1,"../../errors":76,"../../utils":78,"./defineResource":66,"./eject":67,"./ejectAll":68,"./filter":69,"./inject":71,"./link":72,"./linkAll":73,"./linkInverse":74,"./unlinkInverse":75}],71:[function(require,module,exports){
var DSUtils = require('../../utils');
var DSErrors = require('../../errors');
var observe = require('../../../lib/observe-js/observe-js');
var stack = 0;
var data = {
injectedSoFar: {}
};
function _getReactFunction(DS, definition, resource) {
return function _react(added, removed, changed, oldValueFn, firstTime) {
var target = this;
var item;
var innerId = (oldValueFn && oldValueFn(definition.idAttribute)) ? oldValueFn(definition.idAttribute) : target[definition.idAttribute];
DSUtils.forEach(definition.relationFields, function (field) {
delete added[field];
delete removed[field];
delete changed[field];
});
if (!DSUtils.isEmpty(added) || !DSUtils.isEmpty(removed) || !DSUtils.isEmpty(changed) || firstTime) {
item = DS.get(definition.name, innerId);
resource.modified[innerId] = DSUtils.updateTimestamp(resource.modified[innerId]);
resource.collectionModified = DSUtils.updateTimestamp(resource.collectionModified);
if (definition.keepChangeHistory) {
var changeRecord = {
resourceName: definition.name,
target: item,
added: added,
removed: removed,
changed: changed,
timestamp: resource.modified[innerId]
};
resource.changeHistories[innerId].push(changeRecord);
resource.changeHistory.push(changeRecord);
}
}
if (definition.computed) {
item = item || DS.get(definition.name, innerId);
DSUtils.forOwn(definition.computed, function (fn, field) {
var compute = false;
// check if required fields changed
DSUtils.forEach(fn.deps, function (dep) {
if (dep in added || dep in removed || dep in changed || !(field in item)) {
compute = true;
}
});
compute = compute || !fn.deps.length;
if (compute) {
DSUtils.compute.call(item, fn, field, DSUtils);
}
});
}
if (definition.relations) {
item = item || DS.get(definition.name, innerId);
DSUtils.forEach(definition.relationList, function (def) {
if (item[def.localField] && (def.localKey in added || def.localKey in removed || def.localKey in changed)) {
DS.link(definition.name, item[definition.idAttribute], [def.relation]);
}
});
}
if (definition.idAttribute in changed) {
console.error('Doh! You just changed the primary key of an object! ' +
'I don\'t know how to handle this yet, so your data for the "' + definition.name +
'" resource is now in an undefined (probably broken) state.');
}
};
}
function _inject(definition, resource, attrs, options) {
var _this = this;
var _react = _getReactFunction(_this, definition, resource, attrs, options);
var injected;
if (DSUtils.isArray(attrs)) {
injected = [];
for (var i = 0; i < attrs.length; i++) {
injected.push(_inject.call(_this, definition, resource, attrs[i], options));
}
} else {
// check if "idAttribute" is a computed property
var c = definition.computed;
var idA = definition.idAttribute;
if (c && c[idA]) {
var args = [];
DSUtils.forEach(c[idA].deps, function (dep) {
args.push(attrs[dep]);
});
attrs[idA] = c[idA][c[idA].length - 1].apply(attrs, args);
}
if (!(idA in attrs)) {
var error = new DSErrors.R(definition.name + '.inject: "attrs" must contain the property specified by `idAttribute`!');
console.error(error);
throw error;
} else {
try {
definition.beforeInject(definition.name, attrs);
var id = attrs[idA];
var item = _this.get(definition.name, id);
if (!item) {
if (options.useClass) {
if (attrs instanceof definition[definition.class]) {
item = attrs;
} else {
item = new definition[definition.class]();
}
} else {
item = {};
}
resource.previousAttributes[id] = {};
DSUtils.deepMixIn(item, attrs);
DSUtils.deepMixIn(resource.previousAttributes[id], attrs);
resource.collection.push(item);
resource.changeHistories[id] = [];
resource.observers[id] = new observe.ObjectObserver(item);
resource.observers[id].open(_react, item);
resource.index[id] = item;
_react.call(item, {}, {}, {}, null, true);
} else {
DSUtils.deepMixIn(item, attrs);
if (definition.resetHistoryOnInject) {
resource.previousAttributes[id] = {};
DSUtils.deepMixIn(resource.previousAttributes[id], attrs);
if (resource.changeHistories[id].length) {
DSUtils.forEach(resource.changeHistories[id], function (changeRecord) {
DSUtils.remove(resource.changeHistory, changeRecord);
});
resource.changeHistories[id].splice(0, resource.changeHistories[id].length);
}
}
resource.observers[id].deliver();
}
resource.saved[id] = DSUtils.updateTimestamp(resource.saved[id]);
definition.afterInject(definition.name, item);
injected = item;
} catch (err) {
console.error(err);
console.error('inject failed!', definition.name, attrs);
}
}
}
return injected;
}
function _injectRelations(definition, injected, options) {
var _this = this;
function _process(def, relationName, injected) {
var relationDef = _this.definitions[relationName];
if (relationDef && injected[def.localField] && !data.injectedSoFar[relationName + injected[def.localField][relationDef.idAttribute]]) {
try {
data.injectedSoFar[relationName + injected[def.localField][relationDef.idAttribute]] = 1;
injected[def.localField] = _this.inject(relationName, injected[def.localField], options);
} catch (err) {
console.error(definition.name + ': Failed to inject ' + def.type + ' relation: "' + relationName + '"!', err);
}
} else if (options.findBelongsTo && def.type === 'belongsTo') {
if (DSUtils.isArray(injected)) {
DSUtils.forEach(injected, function (injectedItem) {
_this.link(definition.name, injectedItem[definition.idAttribute], [relationName]);
});
} else {
_this.link(definition.name, injected[definition.idAttribute], [relationName]);
}
} else if ((options.findHasMany && def.type === 'hasMany') || (options.findHasOne && def.type === 'hasOne')) {
if (DSUtils.isArray(injected)) {
DSUtils.forEach(injected, function (injectedItem) {
_this.link(definition.name, injectedItem[definition.idAttribute], [relationName]);
});
} else {
_this.link(definition.name, injected[definition.idAttribute], [relationName]);
}
}
}
DSUtils.forEach(definition.relationList, function (def) {
if (DSUtils.isArray(injected)) {
DSUtils.forEach(injected, function (injectedI) {
_process(def, def.relation, injectedI);
});
} else {
_process(def, def.relation, injected);
}
});
}
function inject(resourceName, attrs, options) {
var _this = this;
var definition = _this.definitions[resourceName];
options = options || {};
if (!definition) {
throw new DSErrors.NER(resourceName);
} else if (!DSUtils.isObject(attrs) && !DSUtils.isArray(attrs)) {
throw new DSErrors.IA(resourceName + '.inject: "attrs" must be an object or an array!');
} else if (!DSUtils.isObject(options)) {
throw new DSErrors.IA('"options" must be an object!');
}
var injected;
stack++;
try {
if (!('useClass' in options)) {
options.useClass = definition.useClass;
}
injected = _inject.call(_this, definition, _this.store[resourceName], attrs, options);
if (definition.relations) {
_injectRelations.call(_this, definition, injected, options);
}
if (options.linkInverse) {
if (DSUtils.isArray(injected) && injected.length) {
_this.linkInverse(definition.name, injected[0][definition.idAttribute]);
} else {
_this.linkInverse(definition.name, injected[definition.idAttribute]);
}
}
_this.notify(definition, 'inject', injected);
stack--;
} catch (err) {
stack--;
throw err;
}
if (!stack) {
data.injectedSoFar = {};
}
return injected;
}
module.exports = inject;
},{"../../../lib/observe-js/observe-js":1,"../../errors":76,"../../utils":78}],72:[function(require,module,exports){
var DSUtils = require('../../utils');
var DSErrors = require('../../errors');
function link(resourceName, id, relations) {
var _this = this;
var definition = _this.definitions[resourceName];
relations = relations || [];
id = DSUtils.resolveId(definition, id);
if (!definition) {
throw new DSErrors.NER(resourceName);
} else if (!DSUtils.isString(id) && !DSUtils.isNumber(id)) {
throw new DSErrors.IA('"id" must be a string or a number!');
} else if (!DSUtils.isArray(relations)) {
throw new DSErrors.IA('"relations" must be an array!');
}
var linked = _this.get(resourceName, id);
if (linked) {
DSUtils.forEach(definition.relationList, function (def) {
var relationName = def.relation;
if (relations.length && !DSUtils.contains(relations, relationName)) {
return;
}
var params = {};
if (def.type === 'belongsTo') {
var parent = linked[def.localKey] ? _this.get(relationName, linked[def.localKey]) : null;
if (parent) {
linked[def.localField] = parent;
}
} else if (def.type === 'hasMany') {
params[def.foreignKey] = linked[definition.idAttribute];
linked[def.localField] = _this.defaults.constructor.prototype.defaultFilter.call(_this, _this.store[relationName].collection, relationName, params, { allowSimpleWhere: true });
} else if (def.type === 'hasOne') {
params[def.foreignKey] = linked[definition.idAttribute];
var children = _this.defaults.constructor.prototype.defaultFilter.call(_this, _this.store[relationName].collection, relationName, params, { allowSimpleWhere: true });
if (children.length) {
linked[def.localField] = children[0];
}
}
});
}
return linked;
}
module.exports = link;
},{"../../errors":76,"../../utils":78}],73:[function(require,module,exports){
var DSUtils = require('../../utils');
var DSErrors = require('../../errors');
function linkAll(resourceName, params, relations) {
var _this = this;
var definition = _this.definitions[resourceName];
relations = relations || [];
if (!definition) {
throw new DSErrors.NER(resourceName);
} else if (!DSUtils.isArray(relations)) {
throw new DSErrors.IA('"relations" must be an array!');
}
var linked = _this.filter(resourceName, params);
if (linked) {
DSUtils.forEach(definition.relationList, function (def) {
var relationName = def.relation;
if (relations.length && !DSUtils.contains(relations, relationName)) {
return;
}
if (def.type === 'belongsTo') {
DSUtils.forEach(linked, function (injectedItem) {
var parent = injectedItem[def.localKey] ? _this.get(relationName, injectedItem[def.localKey]) : null;
if (parent) {
injectedItem[def.localField] = parent;
}
});
} else if (def.type === 'hasMany') {
DSUtils.forEach(linked, function (injectedItem) {
var params = {};
params[def.foreignKey] = injectedItem[definition.idAttribute];
injectedItem[def.localField] = _this.defaults.constructor.prototype.defaultFilter.call(_this, _this.store[relationName].collection, relationName, params, { allowSimpleWhere: true });
});
} else if (def.type === 'hasOne') {
DSUtils.forEach(linked, function (injectedItem) {
var params = {};
params[def.foreignKey] = injectedItem[definition.idAttribute];
var children = _this.defaults.constructor.prototype.defaultFilter.call(_this, _this.store[relationName].collection, relationName, params, { allowSimpleWhere: true });
if (children.length) {
injectedItem[def.localField] = children[0];
}
});
}
});
}
return linked;
}
module.exports = linkAll;
},{"../../errors":76,"../../utils":78}],74:[function(require,module,exports){
var DSUtils = require('../../utils');
var DSErrors = require('../../errors');
function linkInverse(resourceName, id, relations) {
var _this = this;
var definition = _this.definitions[resourceName];
relations = relations || [];
id = DSUtils.resolveId(definition, id);
if (!definition) {
throw new DSErrors.NER(resourceName);
} else if (!DSUtils.isString(id) && !DSUtils.isNumber(id)) {
throw new DSErrors.IA('"id" must be a string or a number!');
} else if (!DSUtils.isArray(relations)) {
throw new DSErrors.IA('"relations" must be an array!');
}
var linked = _this.get(resourceName, id);
if (linked) {
DSUtils.forOwn(_this.definitions, function (d) {
DSUtils.forOwn(d.relations, function (relatedModels) {
DSUtils.forOwn(relatedModels, function (defs, relationName) {
if (relations.length && !DSUtils.contains(relations, d.name)) {
return;
}
if (definition.name === relationName) {
_this.linkAll(d.name, {}, [definition.name]);
}
});
});
});
}
return linked;
}
module.exports = linkInverse;
},{"../../errors":76,"../../utils":78}],75:[function(require,module,exports){
var DSUtils = require('../../utils');
var DSErrors = require('../../errors');
/**
* @doc method
* @id DS.sync methods:unlinkInverse
* @name unlinkInverse
* @description
* Find relations of the item with the given primary key that are already in the data store and _unlink_ this item from those
* relations. This unlinks links that would be created by `DS.linkInverse`.
*
* ## Signature:
* ```js
* DS.unlinkInverse(resourceName, id[, relations])
* ```
*
* ## Examples:
*
* Assume `organization` has `hasMany` relationship to `user` and `post` has a `belongsTo` relationship to `user`.
* ```js
* DS.get('organization', 5); // { id: 5, users: [{ organizationId: 5, id: 1 }] }
*
* // unlink user 1 from its relations
* DS.unlinkInverse('user', 1, ['organization']);
*
* DS.get('organization', 5); // { id: 5, users: [] }
* ```
*
* ## Throws
*
* - `{IllegalArgumentError}`
* - `{NonexistentResourceError}`
*
* @param {string} resourceName The resource type, e.g. 'user', 'comment', etc.
* @param {string|number} id The primary key of the item for which to unlink relations.
* @param {array=} relations The relations to be unlinked. If not provided then all relations will be unlinked. Default: `[]`.
* @returns {object|array} A reference to the item that has been unlinked.
*/
function unlinkInverse(resourceName, id, relations) {
var _this = this;
var definition = _this.definitions[resourceName];
relations = relations || [];
id = DSUtils.resolveId(definition, id);
if (!definition) {
throw new DSErrors.NER(resourceName);
} else if (!DSUtils.isString(id) && !DSUtils.isNumber(id)) {
throw new DSErrors.IA('"id" must be a string or a number!');
} else if (!DSUtils.isArray(relations)) {
throw new DSErrors.IA('"relations" must be an array!');
}
var linked = _this.get(resourceName, id);
if (linked) {
DSUtils.forOwn(_this.definitions, function (d) {
DSUtils.forOwn(d.relations, function (relatedModels) {
DSUtils.forOwn(relatedModels, function (defs, relationName) {
if (definition.name === relationName) {
DSUtils.forEach(defs, function (def) {
DSUtils.forEach(_this.store[def.name].collection, function (item) {
if (def.type === 'hasMany' && item[def.localField]) {
var index;
DSUtils.forEach(item[def.localField], function (subItem, i) {
if (subItem === linked) {
index = i;
}
});
item[def.localField].splice(index, 1);
} else if (item[def.localField] === linked) {
delete item[def.localField];
}
});
});
}
});
});
});
}
return linked;
}
module.exports = unlinkInverse;
},{"../../errors":76,"../../utils":78}],76:[function(require,module,exports){
function IllegalArgumentError(message) {
Error.call(this);
if (typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, this.constructor);
}
this.type = this.constructor.name;
this.message = message || 'Illegal Argument!';
}
IllegalArgumentError.prototype = Object.create(Error.prototype);
IllegalArgumentError.prototype.constructor = IllegalArgumentError;
function RuntimeError(message) {
Error.call(this);
if (typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, this.constructor);
}
this.type = this.constructor.name;
this.message = message || 'RuntimeError Error!';
}
RuntimeError.prototype = Object.create(Error.prototype);
RuntimeError.prototype.constructor = RuntimeError;
function NonexistentResourceError(resourceName) {
Error.call(this);
if (typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, this.constructor);
}
this.type = this.constructor.name;
this.message = (resourceName || '') + ' is not a registered resource!';
}
NonexistentResourceError.prototype = Object.create(Error.prototype);
NonexistentResourceError.prototype.constructor = NonexistentResourceError;
module.exports = {
IllegalArgumentError: IllegalArgumentError,
IA: IllegalArgumentError,
RuntimeError: RuntimeError,
R: RuntimeError,
NonexistentResourceError: NonexistentResourceError,
NER: NonexistentResourceError
};
},{}],77:[function(require,module,exports){
var DS = require('./datastore');
/**
* @doc overview
* @id js-data
* @name js-data
* @description
* __Version:__ 0.0.1
*
* ## Install
*
* `bower install --save js-data` or `npm install --save js-data`
*
* #### Manual download
* Download js-data from the [Releases](https://github.com/js-data/js-data/releases) section of the js-data GitHub project.
*
* - `DS`
* - `DSHttpAdapter`
* - `DSLocalStorageAdapter`
* - `DSUtils`
* - `DSErrors`
*
* [DS](/documentation/api/api/DS) is the Data Store itself, which you will inject often.
* [DSHttpAdapter](/documentation/api/api/DSHttpAdapter) is useful as a wrapper for `http` and is configurable.
* [DSLocalStorageAdapter](/documentation/api/api/DSLocalStorageAdapter) is useful as a wrapper for `localStorage` and is configurable.
* [DSUtils](/documentation/api/api/DSUtils) has some useful utility methods.
* [DSErrors](/documentation/api/api/DSErrors) provides references to the various errors thrown by the data store.
*/
module.exports = {
DS: DS,
createStore: function () {
return new DS();
},
DSUtils: require('./utils'),
DSErrors: require('./errors')
};
},{"./datastore":65,"./errors":76,"./utils":78}],78:[function(require,module,exports){
function Events(target) {
var events = {};
target = target || this;
target.on = function (type, func, ctx) {
events[type] = events[type] || [];
events[type].push({
f: func,
c: ctx
});
};
target.off = function (type, func) {
var listeners = events[type];
if (!listeners) {
events = {};
} else if (func) {
for (var i = 0; i < listeners.length; i++) {
if (listeners[i] === func) {
listeners.splice(i, 1);
break;
}
}
} else {
listeners.splice(0, listeners.length);
}
};
target.emit = function () {
var args = Array.prototype.slice.call(arguments);
var listeners = events[args.shift()] || [];
if (listeners) {
for (var i = 0; i < listeners.length; i++) {
listeners[i].f.apply(listeners[i].c, args);
}
}
};
}
module.exports = {
isBoolean: require('mout/lang/isBoolean'),
isString: require('mout/lang/isString'),
isArray: require('mout/lang/isArray'),
isObject: require('mout/lang/isObject'),
isNumber: require('mout/lang/isNumber'),
isFunction: require('mout/lang/isFunction'),
isEmpty: require('mout/lang/isEmpty'),
toJson: JSON.stringify,
fromJson: JSON.parse,
makePath: require('mout/string/makePath'),
upperCase: require('mout/string/upperCase'),
pascalCase: require('mout/string/pascalCase'),
deepMixIn: require('mout/object/deepMixIn'),
forOwn: require('mout/object/forOwn'),
forEach: require('mout/array/forEach'),
pick: require('mout/object/pick'),
set: require('mout/object/set'),
merge: require('mout/object/merge'),
contains: require('mout/array/contains'),
filter: require('mout/array/filter'),
toLookup: require('mout/array/toLookup'),
remove: require('mout/array/remove'),
slice: require('mout/array/slice'),
sort: require('mout/array/sort'),
resolveItem: function (resource, idOrInstance) {
if (resource && (this.isString(idOrInstance) || this.isNumber(idOrInstance))) {
return resource.index[idOrInstance] || idOrInstance;
} else {
return idOrInstance;
}
},
resolveId: function (definition, idOrInstance) {
if (this.isString(idOrInstance) || this.isNumber(idOrInstance)) {
return idOrInstance;
} else if (idOrInstance && definition) {
return idOrInstance[definition.idAttribute] || idOrInstance;
} else {
return idOrInstance;
}
},
updateTimestamp: function (timestamp) {
var newTimestamp = typeof Date.now === 'function' ? Date.now() : new Date().getTime();
if (timestamp && newTimestamp <= timestamp) {
return timestamp + 1;
} else {
return newTimestamp;
}
},
Promise: require('es6-promise').Promise,
deepFreeze: function deepFreeze(o) {
if (typeof Object.freeze === 'function') {
var prop, propKey;
Object.freeze(o); // First freeze the object.
for (propKey in o) {
prop = o[propKey];
if (!o.hasOwnProperty(propKey) || typeof prop !== 'object' || Object.isFrozen(prop)) {
// If the object is on the prototype, not an object, or is already frozen,
// skip it. Note that this might leave an unfrozen reference somewhere in the
// object if there is an already frozen object containing an unfrozen object.
continue;
}
deepFreeze(prop); // Recursively call deepFreeze.
}
}
},
compute: function (fn, field, DSUtils) {
var _this = this;
var args = [];
DSUtils.forEach(fn.deps, function (dep) {
args.push(_this[dep]);
});
// compute property
this[field] = fn[fn.length - 1].apply(this, args);
},
diffObjectFromOldObject: function (object, oldObject) {
var added = {};
var removed = {};
var changed = {};
for (var prop in oldObject) {
var newValue = object[prop];
if (newValue !== undefined && newValue === oldObject[prop])
continue;
if (!(prop in object)) {
removed[prop] = undefined;
continue;
}
if (newValue !== oldObject[prop])
changed[prop] = newValue;
}
for (var prop2 in object) {
if (prop2 in oldObject)
continue;
added[prop2] = object[prop2];
}
return {
added: added,
removed: removed,
changed: changed
};
},
promisify: function (fn, target) {
var Promise = this.Promise;
if (!fn) {
return;
} else if (typeof fn !== 'function') {
throw new Error('Can only promisify functions!');
}
return function () {
var args = Array.prototype.slice.apply(arguments);
return new Promise(function (resolve, reject) {
args.push(function (err, result) {
if (err) {
reject(err);
} else {
resolve(result);
}
});
try {
var promise = fn.apply(target || this, args);
if (promise && promise.then) {
promise.then(resolve, reject);
}
} catch (err) {
reject(err);
}
});
};
},
Events: Events
};
},{"es6-promise":2,"mout/array/contains":13,"mout/array/filter":14,"mout/array/forEach":15,"mout/array/remove":18,"mout/array/slice":19,"mout/array/sort":20,"mout/array/toLookup":21,"mout/lang/isArray":27,"mout/lang/isBoolean":28,"mout/lang/isEmpty":29,"mout/lang/isFunction":30,"mout/lang/isNumber":32,"mout/lang/isObject":33,"mout/lang/isString":35,"mout/object/deepMixIn":39,"mout/object/forOwn":41,"mout/object/merge":43,"mout/object/pick":46,"mout/object/set":47,"mout/string/makePath":50,"mout/string/pascalCase":51,"mout/string/upperCase":54}]},{},[77])(77)
});
|
src/index.js
|
tmcw/docbox
|
import 'babel-polyfill';
import React from 'react';
import ReactDOM from 'react-dom';
import App from './components/app';
import remark from 'remark';
import slug from 'remark-slug';
import content from './custom/content';
var ast = remark()
.use(slug)
.runSync(remark().parse(content));
ReactDOM.render(
<App ast={ast} content={content} />,
document.getElementById('app'));
|
example/CustomView.js
|
Chatnbook/react-native-gifted-chat
|
import PropTypes from 'prop-types';
import React from 'react';
import {
Linking,
Platform,
StyleSheet,
TouchableOpacity,
ViewPropTypes,
} from 'react-native';
import MapView from 'react-native-maps';
export default class CustomView extends React.Component {
render() {
if (this.props.currentMessage.location) {
return (
<TouchableOpacity style={[styles.container, this.props.containerStyle]} onPress={() => {
const url = Platform.select({
ios: `http://maps.apple.com/?ll=${this.props.currentMessage.location.latitude},${this.props.currentMessage.location.longitude}`,
android: `http://maps.google.com/?q=${this.props.currentMessage.location.latitude},${this.props.currentMessage.location.longitude}`
});
Linking.canOpenURL(url).then(supported => {
if (supported) {
return Linking.openURL(url);
}
}).catch(err => {
console.error('An error occurred', err);
});
}}>
<MapView
style={[styles.mapView, this.props.mapViewStyle]}
region={{
latitude: this.props.currentMessage.location.latitude,
longitude: this.props.currentMessage.location.longitude,
latitudeDelta: 0.0922,
longitudeDelta: 0.0421,
}}
scrollEnabled={false}
zoomEnabled={false}
/>
</TouchableOpacity>
);
}
return null;
}
}
const styles = StyleSheet.create({
container: {
},
mapView: {
width: 150,
height: 100,
borderRadius: 13,
margin: 3,
},
});
CustomView.defaultProps = {
currentMessage: {},
containerStyle: {},
mapViewStyle: {},
};
CustomView.propTypes = {
currentMessage: PropTypes.object,
containerStyle: ViewPropTypes.style,
mapViewStyle: ViewPropTypes.style,
};
|
src/components/Tasks/Tasks.js
|
Gtallant/my-life-organizer
|
import React, { Component } from 'react';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import s from './Tasks.scss';
import { List, ListItem } from 'material-ui/List';
import Checkbox from 'material-ui/Checkbox';
import Badge from 'material-ui/Badge';
import IconButton from 'material-ui/IconButton';
import HelpIcon from 'material-ui/svg-icons/action/help';
import ReportIcon from 'material-ui/svg-icons/content/report';
import Dialog from 'material-ui/Dialog';
import FlatButton from 'material-ui/FlatButton';
// const moment = require('moment');
import { host } from '../../config';
const req = require('request-promise');
let initilized = false;
// ------------ Helper Functions ------------
function getTasks(component) {
const win = window.location.href.split('/');
const path = (win ? `${win[0]}//${win[2]}` : host);
req(`${path}/api/tasks/work`, (error, response, body) => {
if (error) {
return;
}
const tasks = JSON.parse(body).filter((t) => {
const isTask = t.fields.type === 'Task';
return isTask;
});
const blockers = JSON.parse(body).filter((t) => {
const isTask = t.fields.type === 'Blocker';
return isTask;
});
const questions = JSON.parse(body).filter((t) => {
const isTask = t.fields.type === 'Question';
return isTask;
});
component.setState({ tasks, blockers, questions });
});
}
// ------------ Component ------------
class CalendarCard extends Component {
constructor(props) {
super(props);
this.state = {
tasks: [],
blockers: [],
questions: [],
modal: false,
};
}
componentDidMount() {
const component = this;
// const midnight = moment().add(1, 'day').startOf('day');
// const msToMidnight = midnight.valueOf() - moment().valueOf();
if (!initilized) {
getTasks(component);
initilized = true;
}
this.timerID = setInterval(
() => getTasks(this),
1000 // length of time until midnight
);
}
componentWillUnmount() {
clearInterval(this.timerID);
}
openModal(e, type) {
this.setState({
modal: type,
});
}
closeModal() {
this.setState({
modal: false,
});
}
completeTask(task) {
const win = window.location.href.split('/');
const path = (win ? `${win[0]}//${win[2]}` : host);
req(`${path}/api/tasks/work/complete/${task.id}`, (error) => {
if (error) {
console.log(error);
return;
}
getTasks(this);
});
}
render() {
const tasks = this.state.tasks.map((t) =>
<ListItem
key={t.id}
leftCheckbox={<Checkbox onCheck={() => this.completeTask(t)} />}
primaryText={t.fields.Text}
secondaryText={t.fields.Note}
/>
);
const badgeStyles = {
top: 4,
right: 4,
height: '16px',
width: '16px',
};
const badgeWrapperStyle = {
padding: '8px 8px 0px 0px',
};
const actions = [
<FlatButton
label="Close"
primary
onTouchTap={(e) => this.closeModal(e)}
/>,
];
const open = this.state.modal !== false;
let modalList = [];
let modalTitle = '';
if (open) {
modalTitle = this.state.modal[0].toUpperCase() + this.state.modal.substring(1);
let modalIcon = this.state.modal === 'questions' ? <HelpIcon /> : <ReportIcon />;
modalList = this.state[this.state.modal].map((i) =>
<ListItem
key={i.id}
primaryText={i.fields.Text}
secondaryText={i.fields.Note}
leftCheckbox={<Checkbox
checkedIcon={modalIcon}
uncheckedIcon={modalIcon}
onCheck={() => this.completeTask(i)}
/>}
leftIcon={this.state.modal === 'questions' ? <HelpIcon /> : <ReportIcon /> }
/>
);
}
return (
<div>
<List>{tasks}</List>
<div className={s.icons}>
<Badge
badgeContent={this.state.questions.length}
badgeStyle={badgeStyles}
style={badgeWrapperStyle}
secondary
>
<IconButton onTouchTap={(e) => this.openModal(e, 'questions')}>
<HelpIcon style={{ padding: 0 }} />
</IconButton>
</Badge>
<Badge
badgeContent={this.state.blockers.length}
badgeStyle={badgeStyles}
style={badgeWrapperStyle}
secondary
>
<IconButton onTouchTap={(e) => this.openModal(e, 'blockers')}>
<ReportIcon
style= {{
padding: 0,
width: '28px',
height: '28px',
}}
/>
</IconButton>
</Badge>
</div>
<Dialog
title={modalTitle}
actions={actions}
modal={false}
open={open}
onRequestClose={(e) => this.closeModal(e)}
>
<List>{modalList}</List>
</Dialog>
</div>
);
}
}
export default withStyles(CalendarCard, s);
|
src/app/components/BrowserSupport.js
|
meedan/check-web
|
import React, { Component } from 'react';
import { FormattedMessage, injectIntl } from 'react-intl';
import styled from 'styled-components';
import IconButton from '@material-ui/core/IconButton';
import ClearIcon from '@material-ui/icons/Clear';
import { mapGlobalMessage } from './MappedMessage';
import {
ContentColumn,
units,
black54,
white,
} from '../styles/js/shared';
const Message = styled.div`
padding: ${units(1)};
color: ${black54};
background-color: ${white};
> div {
display: flex;
align-items: center;
}
// Not sure why this is necessary for vertical alignment.
// Is there a bug in IconButton? I think we are using it correctly.
// - CGB 2017-7-12
//
button > div {
display: flex;
align-items: center;
}
`;
class BrowserSupport extends Component {
static supported() {
const ua = navigator.userAgent;
if (/Chrome/i.test(ua) && !/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobile|mobile|CriOS/i.test(ua)) {
return true;
}
return false;
}
static closed() {
return window.storage.getValue('close-unsupported-browser-message') === '1';
}
static shouldShowMessage() {
return !BrowserSupport.supported() && !BrowserSupport.closed() && window.parent === window;
}
close() {
window.storage.set('close-unsupported-browser-message', '1');
this.forceUpdate();
}
render() {
if (BrowserSupport.shouldShowMessage()) {
return (
<Message>
<ContentColumn>
<IconButton style={{ fontSize: '20px', color: black54 }} onClick={this.close.bind(this)}>
<ClearIcon />
</IconButton>
<div>
<FormattedMessage id="browserSupport.message" defaultMessage="{appName} is optimized for Google Chrome on desktop." values={{ appName: mapGlobalMessage(this.props.intl, 'appNameHuman') }} />
</div>
</ContentColumn>
</Message>
);
}
return null;
}
}
export default injectIntl(BrowserSupport);
|
src/content/work/assets/SubscriptionsForSaas/modules/List/Icons/Pause/index.js
|
jmikrut/keen-2017
|
import React from 'react';
import './Pause.css';
export default (props) => {
let color = props.color ? props.color : '';
return (
<svg className="plus" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12">
<line stroke={color} x1="4.76" y1="3.76" x2="4.76" y2="8.24"/>
<line stroke={color} x1="7.24" y1="8.24" x2="7.24" y2="3.76"/>
</svg>
);
}
|
app/containers/Transactions/ui/layout/TransactionLayout.js
|
sahilkhan99/PosApp
|
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import TransactionsTableComponent from 'containers/Transactions/ui/components/TransactionsTableComponent';
import TransactionSummaryComponent from 'containers/Transactions/ui/components/TransactionSummaryComponent';
import TransactionPaymentComponent from 'containers/Transactions/ui/components/TransactionPaymentComponent';
import { FormGroup, InputGroup, FormControl, Button } from 'react-bootstrap';
class TransactionLayout extends Component {
constructor(props) {
super(props);
}
handleOnToggleClick = () => {
if (this.props.onToggleSideNavClick)
this.props.onToggleSideNavClick();
}
handleOnMenuClick = () => {
if (this.props.onMenuClick) {
this.props.onMenuClick();
}
}
render() {
const { transactions } = this.props;
console.log("printing transactions");
console.log(transactions);
return (
<div id="page-wrapper">
<div className="row">
{/*left side transactions component*/}
<div className="col-lg-8">
<div className="app-theme-main-right-border">
<div className="form-group">
<InputGroup>
<FormControl type="text" placeholder="search/add items" />
<InputGroup.Addon>
<button type="button" className="btn btn-xs">
<span className="fa fa-plus-square fa-1x"></span>
</button>
</InputGroup.Addon>
</InputGroup>
</div>
{/*Eof Search and add item*/}
<TransactionsTableComponent transactions={transactions} />
<TransactionSummaryComponent />
</div>
</div>
{/*Right side checkout component*/}
<div className="col-lg-4 app-theme-main-row-no-left-margin">
<TransactionPaymentComponent />
</div>
</div>
</div>
);
}
}
TransactionLayout.propTypes = {
transactions: PropTypes.array,
onMenuClick: PropTypes.func,
toggleSideNav: PropTypes.bool,
};
export default TransactionLayout;
|
node_modules/react-icons/md/looks-6.js
|
bengimbel/Solstice-React-Contacts-Project
|
import React from 'react'
import Icon from 'react-icon-base'
const MdLooks6 = props => (
<Icon viewBox="0 0 40 40" {...props}>
<g><path d="m25 15v-3.4h-6.6c-1.8 0-3.4 1.5-3.4 3.4v10c0 1.9 1.6 3.4 3.4 3.4h3.2c1.8 0 3.4-1.5 3.4-3.4v-3.4c0-1.8-1.6-3.2-3.4-3.2h-3.2v-3.4h6.6z m6.6-10c1.8 0 3.4 1.6 3.4 3.4v23.2c0 1.8-1.6 3.4-3.4 3.4h-23.2c-1.8 0-3.4-1.6-3.4-3.4v-23.2c0-1.8 1.6-3.4 3.4-3.4h23.2z m-13.2 20v-3.4h3.2v3.4h-3.2z"/></g>
</Icon>
)
export default MdLooks6
|
webpack/scenes/Subscriptions/components/SubscriptionsTable/components/Table.js
|
pmoravec/katello
|
import React from 'react';
import PropTypes from 'prop-types';
import { Table as PFtable } from 'patternfly-react';
import { translate as __ } from 'foremanReact/common/I18n';
import classNames from 'classnames';
import { createSubscriptionsTableSchema } from '../SubscriptionsTableSchema';
import { Table as ForemanTable, TableBody as ForemanTableBody } from '../../../../../move_to_foreman/components/common/table';
const Table = ({
emptyState,
tableColumns,
subscriptions,
loadSubscriptions,
selectionController,
inlineEditController,
rows,
editing,
groupedSubscriptions,
toggleSubscriptionGroup,
canManageSubscriptionAllocations,
}) => {
const allSubscriptionResults = subscriptions.results;
let bodyMessage;
if (allSubscriptionResults.length === 0 && subscriptions.searchIsActive) {
bodyMessage = __('No subscriptions match your search criteria.');
}
const groupingController = {
isCollapseable: ({ rowData }) =>
// the group contains more then one subscription
rowData.collapsible,
isCollapsed: ({ rowData }) => !groupedSubscriptions[rowData.product_id].open,
toggle: ({ rowData }) => toggleSubscriptionGroup(rowData.product_id),
};
const alwaysDisplayColumns = ['select'];
const columnsDefinition = createSubscriptionsTableSchema(
inlineEditController,
selectionController,
groupingController,
canManageSubscriptionAllocations,
).filter(column => tableColumns.includes(column.property) ||
alwaysDisplayColumns.includes(column.property));
const onPaginationChange = (pagination) => {
loadSubscriptions({
...pagination,
});
};
return (
<ForemanTable
columns={columnsDefinition}
emptyState={emptyState}
bodyMessage={bodyMessage}
rows={rows}
components={{
header: {
row: PFtable.TableInlineEditHeaderRow,
},
}}
itemCount={subscriptions.itemCount}
pagination={subscriptions.pagination}
onPaginationChange={onPaginationChange}
inlineEdit
>
<PFtable.Header
onRow={() => ({
role: 'row',
isEditing: () => editing,
onCancel: () => inlineEditController.onCancel(),
onConfirm: () => inlineEditController.onConfirm(),
})}
/>
<ForemanTableBody
columns={columnsDefinition}
rows={rows}
rowKey="id"
message={bodyMessage}
onRow={rowData => ({
className: classNames({ 'open-grouped-row': !groupingController.isCollapsed({ rowData }) }),
})}
/>
</ForemanTable>
);
};
Table.propTypes = {
canManageSubscriptionAllocations: PropTypes.bool,
emptyState: PropTypes.shape({}).isRequired,
tableColumns: PropTypes.arrayOf(PropTypes.string).isRequired,
subscriptions: PropTypes.shape({
searchIsActive: PropTypes.bool,
itemCount: PropTypes.number,
pagination: PropTypes.shape({}),
results: PropTypes.array,
}).isRequired,
loadSubscriptions: PropTypes.func.isRequired,
toggleSubscriptionGroup: PropTypes.func.isRequired,
selectionController: PropTypes.shape({}).isRequired,
inlineEditController: PropTypes.shape({
onCancel: PropTypes.func,
onConfirm: PropTypes.func,
}).isRequired,
groupedSubscriptions: PropTypes.shape({}).isRequired,
editing: PropTypes.bool.isRequired,
rows: PropTypes.arrayOf(PropTypes.object).isRequired,
};
Table.defaultProps = {
canManageSubscriptionAllocations: false,
};
export default Table;
|
npm-scripts/modules/RouteUtils.js
|
zipongo/react-router
|
import React from 'react'
import warning from 'warning'
function isValidChild(object) {
return object == null || React.isValidElement(object)
}
export function isReactChildren(object) {
return isValidChild(object) || (Array.isArray(object) && object.every(isValidChild))
}
function checkPropTypes(componentName, propTypes, props) {
componentName = componentName || 'UnknownComponent'
for (const propName in propTypes) {
if (propTypes.hasOwnProperty(propName)) {
const error = propTypes[propName](props, propName, componentName)
/* istanbul ignore if: error logging */
if (error instanceof Error)
warning(false, error.message)
}
}
}
function createRoute(defaultProps, props) {
return { ...defaultProps, ...props }
}
export function createRouteFromReactElement(element) {
const type = element.type
const route = createRoute(type.defaultProps, element.props)
if (type.propTypes)
checkPropTypes(type.displayName || type.name, type.propTypes, route)
if (route.children) {
const childRoutes = createRoutesFromReactChildren(route.children, route)
if (childRoutes.length)
route.childRoutes = childRoutes
delete route.children
}
return route
}
/**
* Creates and returns a routes object from the given ReactChildren. JSX
* provides a convenient way to visualize how routes in the hierarchy are
* nested.
*
* import { Route, createRoutesFromReactChildren } from 'react-router'
*
* const routes = createRoutesFromReactChildren(
* <Route component={App}>
* <Route path="home" component={Dashboard}/>
* <Route path="news" component={NewsFeed}/>
* </Route>
* )
*
* Note: This method is automatically used when you provide <Route> children
* to a <Router> component.
*/
export function createRoutesFromReactChildren(children, parentRoute) {
const routes = []
React.Children.forEach(children, function (element) {
if (React.isValidElement(element)) {
// Component classes may have a static create* method.
if (element.type.createRouteFromReactElement) {
const route = element.type.createRouteFromReactElement(element, parentRoute)
if (route)
routes.push(route)
} else {
routes.push(createRouteFromReactElement(element))
}
}
})
return routes
}
/**
* Creates and returns an array of routes from the given object which
* may be a JSX route, a plain object route, or an array of either.
*/
export function createRoutes(routes) {
if (isReactChildren(routes)) {
routes = createRoutesFromReactChildren(routes)
} else if (routes && !Array.isArray(routes)) {
routes = [ routes ]
}
return routes
}
|
src/TimePicker/TimePicker.js
|
skarnecki/material-ui
|
import React from 'react';
import warning from 'warning';
import TimePickerDialog from './TimePickerDialog';
import TextField from '../TextField';
import {formatTime} from './timeUtils';
const emptyTime = new Date();
emptyTime.setHours(0);
emptyTime.setMinutes(0);
emptyTime.setSeconds(0);
emptyTime.setMilliseconds(0);
class TimePicker extends React.Component {
static propTypes = {
/**
* If true, automatically accept and close the picker on set minutes.
*/
autoOk: React.PropTypes.bool,
/**
* Override the label of the 'Cancel' button.
*/
cancelLabel: React.PropTypes.node,
/**
* The initial time value of the TimePicker.
*/
defaultTime: React.PropTypes.object,
/**
* If true, the TimePicker is disabled.
*/
disabled: React.PropTypes.bool,
/**
* Tells the component to display the picker in `ampm` (12hr) format or `24hr` format.
*/
format: React.PropTypes.oneOf(['ampm', '24hr']),
/**
* Override the label of the 'OK' button.
*/
okLabel: React.PropTypes.node,
/**
* Callback function that is fired when the time value changes. The time value is passed in a Date Object.
* Since there is no particular event associated with the change the first argument will always be null
* and the second argument will be the new Date instance.
*/
onChange: React.PropTypes.func,
/**
* Callback function fired when the TimePicker dialog is dismissed.
*/
onDismiss: React.PropTypes.func,
/**
* Callback function fired when the TimePicker `TextField` gains focus.
*/
onFocus: React.PropTypes.func,
/**
* Callback function fired when the TimePicker dialog is shown.
*/
onShow: React.PropTypes.func,
/**
* Callback function fired when the TimePicker is tapped or clicked.
*/
onTouchTap: React.PropTypes.func,
/**
* If true, uses ("noon" / "midnight") instead of ("12 a.m." / "12 p.m.").
*
* It's technically more correct to refer to "12 noon" and "12 midnight" rather than "12 a.m." and "12 p.m."
* and it avoids confusion between different locales. By default (for compatibility reasons) TimePicker uses
* ("12 a.m." / "12 p.m.").
*/
pedantic: React.PropTypes.bool,
/**
* Override the inline-styles of the root element.
*/
style: React.PropTypes.object,
/**
* Override the inline-styles of TimePicker's TextField element.
*/
textFieldStyle: React.PropTypes.object,
/**
* Sets the time for the Time Picker programmatically.
*/
value: React.PropTypes.object,
};
static defaultProps = {
defaultTime: null,
disabled: false,
format: 'ampm',
pedantic: false,
autoOk: false,
style: {},
okLabel: 'OK',
cancelLabel: 'Cancel',
};
static contextTypes = {
muiTheme: React.PropTypes.object.isRequired,
};
state = {
time: this.isControlled() ? this.getControlledTime() : this.props.defaultTime,
dialogTime: new Date(),
};
componentWillReceiveProps(nextProps) {
if (nextProps.value !== this.props.value) {
this.setState({
time: this.getControlledTime(nextProps),
});
}
}
/**
* Deprecated.
* returns timepicker value.
**/
getTime() {
warning(false, `getTime() method is deprecated. Use the defaultTime property
instead. Or use the TimePicker as a controlled component with the value
property.`);
return this.state.time;
}
/**
* Deprecated
* sets timepicker value.
**/
setTime(time) {
warning(false, `setTime() method is deprecated. Use the defaultTime property
instead. Or use the TimePicker as a controlled component with the value
property.`);
this.setState({time: time ? time : emptyTime});
}
/**
* Alias for `openDialog()` for an api consistent with TextField.
*/
focus() {
this.openDialog();
}
openDialog() {
this.setState({
dialogTime: this.state.time,
});
this.refs.dialogWindow.show();
}
handleAcceptDialog = (time) => {
this.setState({
time: time,
});
if (this.props.onChange) this.props.onChange(null, time);
};
handleFocusInput = (event) => {
event.target.blur();
if (this.props.onFocus) this.props.onFocus(event);
};
handleTouchTapInput = (event) => {
event.preventDefault();
if (!this.props.disabled) this.openDialog();
if (this.props.onTouchTap) this.props.onTouchTap(event);
};
isControlled() {
return this.props.value !== null;
}
getControlledTime(props = this.props) {
let result = null;
if (props.value instanceof Date) {
result = props.value;
}
return result;
}
render() {
const {
autoOk,
cancelLabel,
format,
okLabel,
onFocus, // eslint-disable-line no-unused-vars
onTouchTap, // eslint-disable-line no-unused-vars
onShow,
onDismiss,
pedantic,
style,
textFieldStyle,
...other,
} = this.props;
const {prepareStyles} = this.context.muiTheme;
const {time} = this.state;
return (
<div style={prepareStyles(Object.assign({}, style))}>
<TextField
{...other}
style={textFieldStyle}
ref="input"
value={time === emptyTime ? null : formatTime(time, format, pedantic)}
onFocus={this.handleFocusInput}
onTouchTap={this.handleTouchTapInput}
/>
<TimePickerDialog
ref="dialogWindow"
initialTime={this.state.dialogTime}
onAccept={this.handleAcceptDialog}
onShow={onShow}
onDismiss={onDismiss}
format={format}
okLabel={okLabel}
cancelLabel={cancelLabel}
autoOk={autoOk}
/>
</div>
);
}
}
export default TimePicker;
|
frontend/entry.js
|
ted-eckel/in1box
|
import React from 'react'
import ReactDOM from 'react-dom'
import configureStore from './store'
import Root from './components/Root'
import merge from 'lodash/merge'
document.addEventListener('DOMContentLoaded', () => {
let store;
let preloadedState = {};
if (window.currentUser) {
// const preloadedState = { session: { currentUser: window.currentUser } };
merge(preloadedState, { session: { currentUser: window.currentUser } })
}
if (window.pocketAuthorized === true) {
merge(preloadedState, { pocket: { authorization: { isAuthorized: true } } })
}
if (window.pocketAuthorized === false) {
merge(preloadedState, { pocket: { authorization: { isAuthorized: false } } })
}
store = configureStore(preloadedState);
// } else {
// store = configureStore();
// }
let root = document.getElementById('root');
if (root){
ReactDOM.render(<Root store={ store }/>, root);
}
});
|
include/javascript/yui/build/container/container.js
|
EGRTsales/openCRM
|
/*
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);
}
};
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 ) {
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();
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();
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();
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;
}
}
}
}
}
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 {
}
};
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)) {
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");
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) {
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.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);
}
},
/**
* 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.showProcId = null;
}
if (obj.hideProcId) {
clearTimeout(obj.hideProcId);
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.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();
}, 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;
return setTimeout(function () {
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;
if (elementRegion.contains(mousePoint)) {
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) {
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) {
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"});
|
components/User/SSO.js
|
slidewiki/slidewiki-platform
|
import PropTypes from 'prop-types';
import React from 'react';
import ReactDOM from 'react-dom';
import {connectToStores} from 'fluxible-addons-react';
import {publicRecaptchaKey} from '../../configs/general';
import SSOStore from '../../stores/SSOStore';
import ReCAPTCHA from 'react-google-recaptcha';
import {hashPassword} from '../../configs/general';
import instances from '../../configs/instances.js';
import SSOSingIn from '../../actions/user/SSOSingIn';
import {FormattedMessage, defineMessages} from 'react-intl';
import {Accordion, Icon} from 'semantic-ui-react';
const MODI = 'sso_modi';
const NAME = 'sso_data';
class SSO extends React.Component {
constructor(props) {
super(props);
this.state = {
grecaptcharesponse: null,
activeIndex: 0
};
this.errorMessages = defineMessages({
error403: {
id: 'SSOSignIn.errormessage.isSPAM',
defaultMessage: 'Your account was marked as SPAM thus you are not able to sign in. Contact us directly for reactivation.'
},
error404: {
id: 'SSOSignIn.errormessage.credentialsNotFound',
defaultMessage: 'The credentials are unknown. Please retry with another input.'
},
error423: {
id: 'SSOSignIn.errormessage.deactivatedOrUnactivated',
defaultMessage: 'Your user account either have to be activated via the activation link in your email or is deactivated in general.'
}
});
}
componentDidMount() {
//Form validation
const validationRules = {
fields: {
password: {
identifier: 'password',
rules: [{
type: 'empty',
prompt: 'Please enter a password'
}, {
type: 'minLength[8]',
prompt: 'Your password should contain 8 characters or more'
}]
},
recaptcha: {
identifier: 'recaptcha',
rules: [{
type: 'recaptcha',
prompt: 'Please verify that you are a human'
}]
}
},
onSuccess: this.handleSignIn.bind(this)
};
// Custom form validation rule for checking if recaptcha is solved
$.fn.form.settings.rules.recaptcha = (() => {
return (this.state !== null && this.state.grecaptcharesponse !== undefined);
});
$(ReactDOM.findDOMNode(this.refs.SSO_form)).form(validationRules);
if (this.props.SSOStore && !instances[this.props.SSOStore.instance]) {
console.log('Wrong instance name:', this.props.SSOStore.instance);
swal({
title: 'Problem with the URL',
text: 'The URL has to contain a valid instance shortcut. '+this.props.SSOStore.instance+' is an unknown shortcut.',
type: 'error',
confirmButtonText: 'Confirm',
confirmButtonClass: 'negative ui button',
buttonsStyling: false
}).then().catch();
}
}
componentDidUpdate() {
if (this.props.SSOStore.errorMessage.length > 2)
$('.ui.form.ssosignin').form('add errors', [this.props.SSOStore.errorMessage]);
}
componentWillReceiveProps(nextProps) {
// console.log('changed jwt from to', this.props.SSOStore.jwt, nextProps.SSOStore.jwt);
if (nextProps.SSOStore.jwt !== '' && nextProps.SSOStore.jwt !== this.props.SSOStore.jwt) {
location.replace(instances[nextProps.SSOStore.instance].validate + '?instance=' + instances._self + '&jwt=' + encodeURIComponent(nextProps.SSOStore.jwt) + '&userid=' + nextProps.SSOStore.userid);
}
}
handleSignIn(e) {
e.preventDefault();
if (!instances[this.props.SSOStore.instance])
return;
let data = {
password: hashPassword(this.refs.password.value),
grecaptcharesponse: this.state.grecaptcharesponse,
email: this.props.SSOStore.email,
errorMessages: {
error403: this.context.intl.formatMessage(this.errorMessages.error403),
error404: this.context.intl.formatMessage(this.errorMessages.error404),
error423: this.context.intl.formatMessage(this.errorMessages.error423)
}
};
this.context.executeAction(SSOSingIn, data);
return false;
}
onRecaptchaChange(response) {
this.setState({
'grecaptcharesponse': response
});
}
handleAccordionClick(e, titleProps) {
e.preventDefault();
const { index } = titleProps;
const { activeIndex } = this.state;
const newIndex = activeIndex === index ? -1 : index;
this.setState({ activeIndex: newIndex });
}
render() {
const signUpLabelStyle = {width: '150px'};
const recaptchaStyle = {display: 'inline-block'};
const PUBLIC_KEY = '6LdNLyYTAAAAAINDsVZRKG_E3l3Dvpp5sKboR1ET'; // Public reCAPTCHA key
let url = '';
let redirect = '';
if (this.props.SSOStore && instances[this.props.SSOStore.instance]) {
url = instances[this.props.SSOStore.instance].url;
redirect = instances[this.props.SSOStore.instance].validate;
}
const { activeIndex } = this.state;
return (
<div>
<div className="ui vertically padded centered grid container" >
<div className="ten wide column">
<div className="ui blue padded center aligned segment">
<div className="ui basic segment">
<img className="ui centered medium image" src="/assets/images/logo_full.png" />
<h2 className="ui header">SlideWiki Single Sign On</h2>
</div>
<div className="ui segments">
<div className="ui left aligned segment">
<p>
SlideWiki wants to access your account on {instances[instances._self].url} in order to retrieve your account details to the SlideWiki on {url}.
<br/>
Beneath you have to enter your password and your account with the email {(this.props.SSOStore) ? this.props.SSOStore.email : ''} will be copied to {url}.
</p>
</div>
<div className="ui left aligned segment">
<Accordion>
<Accordion.Title active={activeIndex === 1} index={1} onClick={this.handleAccordionClick.bind(this)}>
<Icon name='dropdown' />
Personal Account Data
</Accordion.Title>
<Accordion.Content active={activeIndex === 1}>
The following details will be read and transfered:
<br/>
<ul className="ui list">
<li>Username</li>
<li>Email Address</li>
<li>Full Name</li>
<li>Country</li>
<li>Picture</li>
<li>Biography</li>
<li>Organization</li>
<li>Language</li>
</ul>
</Accordion.Content>
</Accordion>
</div>
<div className="ui segment">
<form className="ui form ssosignin" ref="SSO_form" >
<div className="ui inline required field">
<label style={signUpLabelStyle} htmlFor="password_label">Password</label>
<div className="ui icon input"><input type="password" id="password_label" name="password" ref="password" placeholder="Password" aria-required="true"/></div>
</div>
<div >
<input type="hidden" id="recaptcha" name="recaptcha"></input>
<ReCAPTCHA style={recaptchaStyle} ref="recaptcha" sitekey={publicRecaptchaKey} onChange={this.onRecaptchaChange.bind(this)}/>
</div>
<div className="ui error message" role="region" aria-live="polite"/>
<br/>
<button type="submit" className="ui blue labeled submit icon button" >
<i className="icon add user"/> Sign In
</button>
<p><small>This will redirect you to<br/><b>{redirect}</b></small></p>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
);
}
}
SSO.contextTypes = {
executeAction: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired
};
SSO = connectToStores(SSO, [SSOStore], (context, props) => {
return {
SSOStore: context.getStore(SSOStore).getState()
};
});
export default SSO;
|
ajax/libs/react-datepicker/0.46.0/react-datepicker.js
|
maruilian11/cdnjs
|
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("moment"), require("react"), require("react-onclickoutside"), require("react-dom"));
else if(typeof define === 'function' && define.amd)
define(["moment", "react", "react-onclickoutside", "react-dom"], factory);
else if(typeof exports === 'object')
exports["DatePicker"] = factory(require("moment"), require("react"), require("react-onclickoutside"), require("react-dom"));
else
root["DatePicker"] = factory(root["moment"], root["React"], root["onClickOutside"], root["ReactDOM"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_4__, __WEBPACK_EXTERNAL_MODULE_11__, __WEBPACK_EXTERNAL_MODULE_20__) {
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';
Object.defineProperty(exports, "__esModule", {
value: true
});
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 _calendar = __webpack_require__(1);
var _calendar2 = _interopRequireDefault(_calendar);
var _react = __webpack_require__(4);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(5);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _tether_component = __webpack_require__(19);
var _tether_component2 = _interopRequireDefault(_tether_component);
var _classnames2 = __webpack_require__(10);
var _classnames3 = _interopRequireDefault(_classnames2);
var _date_utils = __webpack_require__(17);
var _moment = __webpack_require__(2);
var _moment2 = _interopRequireDefault(_moment);
var _reactOnclickoutside = __webpack_require__(11);
var _reactOnclickoutside2 = _interopRequireDefault(_reactOnclickoutside);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var outsideClickIgnoreClass = 'react-datepicker-ignore-onclickoutside';
var WrappedCalendar = (0, _reactOnclickoutside2.default)(_calendar2.default);
/**
* General datepicker component.
*/
var DatePicker = function (_React$Component) {
_inherits(DatePicker, _React$Component);
_createClass(DatePicker, null, [{
key: 'defaultProps',
get: function get() {
return {
dateFormat: 'L',
dateFormatCalendar: 'MMMM YYYY',
onChange: function onChange() {},
disabled: false,
disabledKeyboardNavigation: false,
dropdownMode: 'scroll',
onFocus: function onFocus() {},
onBlur: function onBlur() {},
onSelect: function onSelect() {},
onClickOutside: function onClickOutside() {},
onMonthChange: function onMonthChange() {},
popoverAttachment: 'top left',
popoverTargetAttachment: 'bottom left',
popoverTargetOffset: '10px 0',
tetherConstraints: [{
to: 'window',
attachment: 'together'
}],
utcOffset: (0, _moment2.default)().utcOffset(),
monthsShown: 1,
withPortal: false
};
}
}]);
function DatePicker(props) {
_classCallCheck(this, DatePicker);
var _this = _possibleConstructorReturn(this, (DatePicker.__proto__ || Object.getPrototypeOf(DatePicker)).call(this, props));
_this.getInitialState = function () {
var defaultPreSelection = _this.props.openToDate ? (0, _moment2.default)(_this.props.openToDate) : _this.props.selectsEnd && _this.props.startDate ? (0, _moment2.default)(_this.props.startDate) : _this.props.selectsStart && _this.props.endDate ? (0, _moment2.default)(_this.props.endDate) : (0, _moment2.default)();
var minDate = (0, _date_utils.getEffectiveMinDate)(_this.props);
var maxDate = (0, _date_utils.getEffectiveMaxDate)(_this.props);
var boundedPreSelection = minDate && defaultPreSelection.isBefore(minDate) ? minDate : maxDate && defaultPreSelection.isAfter(maxDate) ? maxDate : defaultPreSelection;
return {
open: false,
preventFocus: false,
preSelection: _this.props.selected ? (0, _moment2.default)(_this.props.selected) : boundedPreSelection
};
};
_this.clearPreventFocusTimeout = function () {
if (_this.preventFocusTimeout) {
clearTimeout(_this.preventFocusTimeout);
}
};
_this.setFocus = function () {
_this.refs.input.focus();
};
_this.setOpen = function (open) {
_this.setState({
open: open,
preSelection: open && _this.state.open ? _this.state.preSelection : _this.getInitialState().preSelection
});
};
_this.handleFocus = function (event) {
if (!_this.state.preventFocus) {
_this.props.onFocus(event);
_this.setOpen(true);
}
};
_this.cancelFocusInput = function () {
clearTimeout(_this.inputFocusTimeout);
_this.inputFocusTimeout = null;
};
_this.deferFocusInput = function () {
_this.cancelFocusInput();
_this.inputFocusTimeout = window.setTimeout(function () {
return _this.setFocus();
}, 1);
};
_this.handleDropdownFocus = function () {
_this.cancelFocusInput();
};
_this.handleBlur = function (event) {
if (_this.state.open) {
_this.deferFocusInput();
} else {
_this.props.onBlur(event);
}
};
_this.handleCalendarClickOutside = function (event) {
_this.setOpen(false);
_this.props.onClickOutside(event);
if (_this.props.withPortal) {
event.preventDefault();
}
};
_this.handleChange = function (event) {
if (_this.props.onChangeRaw) {
_this.props.onChangeRaw(event);
if (event.isDefaultPrevented()) {
return;
}
}
_this.setState({ inputValue: event.target.value });
var date = (0, _date_utils.parseDate)(event.target.value, _this.props);
if (date || !event.target.value) {
_this.setSelected(date, event, true);
}
};
_this.handleSelect = function (date, event) {
// Preventing onFocus event to fix issue
// https://github.com/Hacker0x01/react-datepicker/issues/628
_this.setState({ preventFocus: true }, function () {
_this.preventFocusTimeout = setTimeout(function () {
return _this.setState({ preventFocus: false });
}, 50);
return _this.preventFocusTimeout;
});
_this.setSelected(date, event);
_this.setOpen(false);
};
_this.setSelected = function (date, event, keepInput) {
var changedDate = date;
if (changedDate !== null && (0, _date_utils.isDayDisabled)(changedDate, _this.props)) {
return;
}
if (!(0, _date_utils.isSameDay)(_this.props.selected, changedDate)) {
if (changedDate !== null) {
if (_this.props.selected) {
changedDate = (0, _moment2.default)(changedDate).set({
hour: _this.props.selected.hour(),
minute: _this.props.selected.minute(),
second: _this.props.selected.second()
});
}
_this.setState({
preSelection: changedDate
});
}
_this.props.onChange(changedDate, event);
}
_this.props.onSelect(changedDate, event);
if (!keepInput) {
_this.setState({ inputValue: null });
}
};
_this.setPreSelection = function (date) {
var isDateRangePresent = typeof _this.props.minDate !== 'undefined' && typeof _this.props.maxDate !== 'undefined';
var isValidDateSelection = isDateRangePresent && date ? (0, _date_utils.isDayInRange)(date, _this.props.minDate, _this.props.maxDate) : true;
if (isValidDateSelection) {
_this.setState({
preSelection: date
});
}
};
_this.onInputClick = function () {
if (!_this.props.disabled) {
_this.setOpen(true);
}
};
_this.onInputKeyDown = function (event) {
if (!_this.state.open && !_this.props.inline) {
if (/^Arrow/.test(event.key)) {
_this.onInputClick();
}
return;
}
var copy = (0, _moment2.default)(_this.state.preSelection);
if (event.key === 'Enter') {
event.preventDefault();
_this.handleSelect(copy, event);
} else if (event.key === 'Escape') {
event.preventDefault();
_this.setOpen(false);
} else if (event.key === 'Tab') {
_this.setOpen(false);
}
if (!_this.props.disabledKeyboardNavigation) {
var newSelection = void 0;
switch (event.key) {
case 'ArrowLeft':
event.preventDefault();
newSelection = copy.subtract(1, 'days');
break;
case 'ArrowRight':
event.preventDefault();
newSelection = copy.add(1, 'days');
break;
case 'ArrowUp':
event.preventDefault();
newSelection = copy.subtract(1, 'weeks');
break;
case 'ArrowDown':
event.preventDefault();
newSelection = copy.add(1, 'weeks');
break;
case 'PageUp':
event.preventDefault();
newSelection = copy.subtract(1, 'months');
break;
case 'PageDown':
event.preventDefault();
newSelection = copy.add(1, 'months');
break;
case 'Home':
event.preventDefault();
newSelection = copy.subtract(1, 'years');
break;
case 'End':
event.preventDefault();
newSelection = copy.add(1, 'years');
break;
}
_this.setPreSelection(newSelection);
}
};
_this.onClearClick = function (event) {
event.preventDefault();
_this.props.onChange(null, event);
};
_this.renderCalendar = function () {
if (!_this.props.inline && (!_this.state.open || _this.props.disabled)) {
return null;
}
return _react2.default.createElement(
WrappedCalendar,
{
ref: 'calendar',
locale: _this.props.locale,
dateFormat: _this.props.dateFormatCalendar,
dropdownMode: _this.props.dropdownMode,
selected: _this.props.selected,
preSelection: _this.state.preSelection,
onSelect: _this.handleSelect,
openToDate: _this.props.openToDate,
minDate: _this.props.minDate,
maxDate: _this.props.maxDate,
selectsStart: _this.props.selectsStart,
selectsEnd: _this.props.selectsEnd,
startDate: _this.props.startDate,
endDate: _this.props.endDate,
excludeDates: _this.props.excludeDates,
filterDate: _this.props.filterDate,
onClickOutside: _this.handleCalendarClickOutside,
highlightDates: _this.props.highlightDates,
includeDates: _this.props.includeDates,
inline: _this.props.inline,
peekNextMonth: _this.props.peekNextMonth,
showMonthDropdown: _this.props.showMonthDropdown,
showWeekNumbers: _this.props.showWeekNumbers,
showYearDropdown: _this.props.showYearDropdown,
forceShowMonthNavigation: _this.props.forceShowMonthNavigation,
scrollableYearDropdown: _this.props.scrollableYearDropdown,
todayButton: _this.props.todayButton,
utcOffset: _this.props.utcOffset,
outsideClickIgnoreClass: outsideClickIgnoreClass,
fixedHeight: _this.props.fixedHeight,
monthsShown: _this.props.monthsShown,
onDropdownFocus: _this.handleDropdownFocus,
onMonthChange: _this.props.onMonthChange,
className: _this.props.calendarClassName },
_this.props.children
);
};
_this.renderDateInput = function () {
var className = (0, _classnames3.default)(_this.props.className, _defineProperty({}, outsideClickIgnoreClass, _this.state.open));
var customInput = _this.props.customInput || _react2.default.createElement('input', { type: 'text' });
var inputValue = typeof _this.props.value === 'string' ? _this.props.value : typeof _this.state.inputValue === 'string' ? _this.state.inputValue : (0, _date_utils.safeDateFormat)(_this.props.selected, _this.props);
return _react2.default.cloneElement(customInput, {
ref: 'input',
value: inputValue,
onBlur: _this.handleBlur,
onChange: _this.handleChange,
onClick: _this.onInputClick,
onFocus: _this.handleFocus,
onKeyDown: _this.onInputKeyDown,
id: _this.props.id,
name: _this.props.name,
autoFocus: _this.props.autoFocus,
placeholder: _this.props.placeholderText,
disabled: _this.props.disabled,
autoComplete: _this.props.autoComplete,
className: className,
title: _this.props.title,
readOnly: _this.props.readOnly,
required: _this.props.required,
tabIndex: _this.props.tabIndex
});
};
_this.renderClearButton = function () {
if (_this.props.isClearable && _this.props.selected != null) {
return _react2.default.createElement('a', { className: 'react-datepicker__close-icon', href: '#', onClick: _this.onClearClick });
} else {
return null;
}
};
_this.state = _this.getInitialState();
return _this;
}
_createClass(DatePicker, [{
key: 'componentWillUnmount',
value: function componentWillUnmount() {
this.clearPreventFocusTimeout();
}
}, {
key: 'render',
value: function render() {
var calendar = this.renderCalendar();
if (this.props.inline && !this.props.withPortal) {
return calendar;
}
if (this.props.withPortal) {
return _react2.default.createElement(
'div',
null,
!this.props.inline ? _react2.default.createElement(
'div',
{ className: 'react-datepicker__input-container' },
this.renderDateInput(),
this.renderClearButton()
) : null,
this.state.open || this.props.inline ? _react2.default.createElement(
'div',
{ className: 'react-datepicker__portal' },
calendar
) : null
);
}
return _react2.default.createElement(
_tether_component2.default,
{
classPrefix: 'react-datepicker__tether',
attachment: this.props.popoverAttachment,
targetAttachment: this.props.popoverTargetAttachment,
targetOffset: this.props.popoverTargetOffset,
renderElementTo: this.props.renderCalendarTo,
constraints: this.props.tetherConstraints },
_react2.default.createElement(
'div',
{ className: 'react-datepicker__input-container' },
this.renderDateInput(),
this.renderClearButton()
),
calendar
);
}
}]);
return DatePicker;
}(_react2.default.Component);
DatePicker.propTypes = {
autoComplete: _propTypes2.default.string,
autoFocus: _propTypes2.default.bool,
calendarClassName: _propTypes2.default.string,
children: _propTypes2.default.node,
className: _propTypes2.default.string,
customInput: _propTypes2.default.element,
dateFormat: _propTypes2.default.oneOfType([// eslint-disable-line react/no-unused-prop-types
_propTypes2.default.string, _propTypes2.default.array]),
dateFormatCalendar: _propTypes2.default.string,
disabled: _propTypes2.default.bool,
disabledKeyboardNavigation: _propTypes2.default.bool,
dropdownMode: _propTypes2.default.oneOf(['scroll', 'select']).isRequired,
endDate: _propTypes2.default.object,
excludeDates: _propTypes2.default.array,
filterDate: _propTypes2.default.func,
fixedHeight: _propTypes2.default.bool,
highlightDates: _propTypes2.default.array,
id: _propTypes2.default.string,
includeDates: _propTypes2.default.array,
inline: _propTypes2.default.bool,
isClearable: _propTypes2.default.bool,
locale: _propTypes2.default.string,
maxDate: _propTypes2.default.object,
minDate: _propTypes2.default.object,
monthsShown: _propTypes2.default.number,
name: _propTypes2.default.string,
onBlur: _propTypes2.default.func,
onChange: _propTypes2.default.func.isRequired,
onSelect: _propTypes2.default.func,
onClickOutside: _propTypes2.default.func,
onChangeRaw: _propTypes2.default.func,
onFocus: _propTypes2.default.func,
onMonthChange: _propTypes2.default.func,
openToDate: _propTypes2.default.object,
peekNextMonth: _propTypes2.default.bool,
placeholderText: _propTypes2.default.string,
popoverAttachment: _propTypes2.default.string,
popoverTargetAttachment: _propTypes2.default.string,
popoverTargetOffset: _propTypes2.default.string,
readOnly: _propTypes2.default.bool,
renderCalendarTo: _propTypes2.default.any,
required: _propTypes2.default.bool,
scrollableYearDropdown: _propTypes2.default.bool,
selected: _propTypes2.default.object,
selectsEnd: _propTypes2.default.bool,
selectsStart: _propTypes2.default.bool,
showMonthDropdown: _propTypes2.default.bool,
showWeekNumbers: _propTypes2.default.bool,
showYearDropdown: _propTypes2.default.bool,
forceShowMonthNavigation: _propTypes2.default.bool,
startDate: _propTypes2.default.object,
tabIndex: _propTypes2.default.number,
tetherConstraints: _propTypes2.default.array,
title: _propTypes2.default.string,
todayButton: _propTypes2.default.string,
utcOffset: _propTypes2.default.number,
value: _propTypes2.default.string,
withPortal: _propTypes2.default.bool
};
exports.default = DatePicker;
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
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 _moment = __webpack_require__(2);
var _moment2 = _interopRequireDefault(_moment);
var _year_dropdown = __webpack_require__(3);
var _year_dropdown2 = _interopRequireDefault(_year_dropdown);
var _month_dropdown = __webpack_require__(12);
var _month_dropdown2 = _interopRequireDefault(_month_dropdown);
var _month = __webpack_require__(14);
var _month2 = _interopRequireDefault(_month);
var _react = __webpack_require__(4);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(5);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _classnames = __webpack_require__(10);
var _classnames2 = _interopRequireDefault(_classnames);
var _date_utils = __webpack_require__(17);
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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var DROPDOWN_FOCUS_CLASSNAMES = ['react-datepicker__year-select', 'react-datepicker__month-select'];
var isDropdownSelect = function isDropdownSelect() {
var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var classNames = (element.className || '').split(/\s+/);
return DROPDOWN_FOCUS_CLASSNAMES.some(function (testClassname) {
return classNames.indexOf(testClassname) >= 0;
});
};
var Calendar = function (_React$Component) {
_inherits(Calendar, _React$Component);
_createClass(Calendar, null, [{
key: 'defaultProps',
get: function get() {
return {
onDropdownFocus: function onDropdownFocus() {},
utcOffset: _moment2.default.utc().utcOffset(),
monthsShown: 1,
forceShowMonthNavigation: false
};
}
}]);
function Calendar(props) {
_classCallCheck(this, Calendar);
var _this = _possibleConstructorReturn(this, (Calendar.__proto__ || Object.getPrototypeOf(Calendar)).call(this, props));
_this.handleClickOutside = function (event) {
_this.props.onClickOutside(event);
};
_this.handleDropdownFocus = function (event) {
if (isDropdownSelect(event.target)) {
_this.props.onDropdownFocus();
}
};
_this.getDateInView = function () {
var _this$props = _this.props,
preSelection = _this$props.preSelection,
selected = _this$props.selected,
openToDate = _this$props.openToDate,
utcOffset = _this$props.utcOffset;
var minDate = (0, _date_utils.getEffectiveMinDate)(_this.props);
var maxDate = (0, _date_utils.getEffectiveMaxDate)(_this.props);
var current = _moment2.default.utc().utcOffset(utcOffset);
var initialDate = preSelection || selected;
if (initialDate) {
return initialDate;
} else if (minDate && maxDate && openToDate && openToDate.isBetween(minDate, maxDate)) {
return openToDate;
} else if (minDate && openToDate && openToDate.isAfter(minDate)) {
return openToDate;
} else if (minDate && minDate.isAfter(current)) {
return minDate;
} else if (maxDate && openToDate && openToDate.isBefore(maxDate)) {
return openToDate;
} else if (maxDate && maxDate.isBefore(current)) {
return maxDate;
} else if (openToDate) {
return openToDate;
} else {
return current;
}
};
_this.localizeMoment = function (date) {
return date.clone().locale(_this.props.locale || _moment2.default.locale());
};
_this.increaseMonth = function () {
_this.setState({
date: _this.state.date.clone().add(1, 'month')
}, function () {
return _this.handleMonthChange(_this.state.date);
});
};
_this.decreaseMonth = function () {
_this.setState({
date: _this.state.date.clone().subtract(1, 'month')
}, function () {
return _this.handleMonthChange(_this.state.date);
});
};
_this.handleDayClick = function (day, event) {
return _this.props.onSelect(day, event);
};
_this.handleDayMouseEnter = function (day) {
return _this.setState({ selectingDate: day });
};
_this.handleMonthMouseLeave = function () {
return _this.setState({ selectingDate: null });
};
_this.handleMonthChange = function (date) {
if (_this.props.onMonthChange) {
_this.props.onMonthChange(date);
}
};
_this.changeYear = function (year) {
_this.setState({
date: _this.state.date.clone().set('year', year)
});
};
_this.changeMonth = function (month) {
_this.setState({
date: _this.state.date.clone().set('month', month)
}, function () {
return _this.handleMonthChange(_this.state.date);
});
};
_this.header = function () {
var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.state.date;
var startOfWeek = date.clone().startOf('week');
var dayNames = [];
if (_this.props.showWeekNumbers) {
dayNames.push(_react2.default.createElement(
'div',
{ key: 'W', className: 'react-datepicker__day-name' },
'#'
));
}
return dayNames.concat([0, 1, 2, 3, 4, 5, 6].map(function (offset) {
var day = startOfWeek.clone().add(offset, 'days');
return _react2.default.createElement(
'div',
{ key: offset, className: 'react-datepicker__day-name' },
day.localeData().weekdaysMin(day)
);
}));
};
_this.renderPreviousMonthButton = function () {
if (!_this.props.forceShowMonthNavigation && (0, _date_utils.allDaysDisabledBefore)(_this.state.date, 'month', _this.props)) {
return;
}
return _react2.default.createElement('a', {
className: 'react-datepicker__navigation react-datepicker__navigation--previous',
onClick: _this.decreaseMonth });
};
_this.renderNextMonthButton = function () {
if (!_this.props.forceShowMonthNavigation && (0, _date_utils.allDaysDisabledAfter)(_this.state.date, 'month', _this.props)) {
return;
}
return _react2.default.createElement('a', {
className: 'react-datepicker__navigation react-datepicker__navigation--next',
onClick: _this.increaseMonth });
};
_this.renderCurrentMonth = function () {
var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.state.date;
var classes = ['react-datepicker__current-month'];
if (_this.props.showYearDropdown) {
classes.push('react-datepicker__current-month--hasYearDropdown');
}
if (_this.props.showMonthDropdown) {
classes.push('react-datepicker__current-month--hasMonthDropdown');
}
return _react2.default.createElement(
'div',
{ className: classes.join(' ') },
date.format(_this.props.dateFormat)
);
};
_this.renderYearDropdown = function () {
var overrideHide = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
if (!_this.props.showYearDropdown || overrideHide) {
return;
}
return _react2.default.createElement(_year_dropdown2.default, {
dropdownMode: _this.props.dropdownMode,
onChange: _this.changeYear,
minDate: _this.props.minDate,
maxDate: _this.props.maxDate,
year: _this.state.date.year(),
scrollableYearDropdown: _this.props.scrollableYearDropdown });
};
_this.renderMonthDropdown = function () {
var overrideHide = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
if (!_this.props.showMonthDropdown) {
return;
}
return _react2.default.createElement(_month_dropdown2.default, {
dropdownMode: _this.props.dropdownMode,
locale: _this.props.locale,
onChange: _this.changeMonth,
month: _this.state.date.month() });
};
_this.renderTodayButton = function () {
if (!_this.props.todayButton) {
return;
}
return _react2.default.createElement(
'div',
{
className: 'react-datepicker__today-button',
onClick: function onClick(e) {
return _this.props.onSelect(_moment2.default.utc().utcOffset(_this.props.utcOffset).startOf('date'), e);
} },
_this.props.todayButton
);
};
_this.renderMonths = function () {
var monthList = [];
for (var i = 0; i < _this.props.monthsShown; ++i) {
var monthDate = _this.state.date.clone().add(i, 'M');
var monthKey = 'month-' + i;
monthList.push(_react2.default.createElement(
'div',
{ key: monthKey, className: 'react-datepicker__month-container' },
_react2.default.createElement(
'div',
{ className: 'react-datepicker__header' },
_this.renderCurrentMonth(monthDate),
_react2.default.createElement(
'div',
{
className: 'react-datepicker__header__dropdown react-datepicker__header__dropdown--' + _this.props.dropdownMode,
onFocus: _this.handleDropdownFocus },
_this.renderMonthDropdown(i !== 0),
_this.renderYearDropdown(i !== 0)
),
_react2.default.createElement(
'div',
{ className: 'react-datepicker__day-names' },
_this.header(monthDate)
)
),
_react2.default.createElement(_month2.default, {
day: monthDate,
onDayClick: _this.handleDayClick,
onDayMouseEnter: _this.handleDayMouseEnter,
onMouseLeave: _this.handleMonthMouseLeave,
minDate: _this.props.minDate,
maxDate: _this.props.maxDate,
excludeDates: _this.props.excludeDates,
highlightDates: _this.props.highlightDates,
selectingDate: _this.state.selectingDate,
includeDates: _this.props.includeDates,
inline: _this.props.inline,
fixedHeight: _this.props.fixedHeight,
filterDate: _this.props.filterDate,
preSelection: _this.props.preSelection,
selected: _this.props.selected,
selectsStart: _this.props.selectsStart,
selectsEnd: _this.props.selectsEnd,
showWeekNumbers: _this.props.showWeekNumbers,
startDate: _this.props.startDate,
endDate: _this.props.endDate,
peekNextMonth: _this.props.peekNextMonth,
utcOffset: _this.props.utcOffset })
));
}
return monthList;
};
_this.state = {
date: _this.localizeMoment(_this.getDateInView()),
selectingDate: null
};
return _this;
}
_createClass(Calendar, [{
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
if (nextProps.preSelection && !(0, _date_utils.isSameDay)(nextProps.preSelection, this.props.preSelection)) {
this.setState({
date: this.localizeMoment(nextProps.preSelection)
});
} else if (nextProps.openToDate && !(0, _date_utils.isSameDay)(nextProps.openToDate, this.props.openToDate)) {
this.setState({
date: this.localizeMoment(nextProps.openToDate)
});
}
}
}, {
key: 'render',
value: function render() {
return _react2.default.createElement(
'div',
{ className: (0, _classnames2.default)('react-datepicker', this.props.className) },
_react2.default.createElement('div', { className: 'react-datepicker__triangle' }),
this.renderPreviousMonthButton(),
this.renderNextMonthButton(),
this.renderMonths(),
this.renderTodayButton(),
this.props.children
);
}
}]);
return Calendar;
}(_react2.default.Component);
Calendar.propTypes = {
className: _propTypes2.default.string,
children: _propTypes2.default.node,
dateFormat: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.array]).isRequired,
dropdownMode: _propTypes2.default.oneOf(['scroll', 'select']).isRequired,
endDate: _propTypes2.default.object,
excludeDates: _propTypes2.default.array,
filterDate: _propTypes2.default.func,
fixedHeight: _propTypes2.default.bool,
highlightDates: _propTypes2.default.array,
includeDates: _propTypes2.default.array,
inline: _propTypes2.default.bool,
locale: _propTypes2.default.string,
maxDate: _propTypes2.default.object,
minDate: _propTypes2.default.object,
monthsShown: _propTypes2.default.number,
onClickOutside: _propTypes2.default.func.isRequired,
onMonthChange: _propTypes2.default.func,
forceShowMonthNavigation: _propTypes2.default.bool,
onDropdownFocus: _propTypes2.default.func,
onSelect: _propTypes2.default.func.isRequired,
openToDate: _propTypes2.default.object,
peekNextMonth: _propTypes2.default.bool,
scrollableYearDropdown: _propTypes2.default.bool,
preSelection: _propTypes2.default.object,
selected: _propTypes2.default.object,
selectsEnd: _propTypes2.default.bool,
selectsStart: _propTypes2.default.bool,
showMonthDropdown: _propTypes2.default.bool,
showWeekNumbers: _propTypes2.default.bool,
showYearDropdown: _propTypes2.default.bool,
startDate: _propTypes2.default.object,
todayButton: _propTypes2.default.string,
utcOffset: _propTypes2.default.number
};
exports.default = Calendar;
/***/ },
/* 2 */
/***/ function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_2__;
/***/ },
/* 3 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
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 _react = __webpack_require__(4);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(5);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _year_dropdown_options = __webpack_require__(9);
var _year_dropdown_options2 = _interopRequireDefault(_year_dropdown_options);
var _reactOnclickoutside = __webpack_require__(11);
var _reactOnclickoutside2 = _interopRequireDefault(_reactOnclickoutside);
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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var WrappedYearDropdownOptions = (0, _reactOnclickoutside2.default)(_year_dropdown_options2.default);
var YearDropdown = function (_React$Component) {
_inherits(YearDropdown, _React$Component);
function YearDropdown() {
var _ref;
var _temp, _this, _ret;
_classCallCheck(this, YearDropdown);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = YearDropdown.__proto__ || Object.getPrototypeOf(YearDropdown)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
dropdownVisible: false
}, _this.renderSelectOptions = function () {
var minYear = _this.props.minDate ? _this.props.minDate.year() : 1900;
var maxYear = _this.props.maxDate ? _this.props.maxDate.year() : 2100;
var options = [];
for (var i = minYear; i <= maxYear; i++) {
options.push(_react2.default.createElement(
'option',
{ key: i, value: i },
i
));
}
return options;
}, _this.onSelectChange = function (e) {
_this.onChange(e.target.value);
}, _this.renderSelectMode = function () {
return _react2.default.createElement(
'select',
{
value: _this.props.year,
className: 'react-datepicker__year-select',
onChange: _this.onSelectChange },
_this.renderSelectOptions()
);
}, _this.renderReadView = function (visible) {
return _react2.default.createElement(
'div',
{ key: 'read', style: { visibility: visible ? 'visible' : 'hidden' }, className: 'react-datepicker__year-read-view', onClick: _this.toggleDropdown },
_react2.default.createElement('span', { className: 'react-datepicker__year-read-view--down-arrow' }),
_react2.default.createElement(
'span',
{ className: 'react-datepicker__year-read-view--selected-year' },
_this.props.year
)
);
}, _this.renderDropdown = function () {
return _react2.default.createElement(WrappedYearDropdownOptions, {
key: 'dropdown',
ref: 'options',
year: _this.props.year,
onChange: _this.onChange,
onCancel: _this.toggleDropdown,
scrollableYearDropdown: _this.props.scrollableYearDropdown });
}, _this.renderScrollMode = function () {
var dropdownVisible = _this.state.dropdownVisible;
var result = [_this.renderReadView(!dropdownVisible)];
if (dropdownVisible) {
result.unshift(_this.renderDropdown());
}
return result;
}, _this.onChange = function (year) {
_this.toggleDropdown();
if (year === _this.props.year) return;
_this.props.onChange(year);
}, _this.toggleDropdown = function () {
_this.setState({
dropdownVisible: !_this.state.dropdownVisible
});
}, _temp), _possibleConstructorReturn(_this, _ret);
}
_createClass(YearDropdown, [{
key: 'render',
value: function render() {
var renderedDropdown = void 0;
switch (this.props.dropdownMode) {
case 'scroll':
renderedDropdown = this.renderScrollMode();
break;
case 'select':
renderedDropdown = this.renderSelectMode();
break;
}
return _react2.default.createElement(
'div',
{
className: 'react-datepicker__year-dropdown-container react-datepicker__year-dropdown-container--' + this.props.dropdownMode },
renderedDropdown
);
}
}]);
return YearDropdown;
}(_react2.default.Component);
YearDropdown.propTypes = {
dropdownMode: _propTypes2.default.oneOf(['scroll', 'select']).isRequired,
maxDate: _propTypes2.default.object,
minDate: _propTypes2.default.object,
onChange: _propTypes2.default.func.isRequired,
scrollableYearDropdown: _propTypes2.default.bool,
year: _propTypes2.default.number.isRequired
};
exports.default = YearDropdown;
/***/ },
/* 4 */
/***/ function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_4__;
/***/ },
/* 5 */
/***/ function(module, exports, __webpack_require__) {
/**
* Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
if (false) {
var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
Symbol.for &&
Symbol.for('react.element')) ||
0xeac7;
var isValidElement = function(object) {
return typeof object === 'object' &&
object !== null &&
object.$$typeof === REACT_ELEMENT_TYPE;
};
// By explicitly using `prop-types` you are opting into new development behavior.
// http://fb.me/prop-types-in-prod
var throwOnDirectAccess = true;
module.exports = require('./factoryWithTypeCheckers')(isValidElement, throwOnDirectAccess);
} else {
// By explicitly using `prop-types` you are opting into new production behavior.
// http://fb.me/prop-types-in-prod
module.exports = __webpack_require__(6)();
}
/***/ },
/* 6 */
/***/ function(module, exports, __webpack_require__) {
/**
* Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
var emptyFunction = __webpack_require__(7);
var invariant = __webpack_require__(8);
module.exports = function() {
// Important!
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
function shim() {
invariant(
false,
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
'Use PropTypes.checkPropTypes() to call them. ' +
'Read more at http://fb.me/use-check-prop-types'
);
};
shim.isRequired = shim;
function getShim() {
return 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
};
ReactPropTypes.checkPropTypes = emptyFunction;
ReactPropTypes.PropTypes = ReactPropTypes;
return ReactPropTypes;
};
/***/ },
/* 7 */
/***/ function(module, exports) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/
function makeEmptyFunction(arg) {
return function () {
return arg;
};
}
/**
* This function accepts and discards inputs; it has no side effects. This is
* primarily useful idiomatically for overridable function endpoints which
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
*/
var emptyFunction = function emptyFunction() {};
emptyFunction.thatReturns = makeEmptyFunction;
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
emptyFunction.thatReturnsThis = function () {
return this;
};
emptyFunction.thatReturnsArgument = function (arg) {
return arg;
};
module.exports = emptyFunction;
/***/ },
/* 8 */
/***/ function(module, exports, __webpack_require__) {
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
'use 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 validateFormat = function validateFormat(format) {};
if (false) {
validateFormat = function validateFormat(format) {
if (format === undefined) {
throw new Error('invariant requires an error message argument');
}
};
}
function invariant(condition, format, a, b, c, d, e, f) {
validateFormat(format);
if (!condition) {
var error;
if (format === undefined) {
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
} else {
var args = [a, b, c, d, e, f];
var argIndex = 0;
error = new Error(format.replace(/%s/g, function () {
return args[argIndex++];
}));
error.name = 'Invariant Violation';
}
error.framesToPop = 1; // we don't care about invariant's own frame
throw error;
}
}
module.exports = invariant;
/***/ },
/* 9 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
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 _react = __webpack_require__(4);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(5);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _classnames = __webpack_require__(10);
var _classnames2 = _interopRequireDefault(_classnames);
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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function generateYears(year, noOfYear) {
var list = [];
for (var i = 0; i < 2 * noOfYear; i++) {
list.push(year + noOfYear - i);
}
return list;
}
var YearDropdownOptions = function (_React$Component) {
_inherits(YearDropdownOptions, _React$Component);
function YearDropdownOptions(props) {
_classCallCheck(this, YearDropdownOptions);
var _this = _possibleConstructorReturn(this, (YearDropdownOptions.__proto__ || Object.getPrototypeOf(YearDropdownOptions)).call(this, props));
_this.renderOptions = function () {
var selectedYear = _this.props.year;
var options = _this.state.yearsList.map(function (year) {
return _react2.default.createElement(
'div',
{ className: 'react-datepicker__year-option',
key: year,
ref: year,
onClick: _this.onChange.bind(_this, year) },
selectedYear === year ? _react2.default.createElement(
'span',
{ className: 'react-datepicker__year-option--selected' },
'\u2713'
) : '',
year
);
});
options.unshift(_react2.default.createElement(
'div',
{ className: 'react-datepicker__year-option',
ref: 'upcoming',
key: 'upcoming',
onClick: _this.incrementYears },
_react2.default.createElement('a', { className: 'react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-upcoming' })
));
options.push(_react2.default.createElement(
'div',
{ className: 'react-datepicker__year-option',
ref: 'previous',
key: 'previous',
onClick: _this.decrementYears },
_react2.default.createElement('a', { className: 'react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-previous' })
));
return options;
};
_this.onChange = function (year) {
_this.props.onChange(year);
};
_this.handleClickOutside = function () {
_this.props.onCancel();
};
_this.shiftYears = function (amount) {
var years = _this.state.yearsList.map(function (year) {
return year + amount;
});
_this.setState({
yearsList: years
});
};
_this.incrementYears = function () {
return _this.shiftYears(1);
};
_this.decrementYears = function () {
return _this.shiftYears(-1);
};
_this.state = {
yearsList: _this.props.scrollableYearDropdown ? generateYears(_this.props.year, 10) : generateYears(_this.props.year, 5)
};
return _this;
}
_createClass(YearDropdownOptions, [{
key: 'render',
value: function render() {
var dropdownClass = (0, _classnames2.default)({
'react-datepicker__year-dropdown': true,
'react-datepicker__year-dropdown--scrollable': this.props.scrollableYearDropdown
});
return _react2.default.createElement(
'div',
{ className: dropdownClass },
this.renderOptions()
);
}
}]);
return YearDropdownOptions;
}(_react2.default.Component);
YearDropdownOptions.propTypes = {
onCancel: _propTypes2.default.func.isRequired,
onChange: _propTypes2.default.func.isRequired,
scrollableYearDropdown: _propTypes2.default.bool,
year: _propTypes2.default.number.isRequired
};
exports.default = YearDropdownOptions;
/***/ },
/* 10 */
/***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
Copyright (c) 2016 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/* global define */
(function () {
'use strict';
var hasOwn = {}.hasOwnProperty;
function classNames () {
var classes = [];
for (var i = 0; i < arguments.length; i++) {
var arg = arguments[i];
if (!arg) continue;
var argType = typeof arg;
if (argType === 'string' || argType === 'number') {
classes.push(arg);
} else if (Array.isArray(arg)) {
classes.push(classNames.apply(null, arg));
} else if (argType === 'object') {
for (var key in arg) {
if (hasOwn.call(arg, key) && arg[key]) {
classes.push(key);
}
}
}
}
return classes.join(' ');
}
if (typeof module !== 'undefined' && module.exports) {
module.exports = classNames;
} else if (true) {
// register as 'classnames', consistent with npm package name
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {
return classNames;
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {
window.classNames = classNames;
}
}());
/***/ },
/* 11 */
/***/ function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_11__;
/***/ },
/* 12 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
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 _react = __webpack_require__(4);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(5);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _month_dropdown_options = __webpack_require__(13);
var _month_dropdown_options2 = _interopRequireDefault(_month_dropdown_options);
var _reactOnclickoutside = __webpack_require__(11);
var _reactOnclickoutside2 = _interopRequireDefault(_reactOnclickoutside);
var _moment = __webpack_require__(2);
var _moment2 = _interopRequireDefault(_moment);
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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var WrappedMonthDropdownOptions = (0, _reactOnclickoutside2.default)(_month_dropdown_options2.default);
var MonthDropdown = function (_React$Component) {
_inherits(MonthDropdown, _React$Component);
function MonthDropdown() {
var _ref;
var _temp, _this, _ret;
_classCallCheck(this, MonthDropdown);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = MonthDropdown.__proto__ || Object.getPrototypeOf(MonthDropdown)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
dropdownVisible: false
}, _this.renderSelectOptions = function (monthNames) {
return monthNames.map(function (M, i) {
return _react2.default.createElement(
'option',
{ key: i, value: i },
M
);
});
}, _this.renderSelectMode = function (monthNames) {
return _react2.default.createElement(
'select',
{ value: _this.props.month, className: 'react-datepicker__month-select', onChange: function onChange(e) {
return _this.onChange(e.target.value);
} },
_this.renderSelectOptions(monthNames)
);
}, _this.renderReadView = function (visible, monthNames) {
return _react2.default.createElement(
'div',
{ key: 'read', style: { visibility: visible ? 'visible' : 'hidden' }, className: 'react-datepicker__month-read-view', onClick: _this.toggleDropdown },
_react2.default.createElement(
'span',
{ className: 'react-datepicker__month-read-view--selected-month' },
monthNames[_this.props.month]
),
_react2.default.createElement('span', { className: 'react-datepicker__month-read-view--down-arrow' })
);
}, _this.renderDropdown = function (monthNames) {
return _react2.default.createElement(WrappedMonthDropdownOptions, {
key: 'dropdown',
ref: 'options',
month: _this.props.month,
monthNames: monthNames,
onChange: _this.onChange,
onCancel: _this.toggleDropdown });
}, _this.renderScrollMode = function (monthNames) {
var dropdownVisible = _this.state.dropdownVisible;
var result = [_this.renderReadView(!dropdownVisible, monthNames)];
if (dropdownVisible) {
result.unshift(_this.renderDropdown(monthNames));
}
return result;
}, _this.onChange = function (month) {
_this.toggleDropdown();
if (month !== _this.props.month) {
_this.props.onChange(month);
}
}, _this.toggleDropdown = function () {
return _this.setState({
dropdownVisible: !_this.state.dropdownVisible
});
}, _temp), _possibleConstructorReturn(_this, _ret);
}
_createClass(MonthDropdown, [{
key: 'render',
value: function render() {
var localeData = _moment2.default.localeData(this.props.locale);
var monthNames = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].map(function (M) {
return localeData.months((0, _moment2.default)({ M: M }));
});
var renderedDropdown = void 0;
switch (this.props.dropdownMode) {
case 'scroll':
renderedDropdown = this.renderScrollMode(monthNames);
break;
case 'select':
renderedDropdown = this.renderSelectMode(monthNames);
break;
}
return _react2.default.createElement(
'div',
{
className: 'react-datepicker__month-dropdown-container react-datepicker__month-dropdown-container--' + this.props.dropdownMode },
renderedDropdown
);
}
}]);
return MonthDropdown;
}(_react2.default.Component);
MonthDropdown.propTypes = {
dropdownMode: _propTypes2.default.oneOf(['scroll', 'select']).isRequired,
locale: _propTypes2.default.string,
month: _propTypes2.default.number.isRequired,
onChange: _propTypes2.default.func.isRequired
};
exports.default = MonthDropdown;
/***/ },
/* 13 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
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 _react = __webpack_require__(4);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(5);
var _propTypes2 = _interopRequireDefault(_propTypes);
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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var MonthDropdownOptions = function (_React$Component) {
_inherits(MonthDropdownOptions, _React$Component);
function MonthDropdownOptions() {
var _ref;
var _temp, _this, _ret;
_classCallCheck(this, MonthDropdownOptions);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = MonthDropdownOptions.__proto__ || Object.getPrototypeOf(MonthDropdownOptions)).call.apply(_ref, [this].concat(args))), _this), _this.renderOptions = function () {
return _this.props.monthNames.map(function (month, i) {
return _react2.default.createElement(
'div',
{ className: 'react-datepicker__month-option',
key: month,
ref: month,
onClick: _this.onChange.bind(_this, i) },
_this.props.month === i ? _react2.default.createElement(
'span',
{ className: 'react-datepicker__month-option--selected' },
'\u2713'
) : '',
month
);
});
}, _this.onChange = function (month) {
return _this.props.onChange(month);
}, _this.handleClickOutside = function () {
return _this.props.onCancel();
}, _temp), _possibleConstructorReturn(_this, _ret);
}
_createClass(MonthDropdownOptions, [{
key: 'render',
value: function render() {
return _react2.default.createElement(
'div',
{ className: 'react-datepicker__month-dropdown' },
this.renderOptions()
);
}
}]);
return MonthDropdownOptions;
}(_react2.default.Component);
MonthDropdownOptions.propTypes = {
onCancel: _propTypes2.default.func.isRequired,
onChange: _propTypes2.default.func.isRequired,
month: _propTypes2.default.number.isRequired,
monthNames: _propTypes2.default.arrayOf(_propTypes2.default.string.isRequired).isRequired
};
exports.default = MonthDropdownOptions;
/***/ },
/* 14 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
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 _react = __webpack_require__(4);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(5);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _classnames = __webpack_require__(10);
var _classnames2 = _interopRequireDefault(_classnames);
var _week = __webpack_require__(15);
var _week2 = _interopRequireDefault(_week);
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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var FIXED_HEIGHT_STANDARD_WEEK_COUNT = 6;
var Month = function (_React$Component) {
_inherits(Month, _React$Component);
function Month() {
var _ref;
var _temp, _this, _ret;
_classCallCheck(this, Month);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Month.__proto__ || Object.getPrototypeOf(Month)).call.apply(_ref, [this].concat(args))), _this), _this.handleDayClick = function (day, event) {
if (_this.props.onDayClick) {
_this.props.onDayClick(day, event);
}
}, _this.handleDayMouseEnter = function (day) {
if (_this.props.onDayMouseEnter) {
_this.props.onDayMouseEnter(day);
}
}, _this.handleMouseLeave = function () {
if (_this.props.onMouseLeave) {
_this.props.onMouseLeave();
}
}, _this.isWeekInMonth = function (startOfWeek) {
var day = _this.props.day;
var endOfWeek = startOfWeek.clone().add(6, 'days');
return startOfWeek.isSame(day, 'month') || endOfWeek.isSame(day, 'month');
}, _this.renderWeeks = function () {
var weeks = [];
var isFixedHeight = _this.props.fixedHeight;
var currentWeekStart = _this.props.day.clone().startOf('month').startOf('week');
var i = 0;
var breakAfterNextPush = false;
while (true) {
weeks.push(_react2.default.createElement(_week2.default, {
key: i,
day: currentWeekStart,
month: _this.props.day.month(),
onDayClick: _this.handleDayClick,
onDayMouseEnter: _this.handleDayMouseEnter,
minDate: _this.props.minDate,
maxDate: _this.props.maxDate,
excludeDates: _this.props.excludeDates,
includeDates: _this.props.includeDates,
inline: _this.props.inline,
highlightDates: _this.props.highlightDates,
selectingDate: _this.props.selectingDate,
filterDate: _this.props.filterDate,
preSelection: _this.props.preSelection,
selected: _this.props.selected,
selectsStart: _this.props.selectsStart,
selectsEnd: _this.props.selectsEnd,
showWeekNumber: _this.props.showWeekNumbers,
startDate: _this.props.startDate,
endDate: _this.props.endDate,
utcOffset: _this.props.utcOffset }));
if (breakAfterNextPush) break;
i++;
currentWeekStart = currentWeekStart.clone().add(1, 'weeks');
// If one of these conditions is true, we will either break on this week
// or break on the next week
var isFixedAndFinalWeek = isFixedHeight && i >= FIXED_HEIGHT_STANDARD_WEEK_COUNT;
var isNonFixedAndOutOfMonth = !isFixedHeight && !_this.isWeekInMonth(currentWeekStart);
if (isFixedAndFinalWeek || isNonFixedAndOutOfMonth) {
if (_this.props.peekNextMonth) {
breakAfterNextPush = true;
} else {
break;
}
}
}
return weeks;
}, _this.getClassNames = function () {
var _this$props = _this.props,
selectingDate = _this$props.selectingDate,
selectsStart = _this$props.selectsStart,
selectsEnd = _this$props.selectsEnd;
return (0, _classnames2.default)('react-datepicker__month', {
'react-datepicker__month--selecting-range': selectingDate && (selectsStart || selectsEnd)
});
}, _temp), _possibleConstructorReturn(_this, _ret);
}
_createClass(Month, [{
key: 'render',
value: function render() {
return _react2.default.createElement(
'div',
{ className: this.getClassNames(), onMouseLeave: this.handleMouseLeave, role: 'listbox' },
this.renderWeeks()
);
}
}]);
return Month;
}(_react2.default.Component);
Month.propTypes = {
day: _propTypes2.default.object.isRequired,
endDate: _propTypes2.default.object,
excludeDates: _propTypes2.default.array,
filterDate: _propTypes2.default.func,
fixedHeight: _propTypes2.default.bool,
highlightDates: _propTypes2.default.array,
includeDates: _propTypes2.default.array,
inline: _propTypes2.default.bool,
maxDate: _propTypes2.default.object,
minDate: _propTypes2.default.object,
onDayClick: _propTypes2.default.func,
onDayMouseEnter: _propTypes2.default.func,
onMouseLeave: _propTypes2.default.func,
peekNextMonth: _propTypes2.default.bool,
preSelection: _propTypes2.default.object,
selected: _propTypes2.default.object,
selectingDate: _propTypes2.default.object,
selectsEnd: _propTypes2.default.bool,
selectsStart: _propTypes2.default.bool,
showWeekNumbers: _propTypes2.default.bool,
startDate: _propTypes2.default.object,
utcOffset: _propTypes2.default.number
};
exports.default = Month;
/***/ },
/* 15 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
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 _react = __webpack_require__(4);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(5);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _day = __webpack_require__(16);
var _day2 = _interopRequireDefault(_day);
var _week_number = __webpack_require__(18);
var _week_number2 = _interopRequireDefault(_week_number);
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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var Week = function (_React$Component) {
_inherits(Week, _React$Component);
function Week() {
var _ref;
var _temp, _this, _ret;
_classCallCheck(this, Week);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Week.__proto__ || Object.getPrototypeOf(Week)).call.apply(_ref, [this].concat(args))), _this), _this.handleDayClick = function (day, event) {
if (_this.props.onDayClick) {
_this.props.onDayClick(day, event);
}
}, _this.handleDayMouseEnter = function (day) {
if (_this.props.onDayMouseEnter) {
_this.props.onDayMouseEnter(day);
}
}, _this.renderDays = function () {
var startOfWeek = _this.props.day.clone().startOf('week');
var days = [];
if (_this.props.showWeekNumber) {
days.push(_react2.default.createElement(_week_number2.default, { key: 'W', weekNumber: parseInt(startOfWeek.format('w'), 10) }));
}
return days.concat([0, 1, 2, 3, 4, 5, 6].map(function (offset) {
var day = startOfWeek.clone().add(offset, 'days');
return _react2.default.createElement(_day2.default, {
key: offset,
day: day,
month: _this.props.month,
onClick: _this.handleDayClick.bind(_this, day),
onMouseEnter: _this.handleDayMouseEnter.bind(_this, day),
minDate: _this.props.minDate,
maxDate: _this.props.maxDate,
excludeDates: _this.props.excludeDates,
includeDates: _this.props.includeDates,
inline: _this.props.inline,
highlightDates: _this.props.highlightDates,
selectingDate: _this.props.selectingDate,
filterDate: _this.props.filterDate,
preSelection: _this.props.preSelection,
selected: _this.props.selected,
selectsStart: _this.props.selectsStart,
selectsEnd: _this.props.selectsEnd,
startDate: _this.props.startDate,
endDate: _this.props.endDate,
utcOffset: _this.props.utcOffset });
}));
}, _temp), _possibleConstructorReturn(_this, _ret);
}
_createClass(Week, [{
key: 'render',
value: function render() {
return _react2.default.createElement(
'div',
{ className: 'react-datepicker__week' },
this.renderDays()
);
}
}]);
return Week;
}(_react2.default.Component);
Week.propTypes = {
day: _propTypes2.default.object.isRequired,
endDate: _propTypes2.default.object,
excludeDates: _propTypes2.default.array,
filterDate: _propTypes2.default.func,
highlightDates: _propTypes2.default.array,
includeDates: _propTypes2.default.array,
inline: _propTypes2.default.bool,
maxDate: _propTypes2.default.object,
minDate: _propTypes2.default.object,
month: _propTypes2.default.number,
onDayClick: _propTypes2.default.func,
onDayMouseEnter: _propTypes2.default.func,
preSelection: _propTypes2.default.object,
selected: _propTypes2.default.object,
selectingDate: _propTypes2.default.object,
selectsEnd: _propTypes2.default.bool,
selectsStart: _propTypes2.default.bool,
showWeekNumber: _propTypes2.default.bool,
startDate: _propTypes2.default.object,
utcOffset: _propTypes2.default.number
};
exports.default = Week;
/***/ },
/* 16 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
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 _moment = __webpack_require__(2);
var _moment2 = _interopRequireDefault(_moment);
var _react = __webpack_require__(4);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(5);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _classnames = __webpack_require__(10);
var _classnames2 = _interopRequireDefault(_classnames);
var _date_utils = __webpack_require__(17);
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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var Day = function (_React$Component) {
_inherits(Day, _React$Component);
function Day() {
var _ref;
var _temp, _this, _ret;
_classCallCheck(this, Day);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Day.__proto__ || Object.getPrototypeOf(Day)).call.apply(_ref, [this].concat(args))), _this), _this.handleClick = function (event) {
if (!_this.isDisabled() && _this.props.onClick) {
_this.props.onClick(event);
}
}, _this.handleMouseEnter = function (event) {
if (!_this.isDisabled() && _this.props.onMouseEnter) {
_this.props.onMouseEnter(event);
}
}, _this.isSameDay = function (other) {
return (0, _date_utils.isSameDay)(_this.props.day, other);
}, _this.isKeyboardSelected = function () {
return !_this.props.inline && !_this.isSameDay(_this.props.selected) && _this.isSameDay(_this.props.preSelection);
}, _this.isDisabled = function () {
return (0, _date_utils.isDayDisabled)(_this.props.day, _this.props);
}, _this.isHighlighted = function () {
var _this$props = _this.props,
day = _this$props.day,
highlightDates = _this$props.highlightDates;
if (!highlightDates) {
return false;
}
return highlightDates.some(function (testDay) {
return (0, _date_utils.isSameDay)(day, testDay);
});
}, _this.isInRange = function () {
var _this$props2 = _this.props,
day = _this$props2.day,
startDate = _this$props2.startDate,
endDate = _this$props2.endDate;
if (!startDate || !endDate) {
return false;
}
return (0, _date_utils.isDayInRange)(day, startDate, endDate);
}, _this.isInSelectingRange = function () {
var _this$props3 = _this.props,
day = _this$props3.day,
selectsStart = _this$props3.selectsStart,
selectsEnd = _this$props3.selectsEnd,
selectingDate = _this$props3.selectingDate,
startDate = _this$props3.startDate,
endDate = _this$props3.endDate;
if (!(selectsStart || selectsEnd) || !selectingDate || _this.isDisabled()) {
return false;
}
if (selectsStart && endDate && selectingDate.isSameOrBefore(endDate)) {
return (0, _date_utils.isDayInRange)(day, selectingDate, endDate);
}
if (selectsEnd && startDate && selectingDate.isSameOrAfter(startDate)) {
return (0, _date_utils.isDayInRange)(day, startDate, selectingDate);
}
return false;
}, _this.isSelectingRangeStart = function () {
if (!_this.isInSelectingRange()) {
return false;
}
var _this$props4 = _this.props,
day = _this$props4.day,
selectingDate = _this$props4.selectingDate,
startDate = _this$props4.startDate,
selectsStart = _this$props4.selectsStart;
if (selectsStart) {
return (0, _date_utils.isSameDay)(day, selectingDate);
} else {
return (0, _date_utils.isSameDay)(day, startDate);
}
}, _this.isSelectingRangeEnd = function () {
if (!_this.isInSelectingRange()) {
return false;
}
var _this$props5 = _this.props,
day = _this$props5.day,
selectingDate = _this$props5.selectingDate,
endDate = _this$props5.endDate,
selectsEnd = _this$props5.selectsEnd;
if (selectsEnd) {
return (0, _date_utils.isSameDay)(day, selectingDate);
} else {
return (0, _date_utils.isSameDay)(day, endDate);
}
}, _this.isRangeStart = function () {
var _this$props6 = _this.props,
day = _this$props6.day,
startDate = _this$props6.startDate,
endDate = _this$props6.endDate;
if (!startDate || !endDate) {
return false;
}
return (0, _date_utils.isSameDay)(startDate, day);
}, _this.isRangeEnd = function () {
var _this$props7 = _this.props,
day = _this$props7.day,
startDate = _this$props7.startDate,
endDate = _this$props7.endDate;
if (!startDate || !endDate) {
return false;
}
return (0, _date_utils.isSameDay)(endDate, day);
}, _this.isWeekend = function () {
var weekday = _this.props.day.day();
return weekday === 0 || weekday === 6;
}, _this.isOutsideMonth = function () {
return _this.props.month !== undefined && _this.props.month !== _this.props.day.month();
}, _this.getClassNames = function () {
return (0, _classnames2.default)('react-datepicker__day', {
'react-datepicker__day--disabled': _this.isDisabled(),
'react-datepicker__day--selected': _this.isSameDay(_this.props.selected),
'react-datepicker__day--keyboard-selected': _this.isKeyboardSelected(),
'react-datepicker__day--highlighted': _this.isHighlighted(),
'react-datepicker__day--range-start': _this.isRangeStart(),
'react-datepicker__day--range-end': _this.isRangeEnd(),
'react-datepicker__day--in-range': _this.isInRange(),
'react-datepicker__day--in-selecting-range': _this.isInSelectingRange(),
'react-datepicker__day--selecting-range-start': _this.isSelectingRangeStart(),
'react-datepicker__day--selecting-range-end': _this.isSelectingRangeEnd(),
'react-datepicker__day--today': _this.isSameDay(_moment2.default.utc().utcOffset(_this.props.utcOffset)),
'react-datepicker__day--weekend': _this.isWeekend(),
'react-datepicker__day--outside-month': _this.isOutsideMonth()
});
}, _temp), _possibleConstructorReturn(_this, _ret);
}
_createClass(Day, [{
key: 'render',
value: function render() {
return _react2.default.createElement(
'div',
{
className: this.getClassNames(),
onClick: this.handleClick,
onMouseEnter: this.handleMouseEnter,
'aria-label': 'day-' + this.props.day.date(),
role: 'option' },
this.props.day.date()
);
}
}]);
return Day;
}(_react2.default.Component);
Day.propTypes = {
day: _propTypes2.default.object.isRequired,
endDate: _propTypes2.default.object,
highlightDates: _propTypes2.default.array,
inline: _propTypes2.default.bool,
month: _propTypes2.default.number,
onClick: _propTypes2.default.func,
onMouseEnter: _propTypes2.default.func,
preSelection: _propTypes2.default.object,
selected: _propTypes2.default.object,
selectingDate: _propTypes2.default.object,
selectsEnd: _propTypes2.default.bool,
selectsStart: _propTypes2.default.bool,
startDate: _propTypes2.default.object,
utcOffset: _propTypes2.default.number
};
Day.defaultProps = {
utcOffset: _moment2.default.utc().utcOffset()
};
exports.default = Day;
/***/ },
/* 17 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isSameDay = isSameDay;
exports.isSameUtcOffset = isSameUtcOffset;
exports.isDayInRange = isDayInRange;
exports.isDayDisabled = isDayDisabled;
exports.allDaysDisabledBefore = allDaysDisabledBefore;
exports.allDaysDisabledAfter = allDaysDisabledAfter;
exports.getEffectiveMinDate = getEffectiveMinDate;
exports.getEffectiveMaxDate = getEffectiveMaxDate;
exports.parseDate = parseDate;
exports.safeDateFormat = safeDateFormat;
var _moment = __webpack_require__(2);
var _moment2 = _interopRequireDefault(_moment);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function isSameDay(moment1, moment2) {
if (moment1 && moment2) {
return moment1.isSame(moment2, 'day');
} else {
return !moment1 && !moment2;
}
}
function isSameUtcOffset(moment1, moment2) {
if (moment1 && moment2) {
return moment1.utcOffset() === moment2.utcOffset();
} else {
return !moment1 && !moment2;
}
}
function isDayInRange(day, startDate, endDate) {
var before = startDate.clone().startOf('day').subtract(1, 'seconds');
var after = endDate.clone().startOf('day').add(1, 'seconds');
return day.clone().startOf('day').isBetween(before, after);
}
function isDayDisabled(day) {
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
minDate = _ref.minDate,
maxDate = _ref.maxDate,
excludeDates = _ref.excludeDates,
includeDates = _ref.includeDates,
filterDate = _ref.filterDate;
return minDate && day.isBefore(minDate, 'day') || maxDate && day.isAfter(maxDate, 'day') || excludeDates && excludeDates.some(function (excludeDate) {
return isSameDay(day, excludeDate);
}) || includeDates && !includeDates.some(function (includeDate) {
return isSameDay(day, includeDate);
}) || filterDate && !filterDate(day.clone()) || false;
}
function allDaysDisabledBefore(day, unit) {
var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
minDate = _ref2.minDate,
includeDates = _ref2.includeDates;
var dateBefore = day.clone().subtract(1, unit);
return minDate && dateBefore.isBefore(minDate, unit) || includeDates && includeDates.every(function (includeDate) {
return dateBefore.isBefore(includeDate, unit);
}) || false;
}
function allDaysDisabledAfter(day, unit) {
var _ref3 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
maxDate = _ref3.maxDate,
includeDates = _ref3.includeDates;
var dateAfter = day.clone().add(1, unit);
return maxDate && dateAfter.isAfter(maxDate, unit) || includeDates && includeDates.every(function (includeDate) {
return dateAfter.isAfter(includeDate, unit);
}) || false;
}
function getEffectiveMinDate(_ref4) {
var minDate = _ref4.minDate,
includeDates = _ref4.includeDates;
if (includeDates && minDate) {
return _moment2.default.min(includeDates.filter(function (includeDate) {
return minDate.isSameOrBefore(includeDate, 'day');
}));
} else if (includeDates) {
return _moment2.default.min(includeDates);
} else {
return minDate;
}
}
function getEffectiveMaxDate(_ref5) {
var maxDate = _ref5.maxDate,
includeDates = _ref5.includeDates;
if (includeDates && maxDate) {
return _moment2.default.max(includeDates.filter(function (includeDate) {
return maxDate.isSameOrAfter(includeDate, 'day');
}));
} else if (includeDates) {
return _moment2.default.max(includeDates);
} else {
return maxDate;
}
}
function parseDate(value, _ref6) {
var dateFormat = _ref6.dateFormat,
locale = _ref6.locale;
var m = (0, _moment2.default)(value, dateFormat, locale || _moment2.default.locale(), true);
return m.isValid() ? m : null;
}
function safeDateFormat(date, _ref7) {
var dateFormat = _ref7.dateFormat,
locale = _ref7.locale;
return date && date.clone().locale(locale || _moment2.default.locale()).format(Array.isArray(dateFormat) ? dateFormat[0] : dateFormat) || '';
}
/***/ },
/* 18 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
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 _react = __webpack_require__(4);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(5);
var _propTypes2 = _interopRequireDefault(_propTypes);
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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var WeekNumber = function (_React$Component) {
_inherits(WeekNumber, _React$Component);
function WeekNumber() {
_classCallCheck(this, WeekNumber);
return _possibleConstructorReturn(this, (WeekNumber.__proto__ || Object.getPrototypeOf(WeekNumber)).apply(this, arguments));
}
_createClass(WeekNumber, [{
key: 'render',
value: function render() {
return _react2.default.createElement(
'div',
{
className: 'react-datepicker__week-number',
'aria-label': 'week-' + this.props.weekNumber },
this.props.weekNumber
);
}
}]);
return WeekNumber;
}(_react2.default.Component);
WeekNumber.propTypes = {
weekNumber: _propTypes2.default.number.isRequired
};
exports.default = WeekNumber;
/***/ },
/* 19 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _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 _react = __webpack_require__(4);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(5);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _reactDom = __webpack_require__(20);
var _reactDom2 = _interopRequireDefault(_reactDom);
var _tether = __webpack_require__(21);
var _tether2 = _interopRequireDefault(_tether);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function childrenPropType(_ref, propName, componentName) {
var children = _ref.children;
var childCount = _react2.default.Children.count(children);
if (childCount <= 0) {
return new Error(componentName + ' expects at least one child to use as the target element.');
} else if (childCount > 2) {
return new Error('Only a max of two children allowed in ' + componentName + '.');
}
}
var attachmentPositions = ['top left', 'top center', 'top right', 'middle left', 'middle center', 'middle right', 'bottom left', 'bottom center', 'bottom right'];
var TetherComponent = function (_React$Component) {
_inherits(TetherComponent, _React$Component);
function TetherComponent() {
var _ref2;
var _temp, _this, _ret;
_classCallCheck(this, TetherComponent);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref2 = TetherComponent.__proto__ || Object.getPrototypeOf(TetherComponent)).call.apply(_ref2, [this].concat(args))), _this), _this.disable = function () {
return _this._tether.disable();
}, _this.enable = function () {
return _this._tether.enable();
}, _this.position = function () {
return _this._tether.position();
}, _this._destroy = function () {
if (_this._elementParentNode) {
_reactDom2.default.unmountComponentAtNode(_this._elementParentNode);
_this._elementParentNode.parentNode.removeChild(_this._elementParentNode);
}
if (_this._tether) {
_this._tether.destroy();
}
_this._elementParentNode = null;
_this._tether = null;
}, _this._update = function () {
var _this$props = _this.props,
children = _this$props.children,
renderElementTag = _this$props.renderElementTag,
renderElementTo = _this$props.renderElementTo;
var elementComponent = children[1];
// if no element component provided, bail out
if (!elementComponent) {
// destroy Tether elements if they have been created
if (_this._tether) {
_this._destroy();
}
return;
}
// create element node container if it hasn't been yet
if (!_this._elementParentNode) {
// create a node that we can stick our content Component in
_this._elementParentNode = document.createElement(renderElementTag);
// append node to the end of the body
var renderTo = renderElementTo || document.body;
renderTo.appendChild(_this._elementParentNode);
}
// render element component into the DOM
_reactDom2.default.unstable_renderSubtreeIntoContainer(_this, elementComponent, _this._elementParentNode, function () {
// don't update Tether until the subtree has finished rendering
_this._updateTether();
});
}, _this._updateTether = function () {
var _this$props2 = _this.props,
renderElementTag = _this$props2.renderElementTag,
renderElementTo = _this$props2.renderElementTo,
options = _objectWithoutProperties(_this$props2, ['renderElementTag', 'renderElementTo']); // eslint-disable-line no-unused-vars
var tetherOptions = _extends({
target: _this._targetNode,
element: _this._elementParentNode
}, options);
if (!_this._tether) {
_this._tether = new _tether2.default(tetherOptions);
} else {
_this._tether.setOptions(tetherOptions);
}
_this._tether.position();
}, _temp), _possibleConstructorReturn(_this, _ret);
}
_createClass(TetherComponent, [{
key: 'componentDidMount',
value: function componentDidMount() {
this._targetNode = _reactDom2.default.findDOMNode(this);
this._update();
}
}, {
key: 'componentDidUpdate',
value: function componentDidUpdate() {
this._update();
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
this._destroy();
}
}, {
key: 'render',
value: function render() {
var children = this.props.children;
var firstChild = null;
// we use forEach because the second child could be null
// causing children to not be an array
_react2.default.Children.forEach(children, function (child, index) {
if (index === 0) {
firstChild = child;
return false;
}
});
return firstChild;
}
}]);
return TetherComponent;
}(_react2.default.Component);
TetherComponent.propTypes = {
attachment: _propTypes2.default.oneOf(attachmentPositions).isRequired,
children: childrenPropType,
className: _propTypes2.default.string,
classPrefix: _propTypes2.default.string,
classes: _propTypes2.default.object,
constraints: _propTypes2.default.array,
enabled: _propTypes2.default.bool,
id: _propTypes2.default.string,
offset: _propTypes2.default.string,
optimizations: _propTypes2.default.object,
renderElementTag: _propTypes2.default.string,
renderElementTo: _propTypes2.default.any,
style: _propTypes2.default.object,
targetAttachment: _propTypes2.default.oneOf(attachmentPositions),
targetModifier: _propTypes2.default.string,
targetOffset: _propTypes2.default.string
};
TetherComponent.defaultProps = {
renderElementTag: 'div',
renderElementTo: null
};
exports.default = TetherComponent;
/***/ },
/* 20 */
/***/ function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_20__;
/***/ },
/* 21 */
/***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! tether 1.4.0 */
(function(root, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else if (typeof exports === 'object') {
module.exports = factory(require, exports, module);
} else {
root.Tether = factory();
}
}(this, function(require, exports, module) {
'use strict';
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; }; })();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
var TetherBase = undefined;
if (typeof TetherBase === 'undefined') {
TetherBase = { modules: [] };
}
var zeroElement = null;
// Same as native getBoundingClientRect, except it takes into account parent <frame> offsets
// if the element lies within a nested document (<frame> or <iframe>-like).
function getActualBoundingClientRect(node) {
var boundingRect = node.getBoundingClientRect();
// The original object returned by getBoundingClientRect is immutable, so we clone it
// We can't use extend because the properties are not considered part of the object by hasOwnProperty in IE9
var rect = {};
for (var k in boundingRect) {
rect[k] = boundingRect[k];
}
if (node.ownerDocument !== document) {
var _frameElement = node.ownerDocument.defaultView.frameElement;
if (_frameElement) {
var frameRect = getActualBoundingClientRect(_frameElement);
rect.top += frameRect.top;
rect.bottom += frameRect.top;
rect.left += frameRect.left;
rect.right += frameRect.left;
}
}
return rect;
}
function getScrollParents(el) {
// In firefox if the el is inside an iframe with display: none; window.getComputedStyle() will return null;
// https://bugzilla.mozilla.org/show_bug.cgi?id=548397
var computedStyle = getComputedStyle(el) || {};
var position = computedStyle.position;
var parents = [];
if (position === 'fixed') {
return [el];
}
var parent = el;
while ((parent = parent.parentNode) && parent && parent.nodeType === 1) {
var style = undefined;
try {
style = getComputedStyle(parent);
} catch (err) {}
if (typeof style === 'undefined' || style === null) {
parents.push(parent);
return parents;
}
var _style = style;
var overflow = _style.overflow;
var overflowX = _style.overflowX;
var overflowY = _style.overflowY;
if (/(auto|scroll)/.test(overflow + overflowY + overflowX)) {
if (position !== 'absolute' || ['relative', 'absolute', 'fixed'].indexOf(style.position) >= 0) {
parents.push(parent);
}
}
}
parents.push(el.ownerDocument.body);
// If the node is within a frame, account for the parent window scroll
if (el.ownerDocument !== document) {
parents.push(el.ownerDocument.defaultView);
}
return parents;
}
var uniqueId = (function () {
var id = 0;
return function () {
return ++id;
};
})();
var zeroPosCache = {};
var getOrigin = function getOrigin() {
// getBoundingClientRect is unfortunately too accurate. It introduces a pixel or two of
// jitter as the user scrolls that messes with our ability to detect if two positions
// are equivilant or not. We place an element at the top left of the page that will
// get the same jitter, so we can cancel the two out.
var node = zeroElement;
if (!node || !document.body.contains(node)) {
node = document.createElement('div');
node.setAttribute('data-tether-id', uniqueId());
extend(node.style, {
top: 0,
left: 0,
position: 'absolute'
});
document.body.appendChild(node);
zeroElement = node;
}
var id = node.getAttribute('data-tether-id');
if (typeof zeroPosCache[id] === 'undefined') {
zeroPosCache[id] = getActualBoundingClientRect(node);
// Clear the cache when this position call is done
defer(function () {
delete zeroPosCache[id];
});
}
return zeroPosCache[id];
};
function removeUtilElements() {
if (zeroElement) {
document.body.removeChild(zeroElement);
}
zeroElement = null;
};
function getBounds(el) {
var doc = undefined;
if (el === document) {
doc = document;
el = document.documentElement;
} else {
doc = el.ownerDocument;
}
var docEl = doc.documentElement;
var box = getActualBoundingClientRect(el);
var origin = getOrigin();
box.top -= origin.top;
box.left -= origin.left;
if (typeof box.width === 'undefined') {
box.width = document.body.scrollWidth - box.left - box.right;
}
if (typeof box.height === 'undefined') {
box.height = document.body.scrollHeight - box.top - box.bottom;
}
box.top = box.top - docEl.clientTop;
box.left = box.left - docEl.clientLeft;
box.right = doc.body.clientWidth - box.width - box.left;
box.bottom = doc.body.clientHeight - box.height - box.top;
return box;
}
function getOffsetParent(el) {
return el.offsetParent || document.documentElement;
}
var _scrollBarSize = null;
function getScrollBarSize() {
if (_scrollBarSize) {
return _scrollBarSize;
}
var inner = document.createElement('div');
inner.style.width = '100%';
inner.style.height = '200px';
var outer = document.createElement('div');
extend(outer.style, {
position: 'absolute',
top: 0,
left: 0,
pointerEvents: 'none',
visibility: 'hidden',
width: '200px',
height: '150px',
overflow: 'hidden'
});
outer.appendChild(inner);
document.body.appendChild(outer);
var widthContained = inner.offsetWidth;
outer.style.overflow = 'scroll';
var widthScroll = inner.offsetWidth;
if (widthContained === widthScroll) {
widthScroll = outer.clientWidth;
}
document.body.removeChild(outer);
var width = widthContained - widthScroll;
_scrollBarSize = { width: width, height: width };
return _scrollBarSize;
}
function extend() {
var out = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var args = [];
Array.prototype.push.apply(args, arguments);
args.slice(1).forEach(function (obj) {
if (obj) {
for (var key in obj) {
if (({}).hasOwnProperty.call(obj, key)) {
out[key] = obj[key];
}
}
}
});
return out;
}
function removeClass(el, name) {
if (typeof el.classList !== 'undefined') {
name.split(' ').forEach(function (cls) {
if (cls.trim()) {
el.classList.remove(cls);
}
});
} else {
var regex = new RegExp('(^| )' + name.split(' ').join('|') + '( |$)', 'gi');
var className = getClassName(el).replace(regex, ' ');
setClassName(el, className);
}
}
function addClass(el, name) {
if (typeof el.classList !== 'undefined') {
name.split(' ').forEach(function (cls) {
if (cls.trim()) {
el.classList.add(cls);
}
});
} else {
removeClass(el, name);
var cls = getClassName(el) + (' ' + name);
setClassName(el, cls);
}
}
function hasClass(el, name) {
if (typeof el.classList !== 'undefined') {
return el.classList.contains(name);
}
var className = getClassName(el);
return new RegExp('(^| )' + name + '( |$)', 'gi').test(className);
}
function getClassName(el) {
// Can't use just SVGAnimatedString here since nodes within a Frame in IE have
// completely separately SVGAnimatedString base classes
if (el.className instanceof el.ownerDocument.defaultView.SVGAnimatedString) {
return el.className.baseVal;
}
return el.className;
}
function setClassName(el, className) {
el.setAttribute('class', className);
}
function updateClasses(el, add, all) {
// Of the set of 'all' classes, we need the 'add' classes, and only the
// 'add' classes to be set.
all.forEach(function (cls) {
if (add.indexOf(cls) === -1 && hasClass(el, cls)) {
removeClass(el, cls);
}
});
add.forEach(function (cls) {
if (!hasClass(el, cls)) {
addClass(el, cls);
}
});
}
var deferred = [];
var defer = function defer(fn) {
deferred.push(fn);
};
var flush = function flush() {
var fn = undefined;
while (fn = deferred.pop()) {
fn();
}
};
var Evented = (function () {
function Evented() {
_classCallCheck(this, Evented);
}
_createClass(Evented, [{
key: 'on',
value: function on(event, handler, ctx) {
var once = arguments.length <= 3 || arguments[3] === undefined ? false : arguments[3];
if (typeof this.bindings === 'undefined') {
this.bindings = {};
}
if (typeof this.bindings[event] === 'undefined') {
this.bindings[event] = [];
}
this.bindings[event].push({ handler: handler, ctx: ctx, once: once });
}
}, {
key: 'once',
value: function once(event, handler, ctx) {
this.on(event, handler, ctx, true);
}
}, {
key: 'off',
value: function off(event, handler) {
if (typeof this.bindings === 'undefined' || typeof this.bindings[event] === 'undefined') {
return;
}
if (typeof handler === 'undefined') {
delete this.bindings[event];
} else {
var i = 0;
while (i < this.bindings[event].length) {
if (this.bindings[event][i].handler === handler) {
this.bindings[event].splice(i, 1);
} else {
++i;
}
}
}
}
}, {
key: 'trigger',
value: function trigger(event) {
if (typeof this.bindings !== 'undefined' && this.bindings[event]) {
var i = 0;
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
while (i < this.bindings[event].length) {
var _bindings$event$i = this.bindings[event][i];
var handler = _bindings$event$i.handler;
var ctx = _bindings$event$i.ctx;
var once = _bindings$event$i.once;
var context = ctx;
if (typeof context === 'undefined') {
context = this;
}
handler.apply(context, args);
if (once) {
this.bindings[event].splice(i, 1);
} else {
++i;
}
}
}
}
}]);
return Evented;
})();
TetherBase.Utils = {
getActualBoundingClientRect: getActualBoundingClientRect,
getScrollParents: getScrollParents,
getBounds: getBounds,
getOffsetParent: getOffsetParent,
extend: extend,
addClass: addClass,
removeClass: removeClass,
hasClass: hasClass,
updateClasses: updateClasses,
defer: defer,
flush: flush,
uniqueId: uniqueId,
Evented: Evented,
getScrollBarSize: getScrollBarSize,
removeUtilElements: removeUtilElements
};
/* globals TetherBase, performance */
'use strict';
var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();
var _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 _get = function get(_x6, _x7, _x8) { var _again = true; _function: while (_again) { var object = _x6, property = _x7, receiver = _x8; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x6 = parent; _x7 = property; _x8 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
if (typeof TetherBase === 'undefined') {
throw new Error('You must include the utils.js file before tether.js');
}
var _TetherBase$Utils = TetherBase.Utils;
var getScrollParents = _TetherBase$Utils.getScrollParents;
var getBounds = _TetherBase$Utils.getBounds;
var getOffsetParent = _TetherBase$Utils.getOffsetParent;
var extend = _TetherBase$Utils.extend;
var addClass = _TetherBase$Utils.addClass;
var removeClass = _TetherBase$Utils.removeClass;
var updateClasses = _TetherBase$Utils.updateClasses;
var defer = _TetherBase$Utils.defer;
var flush = _TetherBase$Utils.flush;
var getScrollBarSize = _TetherBase$Utils.getScrollBarSize;
var removeUtilElements = _TetherBase$Utils.removeUtilElements;
function within(a, b) {
var diff = arguments.length <= 2 || arguments[2] === undefined ? 1 : arguments[2];
return a + diff >= b && b >= a - diff;
}
var transformKey = (function () {
if (typeof document === 'undefined') {
return '';
}
var el = document.createElement('div');
var transforms = ['transform', 'WebkitTransform', 'OTransform', 'MozTransform', 'msTransform'];
for (var i = 0; i < transforms.length; ++i) {
var key = transforms[i];
if (el.style[key] !== undefined) {
return key;
}
}
})();
var tethers = [];
var position = function position() {
tethers.forEach(function (tether) {
tether.position(false);
});
flush();
};
function now() {
if (typeof performance !== 'undefined' && typeof performance.now !== 'undefined') {
return performance.now();
}
return +new Date();
}
(function () {
var lastCall = null;
var lastDuration = null;
var pendingTimeout = null;
var tick = function tick() {
if (typeof lastDuration !== 'undefined' && lastDuration > 16) {
// We voluntarily throttle ourselves if we can't manage 60fps
lastDuration = Math.min(lastDuration - 16, 250);
// Just in case this is the last event, remember to position just once more
pendingTimeout = setTimeout(tick, 250);
return;
}
if (typeof lastCall !== 'undefined' && now() - lastCall < 10) {
// Some browsers call events a little too frequently, refuse to run more than is reasonable
return;
}
if (pendingTimeout != null) {
clearTimeout(pendingTimeout);
pendingTimeout = null;
}
lastCall = now();
position();
lastDuration = now() - lastCall;
};
if (typeof window !== 'undefined' && typeof window.addEventListener !== 'undefined') {
['resize', 'scroll', 'touchmove'].forEach(function (event) {
window.addEventListener(event, tick);
});
}
})();
var MIRROR_LR = {
center: 'center',
left: 'right',
right: 'left'
};
var MIRROR_TB = {
middle: 'middle',
top: 'bottom',
bottom: 'top'
};
var OFFSET_MAP = {
top: 0,
left: 0,
middle: '50%',
center: '50%',
bottom: '100%',
right: '100%'
};
var autoToFixedAttachment = function autoToFixedAttachment(attachment, relativeToAttachment) {
var left = attachment.left;
var top = attachment.top;
if (left === 'auto') {
left = MIRROR_LR[relativeToAttachment.left];
}
if (top === 'auto') {
top = MIRROR_TB[relativeToAttachment.top];
}
return { left: left, top: top };
};
var attachmentToOffset = function attachmentToOffset(attachment) {
var left = attachment.left;
var top = attachment.top;
if (typeof OFFSET_MAP[attachment.left] !== 'undefined') {
left = OFFSET_MAP[attachment.left];
}
if (typeof OFFSET_MAP[attachment.top] !== 'undefined') {
top = OFFSET_MAP[attachment.top];
}
return { left: left, top: top };
};
function addOffset() {
var out = { top: 0, left: 0 };
for (var _len = arguments.length, offsets = Array(_len), _key = 0; _key < _len; _key++) {
offsets[_key] = arguments[_key];
}
offsets.forEach(function (_ref) {
var top = _ref.top;
var left = _ref.left;
if (typeof top === 'string') {
top = parseFloat(top, 10);
}
if (typeof left === 'string') {
left = parseFloat(left, 10);
}
out.top += top;
out.left += left;
});
return out;
}
function offsetToPx(offset, size) {
if (typeof offset.left === 'string' && offset.left.indexOf('%') !== -1) {
offset.left = parseFloat(offset.left, 10) / 100 * size.width;
}
if (typeof offset.top === 'string' && offset.top.indexOf('%') !== -1) {
offset.top = parseFloat(offset.top, 10) / 100 * size.height;
}
return offset;
}
var parseOffset = function parseOffset(value) {
var _value$split = value.split(' ');
var _value$split2 = _slicedToArray(_value$split, 2);
var top = _value$split2[0];
var left = _value$split2[1];
return { top: top, left: left };
};
var parseAttachment = parseOffset;
var TetherClass = (function (_Evented) {
_inherits(TetherClass, _Evented);
function TetherClass(options) {
var _this = this;
_classCallCheck(this, TetherClass);
_get(Object.getPrototypeOf(TetherClass.prototype), 'constructor', this).call(this);
this.position = this.position.bind(this);
tethers.push(this);
this.history = [];
this.setOptions(options, false);
TetherBase.modules.forEach(function (module) {
if (typeof module.initialize !== 'undefined') {
module.initialize.call(_this);
}
});
this.position();
}
_createClass(TetherClass, [{
key: 'getClass',
value: function getClass() {
var key = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];
var classes = this.options.classes;
if (typeof classes !== 'undefined' && classes[key]) {
return this.options.classes[key];
} else if (this.options.classPrefix) {
return this.options.classPrefix + '-' + key;
} else {
return key;
}
}
}, {
key: 'setOptions',
value: function setOptions(options) {
var _this2 = this;
var pos = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1];
var defaults = {
offset: '0 0',
targetOffset: '0 0',
targetAttachment: 'auto auto',
classPrefix: 'tether'
};
this.options = extend(defaults, options);
var _options = this.options;
var element = _options.element;
var target = _options.target;
var targetModifier = _options.targetModifier;
this.element = element;
this.target = target;
this.targetModifier = targetModifier;
if (this.target === 'viewport') {
this.target = document.body;
this.targetModifier = 'visible';
} else if (this.target === 'scroll-handle') {
this.target = document.body;
this.targetModifier = 'scroll-handle';
}
['element', 'target'].forEach(function (key) {
if (typeof _this2[key] === 'undefined') {
throw new Error('Tether Error: Both element and target must be defined');
}
if (typeof _this2[key].jquery !== 'undefined') {
_this2[key] = _this2[key][0];
} else if (typeof _this2[key] === 'string') {
_this2[key] = document.querySelector(_this2[key]);
}
});
addClass(this.element, this.getClass('element'));
if (!(this.options.addTargetClasses === false)) {
addClass(this.target, this.getClass('target'));
}
if (!this.options.attachment) {
throw new Error('Tether Error: You must provide an attachment');
}
this.targetAttachment = parseAttachment(this.options.targetAttachment);
this.attachment = parseAttachment(this.options.attachment);
this.offset = parseOffset(this.options.offset);
this.targetOffset = parseOffset(this.options.targetOffset);
if (typeof this.scrollParents !== 'undefined') {
this.disable();
}
if (this.targetModifier === 'scroll-handle') {
this.scrollParents = [this.target];
} else {
this.scrollParents = getScrollParents(this.target);
}
if (!(this.options.enabled === false)) {
this.enable(pos);
}
}
}, {
key: 'getTargetBounds',
value: function getTargetBounds() {
if (typeof this.targetModifier !== 'undefined') {
if (this.targetModifier === 'visible') {
if (this.target === document.body) {
return { top: pageYOffset, left: pageXOffset, height: innerHeight, width: innerWidth };
} else {
var bounds = getBounds(this.target);
var out = {
height: bounds.height,
width: bounds.width,
top: bounds.top,
left: bounds.left
};
out.height = Math.min(out.height, bounds.height - (pageYOffset - bounds.top));
out.height = Math.min(out.height, bounds.height - (bounds.top + bounds.height - (pageYOffset + innerHeight)));
out.height = Math.min(innerHeight, out.height);
out.height -= 2;
out.width = Math.min(out.width, bounds.width - (pageXOffset - bounds.left));
out.width = Math.min(out.width, bounds.width - (bounds.left + bounds.width - (pageXOffset + innerWidth)));
out.width = Math.min(innerWidth, out.width);
out.width -= 2;
if (out.top < pageYOffset) {
out.top = pageYOffset;
}
if (out.left < pageXOffset) {
out.left = pageXOffset;
}
return out;
}
} else if (this.targetModifier === 'scroll-handle') {
var bounds = undefined;
var target = this.target;
if (target === document.body) {
target = document.documentElement;
bounds = {
left: pageXOffset,
top: pageYOffset,
height: innerHeight,
width: innerWidth
};
} else {
bounds = getBounds(target);
}
var style = getComputedStyle(target);
var hasBottomScroll = target.scrollWidth > target.clientWidth || [style.overflow, style.overflowX].indexOf('scroll') >= 0 || this.target !== document.body;
var scrollBottom = 0;
if (hasBottomScroll) {
scrollBottom = 15;
}
var height = bounds.height - parseFloat(style.borderTopWidth) - parseFloat(style.borderBottomWidth) - scrollBottom;
var out = {
width: 15,
height: height * 0.975 * (height / target.scrollHeight),
left: bounds.left + bounds.width - parseFloat(style.borderLeftWidth) - 15
};
var fitAdj = 0;
if (height < 408 && this.target === document.body) {
fitAdj = -0.00011 * Math.pow(height, 2) - 0.00727 * height + 22.58;
}
if (this.target !== document.body) {
out.height = Math.max(out.height, 24);
}
var scrollPercentage = this.target.scrollTop / (target.scrollHeight - height);
out.top = scrollPercentage * (height - out.height - fitAdj) + bounds.top + parseFloat(style.borderTopWidth);
if (this.target === document.body) {
out.height = Math.max(out.height, 24);
}
return out;
}
} else {
return getBounds(this.target);
}
}
}, {
key: 'clearCache',
value: function clearCache() {
this._cache = {};
}
}, {
key: 'cache',
value: function cache(k, getter) {
// More than one module will often need the same DOM info, so
// we keep a cache which is cleared on each position call
if (typeof this._cache === 'undefined') {
this._cache = {};
}
if (typeof this._cache[k] === 'undefined') {
this._cache[k] = getter.call(this);
}
return this._cache[k];
}
}, {
key: 'enable',
value: function enable() {
var _this3 = this;
var pos = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0];
if (!(this.options.addTargetClasses === false)) {
addClass(this.target, this.getClass('enabled'));
}
addClass(this.element, this.getClass('enabled'));
this.enabled = true;
this.scrollParents.forEach(function (parent) {
if (parent !== _this3.target.ownerDocument) {
parent.addEventListener('scroll', _this3.position);
}
});
if (pos) {
this.position();
}
}
}, {
key: 'disable',
value: function disable() {
var _this4 = this;
removeClass(this.target, this.getClass('enabled'));
removeClass(this.element, this.getClass('enabled'));
this.enabled = false;
if (typeof this.scrollParents !== 'undefined') {
this.scrollParents.forEach(function (parent) {
parent.removeEventListener('scroll', _this4.position);
});
}
}
}, {
key: 'destroy',
value: function destroy() {
var _this5 = this;
this.disable();
tethers.forEach(function (tether, i) {
if (tether === _this5) {
tethers.splice(i, 1);
}
});
// Remove any elements we were using for convenience from the DOM
if (tethers.length === 0) {
removeUtilElements();
}
}
}, {
key: 'updateAttachClasses',
value: function updateAttachClasses(elementAttach, targetAttach) {
var _this6 = this;
elementAttach = elementAttach || this.attachment;
targetAttach = targetAttach || this.targetAttachment;
var sides = ['left', 'top', 'bottom', 'right', 'middle', 'center'];
if (typeof this._addAttachClasses !== 'undefined' && this._addAttachClasses.length) {
// updateAttachClasses can be called more than once in a position call, so
// we need to clean up after ourselves such that when the last defer gets
// ran it doesn't add any extra classes from previous calls.
this._addAttachClasses.splice(0, this._addAttachClasses.length);
}
if (typeof this._addAttachClasses === 'undefined') {
this._addAttachClasses = [];
}
var add = this._addAttachClasses;
if (elementAttach.top) {
add.push(this.getClass('element-attached') + '-' + elementAttach.top);
}
if (elementAttach.left) {
add.push(this.getClass('element-attached') + '-' + elementAttach.left);
}
if (targetAttach.top) {
add.push(this.getClass('target-attached') + '-' + targetAttach.top);
}
if (targetAttach.left) {
add.push(this.getClass('target-attached') + '-' + targetAttach.left);
}
var all = [];
sides.forEach(function (side) {
all.push(_this6.getClass('element-attached') + '-' + side);
all.push(_this6.getClass('target-attached') + '-' + side);
});
defer(function () {
if (!(typeof _this6._addAttachClasses !== 'undefined')) {
return;
}
updateClasses(_this6.element, _this6._addAttachClasses, all);
if (!(_this6.options.addTargetClasses === false)) {
updateClasses(_this6.target, _this6._addAttachClasses, all);
}
delete _this6._addAttachClasses;
});
}
}, {
key: 'position',
value: function position() {
var _this7 = this;
var flushChanges = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0];
// flushChanges commits the changes immediately, leave true unless you are positioning multiple
// tethers (in which case call Tether.Utils.flush yourself when you're done)
if (!this.enabled) {
return;
}
this.clearCache();
// Turn 'auto' attachments into the appropriate corner or edge
var targetAttachment = autoToFixedAttachment(this.targetAttachment, this.attachment);
this.updateAttachClasses(this.attachment, targetAttachment);
var elementPos = this.cache('element-bounds', function () {
return getBounds(_this7.element);
});
var width = elementPos.width;
var height = elementPos.height;
if (width === 0 && height === 0 && typeof this.lastSize !== 'undefined') {
var _lastSize = this.lastSize;
// We cache the height and width to make it possible to position elements that are
// getting hidden.
width = _lastSize.width;
height = _lastSize.height;
} else {
this.lastSize = { width: width, height: height };
}
var targetPos = this.cache('target-bounds', function () {
return _this7.getTargetBounds();
});
var targetSize = targetPos;
// Get an actual px offset from the attachment
var offset = offsetToPx(attachmentToOffset(this.attachment), { width: width, height: height });
var targetOffset = offsetToPx(attachmentToOffset(targetAttachment), targetSize);
var manualOffset = offsetToPx(this.offset, { width: width, height: height });
var manualTargetOffset = offsetToPx(this.targetOffset, targetSize);
// Add the manually provided offset
offset = addOffset(offset, manualOffset);
targetOffset = addOffset(targetOffset, manualTargetOffset);
// It's now our goal to make (element position + offset) == (target position + target offset)
var left = targetPos.left + targetOffset.left - offset.left;
var top = targetPos.top + targetOffset.top - offset.top;
for (var i = 0; i < TetherBase.modules.length; ++i) {
var _module2 = TetherBase.modules[i];
var ret = _module2.position.call(this, {
left: left,
top: top,
targetAttachment: targetAttachment,
targetPos: targetPos,
elementPos: elementPos,
offset: offset,
targetOffset: targetOffset,
manualOffset: manualOffset,
manualTargetOffset: manualTargetOffset,
scrollbarSize: scrollbarSize,
attachment: this.attachment
});
if (ret === false) {
return false;
} else if (typeof ret === 'undefined' || typeof ret !== 'object') {
continue;
} else {
top = ret.top;
left = ret.left;
}
}
// We describe the position three different ways to give the optimizer
// a chance to decide the best possible way to position the element
// with the fewest repaints.
var next = {
// It's position relative to the page (absolute positioning when
// the element is a child of the body)
page: {
top: top,
left: left
},
// It's position relative to the viewport (fixed positioning)
viewport: {
top: top - pageYOffset,
bottom: pageYOffset - top - height + innerHeight,
left: left - pageXOffset,
right: pageXOffset - left - width + innerWidth
}
};
var doc = this.target.ownerDocument;
var win = doc.defaultView;
var scrollbarSize = undefined;
if (win.innerHeight > doc.documentElement.clientHeight) {
scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
next.viewport.bottom -= scrollbarSize.height;
}
if (win.innerWidth > doc.documentElement.clientWidth) {
scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
next.viewport.right -= scrollbarSize.width;
}
if (['', 'static'].indexOf(doc.body.style.position) === -1 || ['', 'static'].indexOf(doc.body.parentElement.style.position) === -1) {
// Absolute positioning in the body will be relative to the page, not the 'initial containing block'
next.page.bottom = doc.body.scrollHeight - top - height;
next.page.right = doc.body.scrollWidth - left - width;
}
if (typeof this.options.optimizations !== 'undefined' && this.options.optimizations.moveElement !== false && !(typeof this.targetModifier !== 'undefined')) {
(function () {
var offsetParent = _this7.cache('target-offsetparent', function () {
return getOffsetParent(_this7.target);
});
var offsetPosition = _this7.cache('target-offsetparent-bounds', function () {
return getBounds(offsetParent);
});
var offsetParentStyle = getComputedStyle(offsetParent);
var offsetParentSize = offsetPosition;
var offsetBorder = {};
['Top', 'Left', 'Bottom', 'Right'].forEach(function (side) {
offsetBorder[side.toLowerCase()] = parseFloat(offsetParentStyle['border' + side + 'Width']);
});
offsetPosition.right = doc.body.scrollWidth - offsetPosition.left - offsetParentSize.width + offsetBorder.right;
offsetPosition.bottom = doc.body.scrollHeight - offsetPosition.top - offsetParentSize.height + offsetBorder.bottom;
if (next.page.top >= offsetPosition.top + offsetBorder.top && next.page.bottom >= offsetPosition.bottom) {
if (next.page.left >= offsetPosition.left + offsetBorder.left && next.page.right >= offsetPosition.right) {
// We're within the visible part of the target's scroll parent
var scrollTop = offsetParent.scrollTop;
var scrollLeft = offsetParent.scrollLeft;
// It's position relative to the target's offset parent (absolute positioning when
// the element is moved to be a child of the target's offset parent).
next.offset = {
top: next.page.top - offsetPosition.top + scrollTop - offsetBorder.top,
left: next.page.left - offsetPosition.left + scrollLeft - offsetBorder.left
};
}
}
})();
}
// We could also travel up the DOM and try each containing context, rather than only
// looking at the body, but we're gonna get diminishing returns.
this.move(next);
this.history.unshift(next);
if (this.history.length > 3) {
this.history.pop();
}
if (flushChanges) {
flush();
}
return true;
}
// THE ISSUE
}, {
key: 'move',
value: function move(pos) {
var _this8 = this;
if (!(typeof this.element.parentNode !== 'undefined')) {
return;
}
var same = {};
for (var type in pos) {
same[type] = {};
for (var key in pos[type]) {
var found = false;
for (var i = 0; i < this.history.length; ++i) {
var point = this.history[i];
if (typeof point[type] !== 'undefined' && !within(point[type][key], pos[type][key])) {
found = true;
break;
}
}
if (!found) {
same[type][key] = true;
}
}
}
var css = { top: '', left: '', right: '', bottom: '' };
var transcribe = function transcribe(_same, _pos) {
var hasOptimizations = typeof _this8.options.optimizations !== 'undefined';
var gpu = hasOptimizations ? _this8.options.optimizations.gpu : null;
if (gpu !== false) {
var yPos = undefined,
xPos = undefined;
if (_same.top) {
css.top = 0;
yPos = _pos.top;
} else {
css.bottom = 0;
yPos = -_pos.bottom;
}
if (_same.left) {
css.left = 0;
xPos = _pos.left;
} else {
css.right = 0;
xPos = -_pos.right;
}
if (window.matchMedia) {
// HubSpot/tether#207
var retina = window.matchMedia('only screen and (min-resolution: 1.3dppx)').matches || window.matchMedia('only screen and (-webkit-min-device-pixel-ratio: 1.3)').matches;
if (!retina) {
xPos = Math.round(xPos);
yPos = Math.round(yPos);
}
}
css[transformKey] = 'translateX(' + xPos + 'px) translateY(' + yPos + 'px)';
if (transformKey !== 'msTransform') {
// The Z transform will keep this in the GPU (faster, and prevents artifacts),
// but IE9 doesn't support 3d transforms and will choke.
css[transformKey] += " translateZ(0)";
}
} else {
if (_same.top) {
css.top = _pos.top + 'px';
} else {
css.bottom = _pos.bottom + 'px';
}
if (_same.left) {
css.left = _pos.left + 'px';
} else {
css.right = _pos.right + 'px';
}
}
};
var moved = false;
if ((same.page.top || same.page.bottom) && (same.page.left || same.page.right)) {
css.position = 'absolute';
transcribe(same.page, pos.page);
} else if ((same.viewport.top || same.viewport.bottom) && (same.viewport.left || same.viewport.right)) {
css.position = 'fixed';
transcribe(same.viewport, pos.viewport);
} else if (typeof same.offset !== 'undefined' && same.offset.top && same.offset.left) {
(function () {
css.position = 'absolute';
var offsetParent = _this8.cache('target-offsetparent', function () {
return getOffsetParent(_this8.target);
});
if (getOffsetParent(_this8.element) !== offsetParent) {
defer(function () {
_this8.element.parentNode.removeChild(_this8.element);
offsetParent.appendChild(_this8.element);
});
}
transcribe(same.offset, pos.offset);
moved = true;
})();
} else {
css.position = 'absolute';
transcribe({ top: true, left: true }, pos.page);
}
if (!moved) {
if (this.options.bodyElement) {
this.options.bodyElement.appendChild(this.element);
} else {
var offsetParentIsBody = true;
var currentNode = this.element.parentNode;
while (currentNode && currentNode.nodeType === 1 && currentNode.tagName !== 'BODY') {
if (getComputedStyle(currentNode).position !== 'static') {
offsetParentIsBody = false;
break;
}
currentNode = currentNode.parentNode;
}
if (!offsetParentIsBody) {
this.element.parentNode.removeChild(this.element);
this.element.ownerDocument.body.appendChild(this.element);
}
}
}
// Any css change will trigger a repaint, so let's avoid one if nothing changed
var writeCSS = {};
var write = false;
for (var key in css) {
var val = css[key];
var elVal = this.element.style[key];
if (elVal !== val) {
write = true;
writeCSS[key] = val;
}
}
if (write) {
defer(function () {
extend(_this8.element.style, writeCSS);
_this8.trigger('repositioned');
});
}
}
}]);
return TetherClass;
})(Evented);
TetherClass.modules = [];
TetherBase.position = position;
var Tether = extend(TetherClass, TetherBase);
/* globals TetherBase */
'use strict';
var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();
var _TetherBase$Utils = TetherBase.Utils;
var getBounds = _TetherBase$Utils.getBounds;
var extend = _TetherBase$Utils.extend;
var updateClasses = _TetherBase$Utils.updateClasses;
var defer = _TetherBase$Utils.defer;
var BOUNDS_FORMAT = ['left', 'top', 'right', 'bottom'];
function getBoundingRect(tether, to) {
if (to === 'scrollParent') {
to = tether.scrollParents[0];
} else if (to === 'window') {
to = [pageXOffset, pageYOffset, innerWidth + pageXOffset, innerHeight + pageYOffset];
}
if (to === document) {
to = to.documentElement;
}
if (typeof to.nodeType !== 'undefined') {
(function () {
var node = to;
var size = getBounds(to);
var pos = size;
var style = getComputedStyle(to);
to = [pos.left, pos.top, size.width + pos.left, size.height + pos.top];
// Account any parent Frames scroll offset
if (node.ownerDocument !== document) {
var win = node.ownerDocument.defaultView;
to[0] += win.pageXOffset;
to[1] += win.pageYOffset;
to[2] += win.pageXOffset;
to[3] += win.pageYOffset;
}
BOUNDS_FORMAT.forEach(function (side, i) {
side = side[0].toUpperCase() + side.substr(1);
if (side === 'Top' || side === 'Left') {
to[i] += parseFloat(style['border' + side + 'Width']);
} else {
to[i] -= parseFloat(style['border' + side + 'Width']);
}
});
})();
}
return to;
}
TetherBase.modules.push({
position: function position(_ref) {
var _this = this;
var top = _ref.top;
var left = _ref.left;
var targetAttachment = _ref.targetAttachment;
if (!this.options.constraints) {
return true;
}
var _cache = this.cache('element-bounds', function () {
return getBounds(_this.element);
});
var height = _cache.height;
var width = _cache.width;
if (width === 0 && height === 0 && typeof this.lastSize !== 'undefined') {
var _lastSize = this.lastSize;
// Handle the item getting hidden as a result of our positioning without glitching
// the classes in and out
width = _lastSize.width;
height = _lastSize.height;
}
var targetSize = this.cache('target-bounds', function () {
return _this.getTargetBounds();
});
var targetHeight = targetSize.height;
var targetWidth = targetSize.width;
var allClasses = [this.getClass('pinned'), this.getClass('out-of-bounds')];
this.options.constraints.forEach(function (constraint) {
var outOfBoundsClass = constraint.outOfBoundsClass;
var pinnedClass = constraint.pinnedClass;
if (outOfBoundsClass) {
allClasses.push(outOfBoundsClass);
}
if (pinnedClass) {
allClasses.push(pinnedClass);
}
});
allClasses.forEach(function (cls) {
['left', 'top', 'right', 'bottom'].forEach(function (side) {
allClasses.push(cls + '-' + side);
});
});
var addClasses = [];
var tAttachment = extend({}, targetAttachment);
var eAttachment = extend({}, this.attachment);
this.options.constraints.forEach(function (constraint) {
var to = constraint.to;
var attachment = constraint.attachment;
var pin = constraint.pin;
if (typeof attachment === 'undefined') {
attachment = '';
}
var changeAttachX = undefined,
changeAttachY = undefined;
if (attachment.indexOf(' ') >= 0) {
var _attachment$split = attachment.split(' ');
var _attachment$split2 = _slicedToArray(_attachment$split, 2);
changeAttachY = _attachment$split2[0];
changeAttachX = _attachment$split2[1];
} else {
changeAttachX = changeAttachY = attachment;
}
var bounds = getBoundingRect(_this, to);
if (changeAttachY === 'target' || changeAttachY === 'both') {
if (top < bounds[1] && tAttachment.top === 'top') {
top += targetHeight;
tAttachment.top = 'bottom';
}
if (top + height > bounds[3] && tAttachment.top === 'bottom') {
top -= targetHeight;
tAttachment.top = 'top';
}
}
if (changeAttachY === 'together') {
if (tAttachment.top === 'top') {
if (eAttachment.top === 'bottom' && top < bounds[1]) {
top += targetHeight;
tAttachment.top = 'bottom';
top += height;
eAttachment.top = 'top';
} else if (eAttachment.top === 'top' && top + height > bounds[3] && top - (height - targetHeight) >= bounds[1]) {
top -= height - targetHeight;
tAttachment.top = 'bottom';
eAttachment.top = 'bottom';
}
}
if (tAttachment.top === 'bottom') {
if (eAttachment.top === 'top' && top + height > bounds[3]) {
top -= targetHeight;
tAttachment.top = 'top';
top -= height;
eAttachment.top = 'bottom';
} else if (eAttachment.top === 'bottom' && top < bounds[1] && top + (height * 2 - targetHeight) <= bounds[3]) {
top += height - targetHeight;
tAttachment.top = 'top';
eAttachment.top = 'top';
}
}
if (tAttachment.top === 'middle') {
if (top + height > bounds[3] && eAttachment.top === 'top') {
top -= height;
eAttachment.top = 'bottom';
} else if (top < bounds[1] && eAttachment.top === 'bottom') {
top += height;
eAttachment.top = 'top';
}
}
}
if (changeAttachX === 'target' || changeAttachX === 'both') {
if (left < bounds[0] && tAttachment.left === 'left') {
left += targetWidth;
tAttachment.left = 'right';
}
if (left + width > bounds[2] && tAttachment.left === 'right') {
left -= targetWidth;
tAttachment.left = 'left';
}
}
if (changeAttachX === 'together') {
if (left < bounds[0] && tAttachment.left === 'left') {
if (eAttachment.left === 'right') {
left += targetWidth;
tAttachment.left = 'right';
left += width;
eAttachment.left = 'left';
} else if (eAttachment.left === 'left') {
left += targetWidth;
tAttachment.left = 'right';
left -= width;
eAttachment.left = 'right';
}
} else if (left + width > bounds[2] && tAttachment.left === 'right') {
if (eAttachment.left === 'left') {
left -= targetWidth;
tAttachment.left = 'left';
left -= width;
eAttachment.left = 'right';
} else if (eAttachment.left === 'right') {
left -= targetWidth;
tAttachment.left = 'left';
left += width;
eAttachment.left = 'left';
}
} else if (tAttachment.left === 'center') {
if (left + width > bounds[2] && eAttachment.left === 'left') {
left -= width;
eAttachment.left = 'right';
} else if (left < bounds[0] && eAttachment.left === 'right') {
left += width;
eAttachment.left = 'left';
}
}
}
if (changeAttachY === 'element' || changeAttachY === 'both') {
if (top < bounds[1] && eAttachment.top === 'bottom') {
top += height;
eAttachment.top = 'top';
}
if (top + height > bounds[3] && eAttachment.top === 'top') {
top -= height;
eAttachment.top = 'bottom';
}
}
if (changeAttachX === 'element' || changeAttachX === 'both') {
if (left < bounds[0]) {
if (eAttachment.left === 'right') {
left += width;
eAttachment.left = 'left';
} else if (eAttachment.left === 'center') {
left += width / 2;
eAttachment.left = 'left';
}
}
if (left + width > bounds[2]) {
if (eAttachment.left === 'left') {
left -= width;
eAttachment.left = 'right';
} else if (eAttachment.left === 'center') {
left -= width / 2;
eAttachment.left = 'right';
}
}
}
if (typeof pin === 'string') {
pin = pin.split(',').map(function (p) {
return p.trim();
});
} else if (pin === true) {
pin = ['top', 'left', 'right', 'bottom'];
}
pin = pin || [];
var pinned = [];
var oob = [];
if (top < bounds[1]) {
if (pin.indexOf('top') >= 0) {
top = bounds[1];
pinned.push('top');
} else {
oob.push('top');
}
}
if (top + height > bounds[3]) {
if (pin.indexOf('bottom') >= 0) {
top = bounds[3] - height;
pinned.push('bottom');
} else {
oob.push('bottom');
}
}
if (left < bounds[0]) {
if (pin.indexOf('left') >= 0) {
left = bounds[0];
pinned.push('left');
} else {
oob.push('left');
}
}
if (left + width > bounds[2]) {
if (pin.indexOf('right') >= 0) {
left = bounds[2] - width;
pinned.push('right');
} else {
oob.push('right');
}
}
if (pinned.length) {
(function () {
var pinnedClass = undefined;
if (typeof _this.options.pinnedClass !== 'undefined') {
pinnedClass = _this.options.pinnedClass;
} else {
pinnedClass = _this.getClass('pinned');
}
addClasses.push(pinnedClass);
pinned.forEach(function (side) {
addClasses.push(pinnedClass + '-' + side);
});
})();
}
if (oob.length) {
(function () {
var oobClass = undefined;
if (typeof _this.options.outOfBoundsClass !== 'undefined') {
oobClass = _this.options.outOfBoundsClass;
} else {
oobClass = _this.getClass('out-of-bounds');
}
addClasses.push(oobClass);
oob.forEach(function (side) {
addClasses.push(oobClass + '-' + side);
});
})();
}
if (pinned.indexOf('left') >= 0 || pinned.indexOf('right') >= 0) {
eAttachment.left = tAttachment.left = false;
}
if (pinned.indexOf('top') >= 0 || pinned.indexOf('bottom') >= 0) {
eAttachment.top = tAttachment.top = false;
}
if (tAttachment.top !== targetAttachment.top || tAttachment.left !== targetAttachment.left || eAttachment.top !== _this.attachment.top || eAttachment.left !== _this.attachment.left) {
_this.updateAttachClasses(eAttachment, tAttachment);
_this.trigger('update', {
attachment: eAttachment,
targetAttachment: tAttachment
});
}
});
defer(function () {
if (!(_this.options.addTargetClasses === false)) {
updateClasses(_this.target, addClasses, allClasses);
}
updateClasses(_this.element, addClasses, allClasses);
});
return { top: top, left: left };
}
});
/* globals TetherBase */
'use strict';
var _TetherBase$Utils = TetherBase.Utils;
var getBounds = _TetherBase$Utils.getBounds;
var updateClasses = _TetherBase$Utils.updateClasses;
var defer = _TetherBase$Utils.defer;
TetherBase.modules.push({
position: function position(_ref) {
var _this = this;
var top = _ref.top;
var left = _ref.left;
var _cache = this.cache('element-bounds', function () {
return getBounds(_this.element);
});
var height = _cache.height;
var width = _cache.width;
var targetPos = this.getTargetBounds();
var bottom = top + height;
var right = left + width;
var abutted = [];
if (top <= targetPos.bottom && bottom >= targetPos.top) {
['left', 'right'].forEach(function (side) {
var targetPosSide = targetPos[side];
if (targetPosSide === left || targetPosSide === right) {
abutted.push(side);
}
});
}
if (left <= targetPos.right && right >= targetPos.left) {
['top', 'bottom'].forEach(function (side) {
var targetPosSide = targetPos[side];
if (targetPosSide === top || targetPosSide === bottom) {
abutted.push(side);
}
});
}
var allClasses = [];
var addClasses = [];
var sides = ['left', 'top', 'right', 'bottom'];
allClasses.push(this.getClass('abutted'));
sides.forEach(function (side) {
allClasses.push(_this.getClass('abutted') + '-' + side);
});
if (abutted.length) {
addClasses.push(this.getClass('abutted'));
}
abutted.forEach(function (side) {
addClasses.push(_this.getClass('abutted') + '-' + side);
});
defer(function () {
if (!(_this.options.addTargetClasses === false)) {
updateClasses(_this.target, addClasses, allClasses);
}
updateClasses(_this.element, addClasses, allClasses);
});
return true;
}
});
/* globals TetherBase */
'use strict';
var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();
TetherBase.modules.push({
position: function position(_ref) {
var top = _ref.top;
var left = _ref.left;
if (!this.options.shift) {
return;
}
var shift = this.options.shift;
if (typeof this.options.shift === 'function') {
shift = this.options.shift.call(this, { top: top, left: left });
}
var shiftTop = undefined,
shiftLeft = undefined;
if (typeof shift === 'string') {
shift = shift.split(' ');
shift[1] = shift[1] || shift[0];
var _shift = shift;
var _shift2 = _slicedToArray(_shift, 2);
shiftTop = _shift2[0];
shiftLeft = _shift2[1];
shiftTop = parseFloat(shiftTop, 10);
shiftLeft = parseFloat(shiftLeft, 10);
} else {
shiftTop = shift.top;
shiftLeft = shift.left;
}
top += shiftTop;
left += shiftLeft;
return { top: top, left: left };
}
});
return Tether;
}));
/***/ }
/******/ ])
});
;
|
barebones_bbb/src/main.js
|
wasong/cmpt433
|
import React from 'react'
import { render } from 'react-dom'
import { AppContainer } from 'react-hot-loader'
import FastClick from 'fastclick'
import injectTapEventPlugin from 'react-tap-event-plugin'
import App from './App'
import { configureStore } from './store'
// Eliminates the 300ms delay between a physical tap
// and the firing of a click event on mobile browsers
// https://github.com/ftlabs/fastclick
FastClick.attach(document.body)
injectTapEventPlugin() // remove on official React version
const store = configureStore()
const mount = document.getElementById('root')
render(
<AppContainer>
<App store={store} />
</AppContainer>,
mount,
)
// For hot reloading of react components
if (module.hot) {
module.hot.accept('./App', () => {
render(
<AppContainer>
<App store={store} />
</AppContainer>,
mount,
)
})
}
|
admin/src/components/DashBoard/DashBoard.js
|
nathandao/vantaa
|
import React from 'react';
import RequireAuthentication from 'decorators/RequireAuthentication';
@RequireAuthentication
class DashBoard extends React.Component {
constructor(props) {
super(props)
}
render() {
return(
<div className="interation-container">
<div className="interaction-area"></div>
<div className="interaction-message"></div>
<div className="interaction-commands"></div>
</div>
);
}
}
export default DashBoard;
|
packages/material-ui-icons/src/Style.js
|
Kagami/material-ui
|
import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<React.Fragment><path d="M2.53 19.65l1.34.56v-9.03l-2.43 5.86c-.41 1.02.08 2.19 1.09 2.61zm19.5-3.7L17.07 3.98c-.31-.75-1.04-1.21-1.81-1.23-.26 0-.53.04-.79.15L7.1 5.95c-.75.31-1.21 1.03-1.23 1.8-.01.27.04.54.15.8l4.96 11.97c.31.76 1.05 1.22 1.83 1.23.26 0 .52-.05.77-.15l7.36-3.05c1.02-.42 1.51-1.59 1.09-2.6zM7.88 8.75c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-2 11c0 1.1.9 2 2 2h1.45l-3.45-8.34v6.34z" /><path fill="none" d="M0 0h24v24H0z" /></React.Fragment>
, 'Style');
|
analysis/warlockaffliction/src/modules/features/Checklist/Module.js
|
anom0ly/WoWAnalyzer
|
import CastEfficiency from 'parser/shared/modules/CastEfficiency';
import Combatants from 'parser/shared/modules/Combatants';
import BaseChecklist from 'parser/shared/modules/features/Checklist/Module';
import PreparationRuleAnalyzer from 'parser/shared/modules/features/Checklist/PreparationRuleAnalyzer';
import React from 'react';
import ScouringTitheUptime from '../../covenants/ScouringTithe';
import ShadowEmbrace from '../../features/ShadowEmbrace';
import SoulShardDetails from '../../soulshards/SoulShardDetails';
import SoulShardTracker from '../../soulshards/SoulShardTracker';
import Haunt from '../../talents/Haunt';
import SiphonLifeUptime from '../../talents/SiphonLifeUptime';
import AlwaysBeCasting from '../AlwaysBeCasting';
import AgonyUptime from '../DotUptimes/AgonyUptime';
import CorruptionUptime from '../DotUptimes/CorruptionUptime';
import UnstableAfflictionUptime from '../DotUptimes/UnstableAfflictionUptime';
import Component from './Component';
class Checklist extends BaseChecklist {
static dependencies = {
combatants: Combatants,
castEfficiency: CastEfficiency,
alwaysBeCasting: AlwaysBeCasting,
preparationRuleAnalyzer: PreparationRuleAnalyzer,
agonyUptime: AgonyUptime,
corruptionUptime: CorruptionUptime,
siphonLifeUptime: SiphonLifeUptime,
unstableAfflictionUptime: UnstableAfflictionUptime,
haunt: Haunt,
shadowEmbrace: ShadowEmbrace,
scouringTithe: ScouringTitheUptime,
soulShardDetails: SoulShardDetails,
soulShardTracker: SoulShardTracker,
};
render() {
return (
<Component
castEfficiency={this.castEfficiency}
combatant={this.combatants.selected}
thresholds={{
...this.preparationRuleAnalyzer.thresholds,
agony: this.agonyUptime.suggestionThresholds,
corruption: this.corruptionUptime.suggestionThresholds,
unstableAffliction: this.unstableAfflictionUptime.suggestionThresholds,
siphonLife: this.siphonLifeUptime.suggestionThresholds,
haunt: this.haunt.suggestionThresholds,
scouringTithe: this.scouringTithe.suggestionThresholds,
shadowEmbrace: this.shadowEmbrace.suggestionThresholds,
soulShards: this.soulShardDetails.suggestionThresholds,
downtime: this.alwaysBeCasting.suggestionThresholds,
}}
shardTracker={this.soulShardTracker}
/>
);
}
}
export default Checklist;
|
src/contentscript/tinymce/TinyMCEApp.js
|
emfmesquita/beyondhelp
|
import 'bootstrap/dist/css/bootstrap.css';
import 'bootstrap/dist/css/bootstrap-theme.css';
import './TinyMCEApp.scss';
import { MenuItem, Nav, NavDropdown, NavItem } from 'react-bootstrap';
import React, { Component } from 'react';
import C from "../../Constants";
import MessageService from "../../services/MessageService";
import Opt from "../../Options";
import TinyMCETablesTab from "./TinyMCETablesTab";
import TinyMCETooltipsTab from "./TinyMCETooltipsTab";
const tooltipsTabId = "tooltips";
const tablesTabId = "tables";
class TinyMCEApp extends Component {
constructor(props) {
super(props);
this.state = {
activeTab: props.tableHtml || !props.config[Opt.TooltipsTab] ? tablesTabId : tooltipsTabId
};
}
add = (content: string) => {
content = content.trim();
window.top.postMessage({ action: C.AddContentToTinyMessage, content }, "*");
}
close = () => {
window.top.postMessage({ action: C.CloseTinyMessage }, "*");
}
tabStyle = (tabId: string) => {
return this.state.activeTab === tabId ? {} : { display: "none" };
}
renderTooltipsTab = () => {
if (!this.props.config[Opt.TooltipsTab]) return null;
return (
<span style={this.tabStyle(tooltipsTabId)}>
<TinyMCETooltipsTab config={this.props.config} shouldFocus={!this.props.tableHtml} onAdd={this.add} onClose={this.close} />
</span>
);
}
renderTablesTab = () => {
if (!this.props.config[Opt.TablesTab]) return null;
return (
<span style={this.tabStyle(tablesTabId)}>
<TinyMCETablesTab onAdd={this.add} onClose={this.close} tableHtml={this.props.tableHtml} />
</span>
);
}
render() {
return (
<div className="bh-tinymce-dialog">
<Nav bsStyle="tabs" activeKey={this.state.activeTab} onSelect={(activeTab) => this.setState({ activeTab })}>
{this.props.config[Opt.TooltipsTab] && <NavItem eventKey={tooltipsTabId} title="Add Tooltips">Tooltips</NavItem>}
{this.props.config[Opt.TablesTab] && <NavItem eventKey={tablesTabId} title="Add Rollable Tables">Rollable Tables</NavItem>}
{/* <NavDropdown title="Extra">
</NavDropdown> */}
</Nav>
{this.renderTooltipsTab()}
{this.renderTablesTab()}
</div >
);
}
}
export default TinyMCEApp;
|
ajax/libs/react-bootstrap-table/2.4.2/react-bootstrap-table.min.js
|
kennynaoh/cdnjs
|
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],t):"object"==typeof exports?exports.ReactBootstrapTable=t(require("react"),require("react-dom")):e.ReactBootstrapTable=t(e.React,e.ReactDOM)}(this,function(e,t){return function(e){function t(o){if(r[o])return r[o].exports;var n=r[o]={exports:{},id:o,loaded:!1};return e[o].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var n=r(11),a=o(n),i=r(19),s=o(i);"undefined"!=typeof window&&(window.BootstrapTable=a["default"],window.TableHeaderColumn=s["default"]),t.BootstrapTable=a["default"],t.TableHeaderColumn=s["default"]},function(t,r){t.exports=e},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={SORT_DESC:"desc",SORT_ASC:"asc",SIZE_PER_PAGE:10,NEXT_PAGE:">",LAST_PAGE:">>",PRE_PAGE:"<",FIRST_PAGE:"<<",PAGE_START_INDEX:1,ROW_SELECT_BG_COLOR:"",ROW_SELECT_NONE:"none",ROW_SELECT_SINGLE:"radio",ROW_SELECT_MULTI:"checkbox",CELL_EDIT_NONE:"none",CELL_EDIT_CLICK:"click",CELL_EDIT_DBCLICK:"dbclick",SIZE_PER_PAGE_LIST:[10,25,30,50],PAGINATION_SIZE:5,NO_DATA_TEXT:"There is no data to display",SHOW_ONLY_SELECT:"Show Selected Only",SHOW_ALL:"Show All",EXPORT_CSV_TEXT:"Export to CSV",INSERT_BTN_TEXT:"New",DELETE_BTN_TEXT:"Delete",SAVE_BTN_TEXT:"Save",CLOSE_BTN_TEXT:"Close",FILTER_DELAY:500,FILTER_TYPE:{TEXT:"TextFilter",REGEX:"RegexFilter",SELECT:"SelectFilter",NUMBER:"NumberFilter",DATE:"DateFilter",CUSTOM:"CustomFilter"}},e.exports=t["default"]},function(e,t,r){var o,n;/*!
Copyright (c) 2016 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
!function(){"use strict";function r(){for(var e=[],t=0;t<arguments.length;t++){var o=arguments[t];if(o){var n=typeof o;if("string"===n||"number"===n)e.push(o);else if(Array.isArray(o))e.push(r.apply(null,o));else if("object"===n)for(var i in o)a.call(o,i)&&o[i]&&e.push(i)}}return e.join(" ")}var a={}.hasOwnProperty;"undefined"!=typeof e&&e.exports?e.exports=r:(o=[],n=function(){return r}.apply(t,o),!(void 0!==n&&(e.exports=n)))}()},function(e,t){function r(){u=!1,i.length?l=i.concat(l):p=-1,l.length&&o()}function o(){if(!u){var e=setTimeout(r);u=!0;for(var t=l.length;t;){for(i=l,l=[];++p<t;)i&&i[p].run();p=-1,t=l.length}i=null,u=!1,clearTimeout(e)}}function n(e,t){this.fun=e,this.array=t}function a(){}var i,s=e.exports={},l=[],u=!1,p=-1;s.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];l.push(new n(e,t)),1!==l.length||u||setTimeout(o,0)},n.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=a,s.addListener=a,s.once=a,s.off=a,s.removeListener=a,s.removeAllListeners=a,s.emit=a,s.binding=function(e){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(e){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),a=o(n),i=r(2),s=o(i),l=r(3),u=o(l);t["default"]={renderReactSortCaret:function(e){var t=(0,u["default"])("order",{dropup:e===s["default"].SORT_ASC});return a["default"].createElement("span",{className:t},a["default"].createElement("span",{className:"caret",style:{margin:"10px 5px"}}))},getScrollBarWidth:function(){var e=document.createElement("p");e.style.width="100%",e.style.height="200px";var t=document.createElement("div");t.style.position="absolute",t.style.top="0px",t.style.left="0px",t.style.visibility="hidden",t.style.width="200px",t.style.height="150px",t.style.overflow="hidden",t.appendChild(e),document.body.appendChild(t);var r=e.offsetWidth;t.style.overflow="scroll";var o=e.offsetWidth;return r===o&&(o=t.clientWidth),document.body.removeChild(t),r-o},canUseDOM:function(){return"undefined"!=typeof window&&"undefined"!=typeof window.document}},e.exports=t["default"]},function(e,r){e.exports=t},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var n=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},a=r(1),i=o(a),s=function(e,t,r,o,a,s){if(e===!0||e===!1&&s||"string"==typeof e){var l=e?"text":e;return i["default"].createElement("input",n({},t,{type:l,defaultValue:a,className:(o||"")+" form-control editor edit-text"}))}if(!e){var l=e?"text":e;return i["default"].createElement("input",n({},t,{type:l,defaultValue:a,disabled:"disabled",className:(o||"")+" form-control editor edit-text"}))}if(e&&(void 0===e.type||null===e.type||""===e.type.trim())){var l=e?"text":e;return i["default"].createElement("input",n({},t,{type:l,defaultValue:a,className:(o||"")+" form-control editor edit-text"}))}if(e.type){if(e.style&&(t.style=e.style),t.className=(o||"")+" form-control editor edit-"+e.type+(e.className?" "+e.className:""),"select"===e.type){var u=[],p=e.options.values;return Array.isArray(p)&&!function(){var e=void 0;u=p.map(function(t,o){return e=r?r(t):t,i["default"].createElement("option",{key:"option"+o,value:t},e)})}(),i["default"].createElement("select",n({},t,{defaultValue:a}),u)}if("textarea"!==e.type){if("checkbox"===e.type){var p="true:false";e.options&&e.options.values&&(p=e.options.values),t.className=t.className.replace("form-control",""),t.className+=" checkbox pull-right";var c=a&&a.toString()===p.split(":")[0]?!0:!1;return i["default"].createElement("input",n({},t,{type:"checkbox",value:p,defaultChecked:c}))}return"datetime"===e.type?i["default"].createElement("input",n({},t,{type:"datetime-local",defaultValue:a})):i["default"].createElement("input",n({},t,{type:"text",defaultValue:a}))}var d=function(){e.cols&&(t.cols=e.cols),e.rows&&(t.rows=e.rows);var r=void 0,o=t.onKeyDown;return o&&(t.onKeyDown=function(e){13!==e.keyCode&&o(e)},r=i["default"].createElement("button",{className:"btn btn-info btn-xs textarea-save-btn",onClick:o},"save")),{v:i["default"].createElement("div",null,i["default"].createElement("textarea",n({},t,{defaultValue:a})),r)}}();if("object"==typeof d)return d.v}return i["default"].createElement("input",n({},t,{type:"text",className:(o||"")+" form-control editor edit-text"}))};t["default"]=s,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(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)}Object.defineProperty(t,"__esModule",{value:!0});var i=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}}(),s=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},l=r(1),u=o(l),p=r(37),c=u["default"].createFactory(p.ToastMessage.animation),d=function(e){function t(){n(this,t),s(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments)}return a(t,e),i(t,[{key:"notice",value:function(e,t,r){this.refs.toastr[e](t,r,{mode:"single",timeOut:5e3,extendedTimeOut:1e3,showAnimation:"animated bounceIn",hideAnimation:"animated bounceOut"})}},{key:"render",value:function(){return u["default"].createElement(p.ToastContainer,{ref:"toastr",toastMessageFactory:c,id:"toast-container",className:"toast-top-right"})}}]),t}(l.Component);t["default"]=d,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(){}Object.defineProperty(t,"__esModule",{value:!0}),t.jQuery=t.animation=void 0;var a=r(1),i=o(a),s=r(10),l=o(s),u=r(3),p=o(u),c=r(35),d=o(c),f=r(36),h=o(f),y={displayName:"ToastMessage",getDefaultProps:function(){var e={error:"toast-error",info:"toast-info",success:"toast-success",warning:"toast-warning"};return{className:"toast",iconClassNames:e,titleClassName:"toast-title",messageClassName:"toast-message",tapToDismiss:!0,closeButton:!1}},handleOnClick:function(e){this.props.handleOnClick(e),this.props.tapToDismiss&&this.hideToast(!0)},_handle_close_button_click:function(e){e.stopPropagation(),this.hideToast(!0)},_handle_remove:function(){this.props.handleRemove(this.props.toastId)},_render_close_button:function(){return this.props.closeButton?i["default"].createElement("button",{className:"toast-close-button",role:"button",onClick:this._handle_close_button_click,dangerouslySetInnerHTML:{__html:"×"}}):!1},_render_title_element:function(){return this.props.title?i["default"].createElement("div",{className:this.props.titleClassName},this.props.title):!1},_render_message_element:function(){return this.props.message?i["default"].createElement("div",{className:this.props.messageClassName},this.props.message):!1},render:function(){var e=this.props.iconClassName||this.props.iconClassNames[this.props.type];return i["default"].createElement("div",{className:(0,p["default"])(this.props.className,e),style:this.props.style,onClick:this.handleOnClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave},this._render_close_button(),this._render_title_element(),this._render_message_element())}},v=t.animation=i["default"].createClass((0,l["default"])(y,{displayName:{$set:"ToastMessage.animation"},mixins:{$set:[d["default"]]}})),m=t.jQuery=i["default"].createClass((0,l["default"])(y,{displayName:{$set:"ToastMessage.jQuery"},mixins:{$set:[h["default"]]}}));y.handleMouseEnter=n,y.handleMouseLeave=n,y.hideToast=n;var g=i["default"].createClass(y);g.animation=v,g.jQuery=m,t["default"]=g},function(e,t,r){e.exports=r(40)},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(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)}Object.defineProperty(t,"__esModule",{value:!0});var i=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},s=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}}(),l=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},u=r(1),p=o(u),c=r(2),d=o(c),f=r(18),h=o(f),y=r(14),v=o(y),m=r(28),g=o(m),b=r(30),T=o(b),E=r(17),P=o(E),_=r(29),w=r(5),O=o(w),S=r(21),C=o(S),k=r(12),R=function(e){function t(e){var r=this;if(n(this,t),l(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),this.handleSort=function(e,t){if(r.props.options.onSortChange&&r.props.options.onSortChange(t,e,r.props),r.isRemoteDataSource())return void r.store.setSortInfo(e,t);var o=r.store.sort(e,t).get();r.setState({data:o})},this.handlePaginationData=function(e,t){var o=r.props.options,n=o.onPageChange,a=o.pageStartIndex;if(n&&n(e,t),r.setState({currPage:e,sizePerPage:t}),!r.isRemoteDataSource()){var i=void 0;if(void 0!==a){var s=Math.abs(d["default"].PAGE_START_INDEX-a);i=e+s}else i=e;var l=r.store.page(i,t).get();r.setState({data:l})}},this.handleMouseLeave=function(){r.props.options.onMouseLeave&&r.props.options.onMouseLeave()},this.handleMouseEnter=function(){r.props.options.onMouseEnter&&r.props.options.onMouseEnter()},this.handleRowMouseOut=function(e,t){r.props.options.onRowMouseOut&&r.props.options.onRowMouseOut(e,t)},this.handleRowMouseOver=function(e,t){r.props.options.onRowMouseOver&&r.props.options.onRowMouseOver(e,t)},this.handleRowClick=function(e){r.props.options.onRowClick&&r.props.options.onRowClick(e)},this.handleSelectAllRow=function(e){var t=e.currentTarget.checked,o=r.store.getKeyField(),n=r.props.selectRow,a=n.onSelectAll,i=n.unselectable,s=[],l=!0,u=r.store.get();t&&i&&i.length>0&&(u=u.filter(function(e){return-1===i.indexOf(e[o])})),a&&(l=r.props.selectRow.onSelectAll(t,t?u:r.store.getRowByKey(r.state.selectedRowKeys))),("undefined"==typeof l||l!==!1)&&(t&&(s=Array.isArray(l)?l:u.map(function(e){return e[o]})),r.store.setSelectedRowKey(s),r.setState({selectedRowKeys:s}))},this.handleShowOnlySelected=function(){r.store.ignoreNonSelected();var e=void 0;e=r.props.pagination?r.store.page(1,r.state.sizePerPage).get():r.store.get(),r.setState({data:e,currPage:r.props.options.pageStartIndex||d["default"].PAGE_START_INDEX})},this.handleSelectRow=function(e,t,o){var n=!0,a=r.store.getSelectedRowKeys(),i=e[r.store.getKeyField()],s=r.props.selectRow;s.onSelect&&(n=s.onSelect(e,t,o)),("undefined"==typeof n||n!==!1)&&(s.mode===d["default"].ROW_SELECT_SINGLE?a=t?[i]:[]:t?a.push(i):a=a.filter(function(e){return i!==e}),r.store.setSelectedRowKey(a),r.setState({selectedRowKeys:a}))},this.handleAddRow=function(e){var t=r.props.options.onAddRow;if(t){var o=r.store.getColInfos();t(e,o)}if(r.isRemoteDataSource())return r.props.options.afterInsertRow&&r.props.options.afterInsertRow(e),null;try{r.store.add(e)}catch(n){return n}r._handleAfterAddingRow(e)},this.getPageByRowKey=function(e){var t=r.state.sizePerPage,o=r.store.getCurrentDisplayData(),n=r.store.getKeyField(),a=o.findIndex(function(t){return t[n]===e});return a>-1?parseInt(a/t,10)+1:a},this.handleDropRow=function(e){var t=e?e:r.store.getSelectedRowKeys();t&&t.length>0&&(r.props.options.handleConfirmDeleteRow?r.props.options.handleConfirmDeleteRow(function(){r.deleteRow(t)},t):confirm("Are you sure you want to delete?")&&r.deleteRow(t))},this.handleFilterData=function(e){var t=r.props.options.onFilterChange;if(t){var o=r.store.getColInfos();t(e,o)}if(r.setState({currPage:r.props.options.pageStartIndex||d["default"].PAGE_START_INDEX}),r.isRemoteDataSource())return void(r.props.options.afterColumnFilter&&r.props.options.afterColumnFilter(e,r.store.getDataIgnoringPagination()));r.store.filter(e);var n=r.store.getSortInfo();n&&r.store.sort(n.order,n.sortField);var a=void 0;if(r.props.pagination){var i=r.state.sizePerPage;a=r.store.page(1,i).get()}else a=r.store.get();r.props.options.afterColumnFilter&&r.props.options.afterColumnFilter(e,r.store.getDataIgnoringPagination()),r.setState({data:a})},this.handleExportCSV=function(){var e={},t=r.props.csvFileName,o=r.props.options.onExportToCSV;e=o?o():r.store.getDataIgnoringPagination();var n=[];r.props.children.map(function(e){(e.props["export"]===!0||"undefined"==typeof e.props["export"]&&e.props.hidden===!1)&&n.push({field:e.props.dataField,format:e.props.csvFormat,header:e.props.csvHeader||e.props.dataField})}),"function"==typeof t&&(t=t()),(0,C["default"])(e,n,t)},this.handleSearch=function(e){var t=r.props.options.onSearchChange;if(t){var o=r.store.getColInfos();t(e,o,r.props.multiColumnSearch)}if(r.setState({currPage:r.props.options.pageStartIndex||d["default"].PAGE_START_INDEX}),r.isRemoteDataSource())return void(r.props.options.afterSearch&&r.props.options.afterSearch(e,r.store.getDataIgnoringPagination()));r.store.search(e);var n=void 0;if(r.props.pagination){var a=r.state.sizePerPage;n=r.store.page(1,a).get()}else n=r.store.get();r.props.options.afterSearch&&r.props.options.afterSearch(e,r.store.getDataIgnoringPagination()),r.setState({data:n})},this._scrollHeader=function(e){r.refs.header.refs.container.scrollLeft=e.currentTarget.scrollLeft},this._adjustTable=function(){r._adjustHeaderWidth(),r._adjustHeight()},this._adjustHeaderWidth=function(){var e=r.refs.header.refs.header,t=r.refs.header.refs.container,o=r.refs.body.refs.tbody,n=o.childNodes[0],a=t.offsetWidth!==o.parentNode.offsetWidth,i=a?O["default"].getScrollBarWidth():0;if(n&&r.store.getDataNum())for(var s=n.childNodes,l=0;l<s.length;l++){var u=s[l],c=getComputedStyle(u),d=parseFloat(c.width.replace("px",""));if(r.isIE){var f=parseFloat(c.paddingLeft.replace("px","")),h=parseFloat(c.paddingRight.replace("px","")),y=parseFloat(c.borderRightWidth.replace("px","")),v=parseFloat(c.borderLeftWidth.replace("px",""));d=d+f+h+y+v}var m=s.length-1===l?i:0;0>=d&&(d=120,u.width=d+m+"px");var g=d+m+"px";e.childNodes[l].style.width=g,e.childNodes[l].style.minWidth=g}else p["default"].Children.forEach(r.props.children,function(t,r){t.props.width&&(e.childNodes[r].style.width=t.props.width+"px",e.childNodes[r].style.minWidth=t.props.width+"px")})},this._adjustHeight=function(){("number"==typeof r.props.height&&!isNaN(r.props.height)||-1===r.props.height.indexOf("%"))&&(r.refs.body.refs.container.style.height=parseFloat(r.props.height,10)-r.refs.header.refs.container.offsetHeight+"px")},this.isIE=!1,this._attachCellEditFunc(),O["default"].canUseDOM()&&(this.isIE=document.documentMode),this.store=new _.TableDataStore(this.props.data.slice()),this.initTable(this.props),this.filter&&this.filter.on("onFilterChange",function(e){r.handleFilterData(e)}),this.props.selectRow&&this.props.selectRow.selected){var o=this.props.selectRow.selected.slice();this.store.setSelectedRowKey(o)}var a=d["default"].PAGE_START_INDEX;"undefined"!=typeof this.props.options.page?a=this.props.options.page:"undefined"!=typeof this.props.options.pageStartIndex&&(a=this.props.options.pageStartIndex),this.state={data:this.getTableData(),currPage:a,sizePerPage:this.props.options.sizePerPage||d["default"].SIZE_PER_PAGE_LIST[0],selectedRowKeys:this.store.getSelectedRowKeys()}}return a(t,e),s(t,[{key:"initTable",value:function(e){var t=this,r=e.keyField,o="string"==typeof r&&r.length;if(p["default"].Children.forEach(e.children,function(e){if(e.props.isKey){if(r)throw"Error. Multiple key column be detected in TableHeaderColumn.";r=e.props.dataField}e.props.filter&&(t.filter||(t.filter=new k.Filter),e.props.filter.emitter=t.filter)}),this.colInfos=this.getColumnsDescription(e).reduce(function(e,t){return e[t.name]=t,e},{}),!o&&!r)throw"Error. No any key column defined in TableHeaderColumn.\n Use 'isKey={true}' to specify a unique column after version 0.5.4.";this.store.setProps({isPagination:e.pagination,keyField:r,colInfos:this.colInfos,multiColumnSearch:e.multiColumnSearch,remote:this.isRemoteDataSource()})}},{key:"getTableData",value:function(){var e=[],t=this.props,r=t.options,o=t.pagination,n=r.defaultSortName||r.sortName,a=r.defaultSortOrder||r.sortOrder,i=r.defaultSearch;if(n&&a&&this.store.sort(a,n),i&&this.store.search(i),o){var s=void 0,l=void 0;this.store.isChangedPage()?(l=this.state.sizePerPage,s=this.state.currPage):(l=r.sizePerPage||d["default"].SIZE_PER_PAGE_LIST[0],s=r.page||1),e=this.store.page(s,l).get()}else e=this.store.get();return e}},{key:"getColumnsDescription",value:function(e){var t=e.children;return p["default"].Children.map(t,function(e,t){return{name:e.props.dataField,align:e.props.dataAlign,sort:e.props.dataSort,format:e.props.dataFormat,formatExtraData:e.props.formatExtraData,filterFormatted:e.props.filterFormatted,filterValue:e.props.filterValue,editable:e.props.editable,customEditor:e.props.customEditor,hidden:e.props.hidden,hiddenOnInsert:e.props.hiddenOnInsert,searchable:e.props.searchable,className:e.props.columnClassName,columnTitle:e.props.columnTitle,width:e.props.width,text:e.props.children,sortFunc:e.props.sortFunc,sortFuncExtraData:e.props.sortFuncExtraData,"export":e.props["export"],index:t}})}},{key:"componentWillReceiveProps",value:function(e){this.initTable(e);var t=e.options,r=e.selectRow;this.store.setData(e.data.slice());var o=this.state.currPage;this.props.options.page!==t.page&&(o=t.page);var n=this.state.sizePerPage;if(this.props.options.sizePerPage!==t.sizePerPage&&(n=t.sizePerPage),this.isRemoteDataSource())this.setState({data:e.data.slice(),currPage:o});else{!t.page&&o>Math.ceil(e.data.length/n)&&(o=1);var a=this.store.getSortInfo(),i=t.sortName||(a?a.sortField:void 0),s=t.sortOrder||(a?a.order:void 0);i&&s&&this.store.sort(s,i);var l=this.store.page(o,n).get();this.setState({data:l,currPage:o,sizePerPage:n})}if(r&&r.selected){var u=r.selected.slice();this.store.setSelectedRowKey(u),this.setState({selectedRowKeys:u})}}},{key:"componentDidMount",value:function(){this._adjustTable(),window.addEventListener("resize",this._adjustTable),this.refs.body.refs.container.addEventListener("scroll",this._scrollHeader)}},{key:"componentWillUnmount",value:function(){window.removeEventListener("resize",this._adjustTable),this.refs.body.refs.container.removeEventListener("scroll",this._scrollHeader),this.filter&&this.filter.removeAllListeners("onFilterChange")}},{key:"componentDidUpdate",value:function(){this._adjustTable(),this._attachCellEditFunc(),this.props.options.afterTableComplete&&this.props.options.afterTableComplete()}},{key:"_attachCellEditFunc",value:function(){var e=this.props.cellEdit;e&&(this.props.cellEdit.__onCompleteEdit__=this.handleEditCell.bind(this),e.mode!==d["default"].CELL_EDIT_NONE&&(this.props.selectRow.clickToSelect=!1))}},{key:"isRemoteDataSource",value:function(e){return(e||this.props).remote}},{key:"render",value:function(){var e={height:this.props.height,maxHeight:this.props.maxHeight},t=this.getColumnsDescription(this.props),r=this.store.getSortInfo(),o=this.renderPagination(),n=this.renderToolBar(),a=this.renderTableFilter(t),s=this.isSelectAll(),l=this.props.options.sortIndicator;return"undefined"==typeof this.props.options.sortIndicator&&(l=!0),p["default"].createElement("div",{className:"react-bs-table-container",style:this.props.containerStyle},n,p["default"].createElement("div",{className:"react-bs-table",ref:"table",style:i({},e,this.props.tableStyle),onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave},p["default"].createElement(h["default"],{ref:"header",tableHeaderClass:this.props.tableHeaderClass,style:this.props.headerStyle,rowSelectType:this.props.selectRow.mode,customComponent:this.props.selectRow.customComponent,hideSelectColumn:this.props.selectRow.hideSelectColumn,sortName:r?r.sortField:void 0,sortOrder:r?r.order:void 0,sortIndicator:l,onSort:this.handleSort,onSelectAllRow:this.handleSelectAllRow,bordered:this.props.bordered,condensed:this.props.condensed,isFiltered:this.filter?!0:!1,isSelectAll:s},this.props.children),p["default"].createElement(v["default"],{ref:"body",tableBodyClass:this.props.tableBodyClass,style:i({},e,this.props.bodyStyle),data:this.state.data,columns:t,trClassName:this.props.trClassName,striped:this.props.striped,bordered:this.props.bordered,hover:this.props.hover,keyField:this.store.getKeyField(),condensed:this.props.condensed,selectRow:this.props.selectRow,cellEdit:this.props.cellEdit,selectedRowKeys:this.state.selectedRowKeys,onRowClick:this.handleRowClick,onRowMouseOver:this.handleRowMouseOver,onRowMouseOut:this.handleRowMouseOut,onSelectRow:this.handleSelectRow,noDataText:this.props.options.noDataText})),a,o)}},{key:"isSelectAll",value:function(){if(this.store.isEmpty())return!1;var e=this.store.getSelectedRowKeys(),t=this.store.getAllRowkey();if(0===e.length)return!1;var r=0,o=0;return e.forEach(function(e){-1!==t.indexOf(e)?r++:o++}),o===e.length?!1:r===t.length?!0:"indeterminate"}},{key:"cleanSelected",value:function(){this.store.setSelectedRowKey([]),this.setState({selectedRowKeys:[]})}},{key:"handleEditCell",value:function(e,t,r){var o=this.props.options.onCellEdit,n=this.props.cellEdit,a=n.beforeSaveCell,i=n.afterSaveCell,s=void 0;if(p["default"].Children.forEach(this.props.children,function(e,t){return t===r?(s=e.props.dataField,!1):void 0}),a){var l=a(this.state.data[t],s,e);if(!l&&"undefined"!=typeof l)return void this.setState({data:this.store.get()})}if(o&&o(this.state.data[t],s,e),this.isRemoteDataSource())return void(i&&i(this.state.data[t],s,e));var u=this.store.edit(e,t,s).get();this.setState({data:u}),i&&i(this.state.data[t],s,e)}},{key:"handleAddRowAtBegin",value:function(e){try{this.store.addAtBegin(e)}catch(t){return t}this._handleAfterAddingRow(e)}},{key:"getSizePerPage",value:function(){return this.state.sizePerPage}},{key:"getCurrentPage",value:function(){return this.state.currPage}},{key:"getTableDataIgnorePaging",value:function(){return this.store.getCurrentDisplayData()}},{key:"deleteRow",value:function(e){var t=this.props.options.onDeleteRow;if(t&&t(e),this.store.setSelectedRowKey([]),this.isRemoteDataSource())return void(this.props.options.afterDeleteRow&&this.props.options.afterDeleteRow(e));this.store.remove(e);var r=void 0;if(this.props.pagination){var o=this.state.sizePerPage,n=Math.ceil(this.store.getDataNum()/o),a=this.state.currPage;a>n&&(a=n),r=this.store.page(a,o).get(),this.setState({data:r,selectedRowKeys:this.store.getSelectedRowKeys(),currPage:a})}else r=this.store.get(),this.setState({data:r,selectedRowKeys:this.store.getSelectedRowKeys()});this.props.options.afterDeleteRow&&this.props.options.afterDeleteRow(e)}},{key:"renderPagination",value:function(){if(this.props.pagination){var e=void 0;e=this.isRemoteDataSource()?this.props.fetchInfo.dataTotalSize:this.store.getDataNum();var t=this.props.options;return Math.ceil(e/this.state.sizePerPage)<=1&&this.props.ignoreSinglePage?null:p["default"].createElement("div",{className:"react-bs-table-pagination"},p["default"].createElement(g["default"],{ref:"pagination",currPage:this.state.currPage,changePage:this.handlePaginationData,sizePerPage:this.state.sizePerPage,sizePerPageList:t.sizePerPageList||d["default"].SIZE_PER_PAGE_LIST,pageStartIndex:t.pageStartIndex,paginationShowsTotal:t.paginationShowsTotal,paginationSize:t.paginationSize||d["default"].PAGINATION_SIZE,remote:this.isRemoteDataSource(),dataSize:e,onSizePerPageList:t.onSizePerPageList,prePage:t.prePage||d["default"].PRE_PAGE,nextPage:t.nextPage||d["default"].NEXT_PAGE,firstPage:t.firstPage||d["default"].FIRST_PAGE,lastPage:t.lastPage||d["default"].LAST_PAGE,hideSizePerPage:t.hideSizePerPage}))}return null}},{key:"renderToolBar",value:function(){var e=this.props,t=e.selectRow,r=e.insertRow,o=e.deleteRow,n=e.search,a=e.children,i=t&&t.showOnlySelected;if(i||r||o||n||this.props.exportCSV){var s=void 0;return s=Array.isArray(a)?a.map(function(e,t){var r=e.props;return{name:r.children,field:r.dataField,hiddenOnInsert:r.hiddenOnInsert,autoValue:r.autoValue||!1,editable:r.editable&&"function"==typeof r.editable?r.editable():r.editable,format:r.dataFormat?function(e){return r.dataFormat(e,null,r.formatExtraData,t).replace(/<.*?>/g,"")}:!1}}):[{name:a.props.children,field:a.props.dataField,editable:a.props.editable,hiddenOnInsert:a.props.hiddenOnInsert}],p["default"].createElement("div",{className:"react-bs-table-tool-bar"},p["default"].createElement(T["default"],{defaultSearch:this.props.options.defaultSearch,clearSearch:this.props.options.clearSearch,searchDelayTime:this.props.options.searchDelayTime,enableInsert:r,enableDelete:o,enableSearch:n,enableExportCSV:this.props.exportCSV,enableShowOnlySelected:i,columns:s,searchPlaceholder:this.props.searchPlaceholder,exportCSVText:this.props.options.exportCSVText,insertText:this.props.options.insertText,deleteText:this.props.options.deleteText,saveText:this.props.options.saveText,closeText:this.props.options.closeText,ignoreEditable:this.props.options.ignoreEditable,onAddRow:this.handleAddRow,onDropRow:this.handleDropRow,onSearch:this.handleSearch,onExportCSV:this.handleExportCSV,onShowOnlySelected:this.handleShowOnlySelected}))}return null}},{key:"renderTableFilter",value:function(e){return this.props.columnFilter?p["default"].createElement(P["default"],{columns:e,rowSelectType:this.props.selectRow.mode,onFilter:this.handleFilterData}):null}},{key:"_handleAfterAddingRow",value:function(e){var t=void 0;if(this.props.pagination){var r=this.state.sizePerPage,o=Math.ceil(this.store.getDataNum()/r);t=this.store.page(o,r).get(),this.setState({data:t,currPage:o})}else t=this.store.get(),this.setState({data:t});this.props.options.afterInsertRow&&this.props.options.afterInsertRow(e)}}]),t}(u.Component);R.propTypes={keyField:u.PropTypes.string,height:u.PropTypes.oneOfType([u.PropTypes.string,u.PropTypes.number]),maxHeight:u.PropTypes.oneOfType([u.PropTypes.string,u.PropTypes.number]),data:u.PropTypes.oneOfType([u.PropTypes.array,u.PropTypes.object]),remote:u.PropTypes.bool,striped:u.PropTypes.bool,bordered:u.PropTypes.bool,hover:u.PropTypes.bool,condensed:u.PropTypes.bool,pagination:u.PropTypes.bool,searchPlaceholder:u.PropTypes.string,selectRow:u.PropTypes.shape({mode:u.PropTypes.oneOf([d["default"].ROW_SELECT_NONE,d["default"].ROW_SELECT_SINGLE,d["default"].ROW_SELECT_MULTI]),customComponent:u.PropTypes.func,bgColor:u.PropTypes.string,selected:u.PropTypes.array,onSelect:u.PropTypes.func,onSelectAll:u.PropTypes.func,clickToSelect:u.PropTypes.bool,hideSelectColumn:u.PropTypes.bool,clickToSelectAndEditCell:u.PropTypes.bool,showOnlySelected:u.PropTypes.bool,unselectable:u.PropTypes.array}),cellEdit:u.PropTypes.shape({mode:u.PropTypes.string,blurToSave:u.PropTypes.bool,beforeSaveCell:u.PropTypes.func,afterSaveCell:u.PropTypes.func}),insertRow:u.PropTypes.bool,deleteRow:u.PropTypes.bool,search:u.PropTypes.bool,columnFilter:u.PropTypes.bool,trClassName:u.PropTypes.any,tableStyle:u.PropTypes.object,containerStyle:u.PropTypes.object,headerStyle:u.PropTypes.object,bodyStyle:u.PropTypes.object,tableHeaderClass:u.PropTypes.string,tableBodyClass:u.PropTypes.string,options:u.PropTypes.shape({clearSearch:u.PropTypes.bool,sortName:u.PropTypes.string,sortOrder:u.PropTypes.string,defaultSortName:u.PropTypes.string,defaultSortOrder:u.PropTypes.string,sortIndicator:u.PropTypes.bool,afterTableComplete:u.PropTypes.func,afterDeleteRow:u.PropTypes.func,afterInsertRow:u.PropTypes.func,afterSearch:u.PropTypes.func,afterColumnFilter:u.PropTypes.func,onRowClick:u.PropTypes.func,page:u.PropTypes.number,pageStartIndex:u.PropTypes.number,paginationShowsTotal:u.PropTypes.oneOfType([u.PropTypes.bool,u.PropTypes.func]),sizePerPageList:u.PropTypes.array,sizePerPage:u.PropTypes.number,paginationSize:u.PropTypes.number,hideSizePerPage:u.PropTypes.bool,onSortChange:u.PropTypes.func,onPageChange:u.PropTypes.func,onSizePerPageList:u.PropTypes.func,onFilterChange:p["default"].PropTypes.func,onSearchChange:p["default"].PropTypes.func,onAddRow:p["default"].PropTypes.func,onExportToCSV:p["default"].PropTypes.func,onCellEdit:p["default"].PropTypes.func,noDataText:u.PropTypes.oneOfType([u.PropTypes.string,u.PropTypes.object]),handleConfirmDeleteRow:u.PropTypes.func,prePage:u.PropTypes.string,nextPage:u.PropTypes.string,firstPage:u.PropTypes.string,lastPage:u.PropTypes.string,searchDelayTime:u.PropTypes.number,exportCSVText:u.PropTypes.string,insertText:u.PropTypes.string,deleteText:u.PropTypes.string,saveText:u.PropTypes.string,closeText:u.PropTypes.string,ignoreEditable:u.PropTypes.bool,defaultSearch:u.PropTypes.string}),fetchInfo:u.PropTypes.shape({dataTotalSize:u.PropTypes.number}),exportCSV:u.PropTypes.bool,csvFileName:u.PropTypes.oneOfType([u.PropTypes.string,u.PropTypes.func]),ignoreSinglePage:u.PropTypes.bool},R.defaultProps={height:"100%",maxHeight:void 0,striped:!1,bordered:!0,hover:!1,condensed:!1,pagination:!1,searchPlaceholder:void 0,selectRow:{mode:d["default"].ROW_SELECT_NONE,bgColor:d["default"].ROW_SELECT_BG_COLOR,selected:[],onSelect:void 0,onSelectAll:void 0,clickToSelect:!1,hideSelectColumn:!1,clickToSelectAndEditCell:!1,showOnlySelected:!1,unselectable:[],customComponent:void 0},cellEdit:{mode:d["default"].CELL_EDIT_NONE,blurToSave:!1,beforeSaveCell:void 0,afterSaveCell:void 0},insertRow:!1,deleteRow:!1,search:!1,multiColumnSearch:!1,columnFilter:!1,trClassName:"",tableStyle:void 0,containerStyle:void 0,headerStyle:void 0,bodyStyle:void 0,tableHeaderClass:null,tableBodyClass:null,options:{clearSearch:!1,sortName:void 0,sortOrder:void 0,defaultSortName:void 0,defaultSortOrder:void 0,sortIndicator:!0,afterTableComplete:void 0,afterDeleteRow:void 0,afterInsertRow:void 0,afterSearch:void 0,afterColumnFilter:void 0,onRowClick:void 0,onMouseLeave:void 0,onMouseEnter:void 0,onRowMouseOut:void 0,onRowMouseOver:void 0,page:void 0,paginationShowsTotal:!1,sizePerPageList:d["default"].SIZE_PER_PAGE_LIST,sizePerPage:void 0,paginationSize:d["default"].PAGINATION_SIZE,hideSizePerPage:!1,onSizePerPageList:void 0,noDataText:void 0,handleConfirmDeleteRow:void 0,prePage:d["default"].PRE_PAGE,nextPage:d["default"].NEXT_PAGE,firstPage:d["default"].FIRST_PAGE,lastPage:d["default"].LAST_PAGE,pageStartIndex:void 0,searchDelayTime:void 0,exportCSVText:d["default"].EXPORT_CSV_TEXT,insertText:d["default"].INSERT_BTN_TEXT,deleteText:d["default"].DELETE_BTN_TEXT,saveText:d["default"].SAVE_BTN_TEXT,closeText:d["default"].CLOSE_BTN_TEXT,ignoreEditable:!1,defaultSearch:""},fetchInfo:{dataTotalSize:0},
exportCSV:!1,csvFileName:"spreadsheet.csv",ignoreSinglePage:!1},t["default"]=R,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(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)}Object.defineProperty(t,"__esModule",{value:!0});var i=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}}(),s=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},l=r(2),u=o(l),p=r(46),c=function(e){function t(e){n(this,t),s(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),this.currentFilter={}}return a(t,e),i(t,[{key:"handleFilter",value:function(e,t,r){var o=r||u["default"].FILTER_TYPE.CUSTOM;if(null!==t&&"object"==typeof t){var n=!0;for(var a in t)if(!t[a]||""===t[a]){n=!1;break}n?this.currentFilter[e]={value:t,type:o}:delete this.currentFilter[e]}else t&&""!==t.trim()?this.currentFilter[e]={value:t.trim(),type:o}:delete this.currentFilter[e];this.emit("onFilterChange",this.currentFilter)}}]),t}(p.EventEmitter);t.Filter=c},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(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)}Object.defineProperty(t,"__esModule",{value:!0});var i=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}}(),s=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},l=r(1),u=o(l),p=function(e){function t(){n(this,t),s(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments)}return a(t,e),i(t,[{key:"render",value:function(){return u["default"].createElement("th",{style:{textAlign:"center"}},this.props.children)}}]),t}(l.Component);p.propTypes={children:l.PropTypes.node},t["default"]=p,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(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)}Object.defineProperty(t,"__esModule",{value:!0});var i=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}}(),s=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},l=r(1),u=o(l),p=r(2),c=o(p),d=r(20),f=o(d),h=r(15),y=o(h),v=r(16),m=o(v),g=r(3),b=o(g),T=function(e){return e&&"function"==typeof e},E=function(e){function t(e){var r=this;n(this,t),s(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),this.handleRowMouseOut=function(e,t){var o=r.props.data[e];r.props.onRowMouseOut(o,t)},this.handleRowMouseOver=function(e,t){var o=r.props.data[e];r.props.onRowMouseOver(o,t)},this.handleRowClick=function(e){var t=void 0,o=r.props,n=o.data,a=o.onRowClick;n.forEach(function(r,o){o===e-1&&(t=r)}),a(t)},this.handleSelectRow=function(e,t,o){var n=void 0,a=r.props,i=a.data,s=a.onSelectRow;i.forEach(function(t,r){return r===e-1?(n=t,!1):void 0}),s(n,t,o)},this.handleSelectRowColumChange=function(e,t){r.props.selectRow.clickToSelect&&r.props.selectRow.clickToSelectAndEditCell||r.handleSelectRow(t+1,e.currentTarget.checked,e)},this.handleEditCell=function(e,t,o){r.editing=!0,r._isSelectRowDefined()&&(t--,r.props.selectRow.hideSelectColumn&&t++),e--;var n={currEditCell:{rid:e,cid:t}};if(r.props.selectRow.clickToSelectAndEditCell&&r.props.cellEdit.mode!==c["default"].CELL_EDIT_DBCLICK){var a=-1!==r.props.selectedRowKeys.indexOf(r.props.data[e][r.props.keyField]);r.handleSelectRow(e+1,!a,o)}r.setState(n)},this.handleCompleteEditCell=function(e,t,o){r.setState({currEditCell:null}),null!==e&&r.props.cellEdit.__onCompleteEdit__(e,t,o)},this.state={currEditCell:null},this.editing=!1}return a(t,e),i(t,[{key:"render",value:function(){var e=(0,b["default"])("table",{"table-striped":this.props.striped,"table-bordered":this.props.bordered,"table-hover":this.props.hover,"table-condensed":this.props.condensed},this.props.tableBodyClass),t=this.props.selectRow.unselectable||[],r=this._isSelectRowDefined(),o=this.renderTableHeader(r),n=this.props.selectRow.mode===c["default"].ROW_SELECT_SINGLE?"radio":"checkbox",a=this.props.selectRow.customComponent,i=this.props.data.map(function(e,o){var i=this.props.columns.map(function(t,r){var n=e[t.name];if(this.editing&&t.name!==this.props.keyField&&t.editable&&null!==this.state.currEditCell&&this.state.currEditCell.rid===o&&this.state.currEditCell.cid===r){var a=t.editable,i=t.format?function(r){return t.format(r,e,t.formatExtraData,o).replace(/<.*?>/g,"")}:!1;return T(t.editable)&&(a=t.editable(n,e,o,r)),u["default"].createElement(m["default"],{completeEdit:this.handleCompleteEditCell,editable:a,customEditor:t.customEditor,format:t.format?i:!1,key:r,blurToSave:this.props.cellEdit.blurToSave,rowIndex:o,colIndex:r,row:e,fieldValue:n})}var s=n,l=null,p=t.className;if(T(t.className)&&(p=t.className(n,e,o,r)),"undefined"!=typeof t.format){var c=t.format(n,e,t.formatExtraData,o);u["default"].isValidElement(c)?(s=c,l=t.columnTitle&&c?c.toString():null):s=u["default"].createElement("div",{dangerouslySetInnerHTML:{__html:c}})}else l=t.columnTitle&&n?n.toString():null;return u["default"].createElement(y["default"],{key:r,dataAlign:t.align,className:p,columnTitle:l,cellEdit:this.props.cellEdit,hidden:t.hidden,onEdit:this.handleEditCell,width:t.width},s)},this),s=e[this.props.keyField],l=-1!==t.indexOf(s),p=-1!==this.props.selectedRowKeys.indexOf(s),d=r&&!this.props.selectRow.hideSelectColumn?this.renderSelectRowColumn(p,n,l,a,o):null,h=this.props.trClassName;return T(this.props.trClassName)&&(h=this.props.trClassName(e,o)),u["default"].createElement(f["default"],{isSelected:p,key:s,className:h,selectRow:r?this.props.selectRow:void 0,enableCellEdit:this.props.cellEdit.mode!==c["default"].CELL_EDIT_NONE,onRowClick:this.handleRowClick,onRowMouseOver:this.handleRowMouseOver,onRowMouseOut:this.handleRowMouseOut,onSelectRow:this.handleSelectRow,unselectableRow:l},d,i)},this);return 0===i.length&&i.push(u["default"].createElement(f["default"],{key:"##table-empty##"},u["default"].createElement("td",{colSpan:this.props.columns.length+(r?1:0),className:"react-bs-table-no-data"},this.props.noDataText||c["default"].NO_DATA_TEXT))),this.editing=!1,u["default"].createElement("div",{ref:"container",className:"react-bs-container-body",style:this.props.style},u["default"].createElement("table",{className:e},o,u["default"].createElement("tbody",{ref:"tbody"},i)))}},{key:"renderTableHeader",value:function(e){var t=null;if(e){var r={width:30,minWidth:30};this.props.selectRow.hideSelectColumn||(t=u["default"].createElement("col",{style:r,key:-1}))}var o=this.props.columns.map(function(e,t){var r={display:e.hidden?"none":null};if(e.width){var o=parseInt(e.width,10);r.width=o,r.minWidth=o}return u["default"].createElement("col",{style:r,key:t,className:e.className})});return u["default"].createElement("colgroup",{ref:"header"},t,o)}},{key:"renderSelectRowColumn",value:function(e,t,r){var o=this,n=arguments.length<=3||void 0===arguments[3]?null:arguments[3],a=arguments.length<=4||void 0===arguments[4]?null:arguments[4];return u["default"].createElement(y["default"],{dataAlign:"center"},n?u["default"].createElement(n,{type:t,checked:e,disabled:r,rowIndex:a,onChange:function(e){return o.handleSelectRowColumChange(e,e.currentTarget.parentElement.parentElement.parentElement.rowIndex)}}):u["default"].createElement("input",{type:t,checked:e,disabled:r,onChange:function(e){return o.handleSelectRowColumChange(e,e.currentTarget.parentElement.parentElement.rowIndex)}}))}},{key:"_isSelectRowDefined",value:function(){return this.props.selectRow.mode===c["default"].ROW_SELECT_SINGLE||this.props.selectRow.mode===c["default"].ROW_SELECT_MULTI}}]),t}(l.Component);E.propTypes={data:l.PropTypes.array,columns:l.PropTypes.array,striped:l.PropTypes.bool,bordered:l.PropTypes.bool,hover:l.PropTypes.bool,condensed:l.PropTypes.bool,keyField:l.PropTypes.string,selectedRowKeys:l.PropTypes.array,onRowClick:l.PropTypes.func,onSelectRow:l.PropTypes.func,noDataText:l.PropTypes.oneOfType([l.PropTypes.string,l.PropTypes.object]),style:l.PropTypes.object,tableBodyClass:l.PropTypes.string},t["default"]=E,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(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)}Object.defineProperty(t,"__esModule",{value:!0});var i=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},s=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}}(),l=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},u=r(1),p=o(u),c=r(2),d=o(c),f=function(e){function t(e){var r=this;n(this,t),l(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),this.handleCellEdit=function(e){if(r.props.cellEdit.mode===d["default"].CELL_EDIT_DBCLICK)if(document.selection&&document.selection.empty)document.selection.empty();else if(window.getSelection){var t=window.getSelection();t.removeAllRanges()}r.props.onEdit(e.currentTarget.parentElement.rowIndex+1,e.currentTarget.cellIndex,e)}}return a(t,e),s(t,[{key:"shouldComponentUpdate",value:function(e,t){var r=this.props.children,o=this.props.width!==e.width||this.props.className!==e.className||this.props.hidden!==e.hidden||this.props.dataAlign!==e.dataAlign||typeof r!=typeof e.children||(""+this.props.onEdit).toString()!==(""+e.onEdit).toString();return o?o:(o="object"==typeof r&&null!==r&&null!==r.props?"checkbox"===r.props.type||"radio"===r.props.type?o||r.props.type!==e.children.props.type||r.props.checked!==e.children.props.checked:!0:o||r!==e.children,o?o:this.props.cellEdit&&e.cellEdit?o||this.props.cellEdit.mode!==e.cellEdit.mode:!1)}},{key:"render",value:function(){var e={textAlign:this.props.dataAlign,display:this.props.hidden?"none":null},t={};return this.props.cellEdit&&(this.props.cellEdit.mode===d["default"].CELL_EDIT_CLICK?t.onClick=this.handleCellEdit:this.props.cellEdit.mode===d["default"].CELL_EDIT_DBCLICK&&(t.onDoubleClick=this.handleCellEdit)),p["default"].createElement("td",i({style:e,title:this.props.columnTitle,className:this.props.className},t),this.props.children)}}]),t}(u.Component);f.propTypes={dataAlign:u.PropTypes.string,hidden:u.PropTypes.bool,className:u.PropTypes.string,columnTitle:u.PropTypes.string,children:u.PropTypes.node},f.defaultProps={dataAlign:"left",hidden:!1,className:""},t["default"]=f,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(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)}Object.defineProperty(t,"__esModule",{value:!0});var i=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},s=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}}(),l=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},u=r(1),p=o(u),c=r(7),d=o(c),f=r(8),h=o(f),y=r(3),v=o(y),m=function(e){function t(e){var r=this;n(this,t),l(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),this.handleKeyPress=function(e){if(13===e.keyCode){var t="checkbox"===e.currentTarget.type?r._getCheckBoxValue(e):e.currentTarget.value;if(!r.validator(t))return;r.props.completeEdit(t,r.props.rowIndex,r.props.colIndex)}else if(27===e.keyCode)r.props.completeEdit(null,r.props.rowIndex,r.props.colIndex);else if("click"===e.type){var t=e.target.parentElement.firstChild.value;if(!r.validator(t))return;r.props.completeEdit(t,r.props.rowIndex,r.props.colIndex)}},this.handleBlur=function(e){if(e.stopPropagation(),r.props.blurToSave){var t="checkbox"===e.currentTarget.type?r._getCheckBoxValue(e):e.currentTarget.value;if(!r.validator(t))return;r.props.completeEdit(t,r.props.rowIndex,r.props.colIndex)}},this.handleCustomUpdate=function(e){r.props.completeEdit(e,r.props.rowIndex,r.props.colIndex)},this.timeouteClear=0,this.state={shakeEditor:!1}}return a(t,e),s(t,[{key:"validator",value:function(e){var t=this;if(t.props.editable.validator){var r=t.props.editable.validator(e);if(r!==!0){t.refs.notifier.notice("error",r,"Pressed ESC can cancel");var o=t.refs.inputRef;return t.clearTimeout(),t.setState({shakeEditor:!0}),t.timeouteClear=setTimeout(function(){t.setState({shakeEditor:!1})},300),o.focus(),!1}}return!0}},{key:"clearTimeout",value:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(){0!==this.timeouteClear&&(clearTimeout(this.timeouteClear),this.timeouteClear=0)})},{key:"componentDidMount",value:function(){this.refs.inputRef.focus()}},{key:"componentWillUnmount",value:function(){this.clearTimeout()}},{key:"render",value:function(){var e=this.props,t=e.editable,r=e.format,o=e.fieldValue,n=e.customEditor,a=this.state.shakeEditor,s={ref:"inputRef",onKeyDown:this.handleKeyPress,onBlur:this.handleBlur};t.placeholder&&(s.placeholder=t.placeholder);var l=(0,v["default"])({animated:a,shake:a}),u=void 0;if(n){var c=i({row:this.props.row},s,{defaultValue:o||""},n.customEditorParameters);u=n.getElement(this.handleCustomUpdate,c)}else u=(0,d["default"])(t,s,r,l,o||"");return p["default"].createElement("td",{ref:"td",style:{position:"relative"}},u,p["default"].createElement(h["default"],{ref:"notifier"}))}},{key:"_getCheckBoxValue",value:function(e){var t="",r=e.currentTarget.value.split(":");return t=e.currentTarget.checked?r[0]:r[1]}}]),t}(u.Component);m.propTypes={completeEdit:u.PropTypes.func,rowIndex:u.PropTypes.number,colIndex:u.PropTypes.number,blurToSave:u.PropTypes.bool,editable:u.PropTypes.oneOfType([u.PropTypes.bool,u.PropTypes.object]),format:u.PropTypes.oneOfType([u.PropTypes.bool,u.PropTypes.func]),row:u.PropTypes.any,fieldValue:u.PropTypes.oneOfType([u.PropTypes.string,u.PropTypes.bool,u.PropTypes.number,u.PropTypes.array,u.PropTypes.object])},t["default"]=m,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(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)}Object.defineProperty(t,"__esModule",{value:!0});var i=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}}(),s=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},l=r(1),u=o(l),p=r(2),c=o(p),d=r(3),f=o(d),h=function(e){function t(e){var r=this;n(this,t),s(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),this.handleKeyUp=function(e){var t=e.currentTarget,o=t.value,n=t.name;""===o.trim()?delete r.filterObj[n]:r.filterObj[n]=o,r.props.onFilter(r.filterObj)},this.filterObj={}}return a(t,e),i(t,[{key:"render",value:function(){var e=this.props,t=e.striped,r=e.condensed,o=e.rowSelectType,n=e.columns,a=(0,f["default"])("table",{"table-striped":t,"table-condensed":r}),i=null;if(o===c["default"].ROW_SELECT_SINGLE||o===c["default"].ROW_SELECT_MULTI){var s={width:35,paddingLeft:0,paddingRight:0};i=u["default"].createElement("th",{style:s,key:-1},"Filter")}var l=n.map(function(e){var t=e.hidden,r=e.width,o=e.name,n={display:t?"none":null,width:r};return u["default"].createElement("th",{key:o,style:n},u["default"].createElement("div",{className:"th-inner table-header-column"},u["default"].createElement("input",{size:"10",type:"text",placeholder:o,name:o,onKeyUp:this.handleKeyUp})))},this);return u["default"].createElement("table",{className:a,style:{marginTop:5}},u["default"].createElement("thead",null,u["default"].createElement("tr",{style:{borderBottomStyle:"hidden"}},i,l)))}}]),t}(l.Component);h.propTypes={columns:l.PropTypes.array,rowSelectType:l.PropTypes.string,onFilter:l.PropTypes.func},t["default"]=h,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(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)}Object.defineProperty(t,"__esModule",{value:!0});var i=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}}(),s=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},l=r(1),u=o(l),p=r(6),c=o(p),d=r(2),f=o(d),h=r(3),y=o(h),v=r(13),m=o(v),g=function(e){function t(){n(this,t),s(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments)}return a(t,e),i(t,[{key:"componentDidMount",value:function(){this.update(this.props.checked)}},{key:"componentWillReceiveProps",value:function(e){this.update(e.checked)}},{key:"update",value:function(e){c["default"].findDOMNode(this).indeterminate="indeterminate"===e}},{key:"render",value:function(){return u["default"].createElement("input",{className:"react-bs-select-all",type:"checkbox",checked:this.props.checked,onChange:this.props.onChange})}}]),t}(l.Component),b=function(e){function t(){n(this,t),s(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments)}return a(t,e),i(t,[{key:"render",value:function(){var e=this,t=(0,y["default"])("react-bs-container-header","table-header-wrapper"),r=(0,y["default"])("table","table-hover",{"table-bordered":this.props.bordered,"table-condensed":this.props.condensed},this.props.tableHeaderClass),o=null;this.props.hideSelectColumn||(o=this.renderSelectRowHeader());var n=0;return u["default"].createElement("div",{ref:"container",className:t,style:this.props.style},u["default"].createElement("table",{className:r},u["default"].createElement("thead",null,u["default"].createElement("tr",{ref:"header"},o,u["default"].Children.map(this.props.children,function(t){var r=e.props,o=r.sortIndicator,a=r.sortName,i=r.sortOrder,s=r.onSort,l=t.props,p=l.dataField,c=l.dataSort,d=c&&p===a?i:void 0;return u["default"].cloneElement(t,{key:n++,onSort:s,sort:d,sortIndicator:o})})))))}},{key:"renderSelectRowHeader",value:function(){if(this.props.customComponent){var e=this.props.customComponent;return u["default"].createElement(m["default"],null,u["default"].createElement(e,{type:"checkbox",checked:this.props.isSelectAll,indeterminate:"indeterminate"===this.props.isSelectAll,disabled:!1,onChange:this.props.onSelectAllRow,rowIndex:"Header"}))}return this.props.rowSelectType===f["default"].ROW_SELECT_SINGLE?u["default"].createElement(m["default"],null):this.props.rowSelectType===f["default"].ROW_SELECT_MULTI?u["default"].createElement(m["default"],null,u["default"].createElement(g,{onChange:this.props.onSelectAllRow,checked:this.props.isSelectAll})):null}}]),t}(l.Component);b.propTypes={tableHeaderClass:l.PropTypes.string,style:l.PropTypes.object,rowSelectType:l.PropTypes.string,onSort:l.PropTypes.func,onSelectAllRow:l.PropTypes.func,sortName:l.PropTypes.string,sortOrder:l.PropTypes.string,hideSelectColumn:l.PropTypes.bool,bordered:l.PropTypes.bool,condensed:l.PropTypes.bool,isFiltered:l.PropTypes.bool,isSelectAll:l.PropTypes.oneOf([!0,"indeterminate",!1]),sortIndicator:l.PropTypes.bool,customComponent:l.PropTypes.func},t["default"]=b,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(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)}Object.defineProperty(t,"__esModule",{value:!0});var i=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},s=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}}(),l=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},u=r(1),p=o(u),c=r(2),d=o(c),f=r(5),h=o(f),y=r(22),v=o(y),m=r(26),g=o(m),b=r(24),T=o(b),E=r(25),P=o(E),_=r(23),w=o(_),O=function(e){function t(e){var r=this;n(this,t),l(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),this.handleColumnClick=function(){if(r.props.dataSort){var e=r.props.sort===d["default"].SORT_DESC?d["default"].SORT_ASC:d["default"].SORT_DESC;r.props.onSort(e,r.props.dataField)}},this.handleFilter=this.handleFilter.bind(this)}return a(t,e),s(t,[{key:"handleFilter",value:function(e,t){this.props.filter.emitter.handleFilter(this.props.dataField,e,t)}},{key:"getFilters",value:function(){switch(this.props.filter.type){case d["default"].FILTER_TYPE.TEXT:return p["default"].createElement(g["default"],i({ref:"textFilter"},this.props.filter,{columnName:this.props.children,filterHandler:this.handleFilter}));case d["default"].FILTER_TYPE.REGEX:return p["default"].createElement(T["default"],i({ref:"regexFilter"},this.props.filter,{columnName:this.props.children,filterHandler:this.handleFilter}));case d["default"].FILTER_TYPE.SELECT:return p["default"].createElement(P["default"],i({ref:"selectFilter"},this.props.filter,{columnName:this.props.children,filterHandler:this.handleFilter}));case d["default"].FILTER_TYPE.NUMBER:return p["default"].createElement(w["default"],i({ref:"numberFilter"},this.props.filter,{columnName:this.props.children,filterHandler:this.handleFilter}));case d["default"].FILTER_TYPE.DATE:return p["default"].createElement(v["default"],i({ref:"dateFilter"},this.props.filter,{columnName:this.props.children,filterHandler:this.handleFilter}));case d["default"].FILTER_TYPE.CUSTOM:return this.props.filter.getElement(this.handleFilter,this.props.filter.customFilterParameters)}}},{key:"componentDidMount",value:function(){this.refs["header-col"].setAttribute("data-field",this.props.dataField)}},{key:"render",value:function(){var e=void 0,t=this.props,r=t.dataAlign,o=t.headerAlign,n=t.hidden,a=t.sort,s=t.dataSort,l=t.sortIndicator,u=t.children,c=t.caretRender,d={textAlign:o||r,display:n?"none":null};l&&(e=s?p["default"].createElement("span",{className:"order"},p["default"].createElement("span",{className:"dropdown"},p["default"].createElement("span",{className:"caret",style:{margin:"10px 0 10px 5px",color:"#ccc"}})),p["default"].createElement("span",{className:"dropup"},p["default"].createElement("span",{className:"caret",style:{margin:"10px 0",color:"#ccc"}}))):null);var f=a?h["default"].renderReactSortCaret(a):e;c&&(f=c(a));var y=this.props.className+" "+(s?"sort-column":""),v="string"==typeof u?{title:u}:null;return p["default"].createElement("th",i({ref:"header-col",className:y,style:d,onClick:this.handleColumnClick},v),u,f,p["default"].createElement("div",{onClick:function(e){return e.stopPropagation()}},this.props.filter?this.getFilters():null))}},{key:"cleanFiltered",value:function(){if(void 0!==this.props.filter)switch(this.props.filter.type){case d["default"].FILTER_TYPE.TEXT:this.refs.textFilter.cleanFiltered();break;case d["default"].FILTER_TYPE.REGEX:this.refs.regexFilter.cleanFiltered();break;case d["default"].FILTER_TYPE.SELECT:this.refs.selectFilter.cleanFiltered();break;case d["default"].FILTER_TYPE.NUMBER:this.refs.numberFilter.cleanFiltered();break;case d["default"].FILTER_TYPE.DATE:this.refs.dateFilter.cleanFiltered()}}},{key:"applyFilter",value:function(e){if(void 0!==this.props.filter)switch(this.props.filter.type){case d["default"].FILTER_TYPE.TEXT:this.refs.textFilter.applyFilter(e);break;case d["default"].FILTER_TYPE.REGEX:this.refs.regexFilter.applyFilter(e);break;case d["default"].FILTER_TYPE.SELECT:this.refs.selectFilter.applyFilter(e);break;case d["default"].FILTER_TYPE.NUMBER:this.refs.numberFilter.applyFilter(e);break;case d["default"].FILTER_TYPE.DATE:this.refs.dateFilter.applyFilter(e)}}}]),t}(u.Component),S=[];for(var C in d["default"].FILTER_TYPE)S.push(d["default"].FILTER_TYPE[C]);O.propTypes={dataField:u.PropTypes.string,dataAlign:u.PropTypes.string,headerAlign:u.PropTypes.string,dataSort:u.PropTypes.bool,onSort:u.PropTypes.func,dataFormat:u.PropTypes.func,csvFormat:u.PropTypes.func,csvHeader:u.PropTypes.string,isKey:u.PropTypes.bool,editable:u.PropTypes.any,hidden:u.PropTypes.bool,hiddenOnInsert:u.PropTypes.bool,searchable:u.PropTypes.bool,className:u.PropTypes.string,width:u.PropTypes.string,sortFunc:u.PropTypes.func,sortFuncExtraData:u.PropTypes.any,columnClassName:u.PropTypes.any,columnTitle:u.PropTypes.bool,filterFormatted:u.PropTypes.bool,filterValue:u.PropTypes.func,sort:u.PropTypes.string,caretRender:u.PropTypes.func,formatExtraData:u.PropTypes.any,filter:u.PropTypes.shape({type:u.PropTypes.oneOf(S),delay:u.PropTypes.number,options:u.PropTypes.oneOfType([u.PropTypes.object,u.PropTypes.arrayOf(u.PropTypes.number)]),numberComparators:u.PropTypes.arrayOf(u.PropTypes.string),emitter:u.PropTypes.object,placeholder:u.PropTypes.string,getElement:u.PropTypes.func,customFilterParameters:u.PropTypes.object}),sortIndicator:u.PropTypes.bool,"export":u.PropTypes.bool},O.defaultProps={dataAlign:"left",headerAlign:void 0,dataSort:!1,dataFormat:void 0,csvFormat:void 0,csvHeader:void 0,isKey:!1,editable:!0,onSort:void 0,hidden:!1,hiddenOnInsert:!1,searchable:!0,className:"",columnTitle:!1,width:null,sortFunc:void 0,columnClassName:"",filterFormatted:!1,filterValue:void 0,sort:void 0,formatExtraData:void 0,sortFuncExtraData:void 0,filter:void 0,sortIndicator:!0},t["default"]=O,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(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)}Object.defineProperty(t,"__esModule",{value:!0});var i=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},s=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}}(),l=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},u=r(3),p=o(u),c=r(1),d=o(c),f=function(e){
function t(e){var r=this;n(this,t),l(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),this.rowClick=function(e){"INPUT"!==e.target.tagName&&"SELECT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName&&!function(){var t=e.currentTarget.rowIndex+1,o=r.props,n=o.selectRow,a=o.unselectableRow,i=o.isSelected,s=o.onSelectRow;n&&(n.clickToSelect&&!a?s(t,!i,e):n.clickToSelectAndEditCell&&!a&&(r.clickNum++,setTimeout(function(){1===r.clickNum&&s(t,!i,e),r.clickNum=0},200))),r.props.onRowClick&&r.props.onRowClick(t)}()},this.rowMouseOut=function(e){r.props.onRowMouseOut&&r.props.onRowMouseOut(e.currentTarget.rowIndex,e)},this.rowMouseOver=function(e){r.props.onRowMouseOver&&r.props.onRowMouseOver(e.currentTarget.rowIndex,e)},this.clickNum=0}return a(t,e),s(t,[{key:"render",value:function(){this.clickNum=0;var e={style:{backgroundColor:this.props.isSelected?this.props.selectRow.bgColor:null},className:(0,p["default"])(this.props.isSelected?this.props.selectRow.className:null,this.props.className)};return this.props.selectRow&&(this.props.selectRow.clickToSelect||this.props.selectRow.clickToSelectAndEditCell)||this.props.onRowClick?d["default"].createElement("tr",i({},e,{onMouseOver:this.rowMouseOver,onMouseOut:this.rowMouseOut,onClick:this.rowClick}),this.props.children):d["default"].createElement("tr",e,this.props.children)}}]),t}(c.Component);f.propTypes={isSelected:c.PropTypes.bool,enableCellEdit:c.PropTypes.bool,onRowClick:c.PropTypes.func,onSelectRow:c.PropTypes.func,onRowMouseOut:c.PropTypes.func,onRowMouseOver:c.PropTypes.func,unselectableRow:c.PropTypes.bool},f.defaultProps={onRowClick:void 0},t["default"]=f,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){var r="";return 0===e.length?r:(r+=t.map(function(e){return e.header}).join(",")+"\n",e.map(function(e){t.map(function(o,n){var a=o.field,i=o.format,s="undefined"!=typeof i?i(e[a],e):e[a],l="undefined"!=typeof s?'"'+s+'"':"";r+=l,n+1<t.length&&(r+=",")}),r+="\n"}),r)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(5),i=o(a);if(i["default"].canUseDOM())var s=r(31),l=s.saveAs;var u=function(e,t,r){var o=n(e,t);"undefined"!=typeof window&&l(new Blob([o],{type:"text/plain;charset=utf-8"}),r)};t["default"]=u,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(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)}function i(e){return e.getFullYear()+"-"+("0"+(e.getMonth()+1)).slice(-2)+"-"+("0"+e.getDate()).slice(-2)}Object.defineProperty(t,"__esModule",{value:!0});var s=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}}(),l=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},u=r(1),p=o(u),c=r(2),d=o(c),f=["=",">",">=","<","<=","!="],h=function(e){function t(e){n(this,t),l(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),this.dateComparators=this.props.dateComparators||f,this.filter=this.filter.bind(this),this.onChangeComparator=this.onChangeComparator.bind(this)}return a(t,e),s(t,[{key:"setDefaultDate",value:function(){var e="",t=this.props.defaultValue;return t&&t.date&&(e=i(new Date(t.date))),e}},{key:"onChangeComparator",value:function(e){var t=this.refs.inputDate.value,r=e.target.value;""!==t&&(t=new Date(t),this.props.filterHandler({date:t,comparator:r},d["default"].FILTER_TYPE.DATE))}},{key:"getComparatorOptions",value:function(){var e=[];e.push(p["default"].createElement("option",{key:"-1"}));for(var t=0;t<this.dateComparators.length;t++)e.push(p["default"].createElement("option",{key:t,value:this.dateComparators[t]},this.dateComparators[t]));return e}},{key:"filter",value:function(e){var t=this.refs.dateFilterComparator.value,r=e.target.value;r?this.props.filterHandler({date:new Date(r),comparator:t},d["default"].FILTER_TYPE.DATE):this.props.filterHandler(null,d["default"].FILTER_TYPE.DATE)}},{key:"cleanFiltered",value:function(){var e=this.setDefaultDate(),t=this.props.defaultValue?this.props.defaultValue.comparator:"";this.setState({isPlaceholderSelected:""===e}),this.refs.dateFilterComparator.value=t,this.refs.inputDate.value=e,this.props.filterHandler({date:new Date(e),comparator:t},d["default"].FILTER_TYPE.DATE)}},{key:"applyFilter",value:function(e){var t=e.date,r=e.comparator;this.setState({isPlaceholderSelected:""===t}),this.refs.dateFilterComparator.value=r,this.refs.inputDate.value=i(t),this.props.filterHandler({date:t,comparator:r},d["default"].FILTER_TYPE.DATE)}},{key:"componentDidMount",value:function(){var e=this.refs.dateFilterComparator.value,t=this.refs.inputDate.value;e&&t&&this.props.filterHandler({date:new Date(t),comparator:e},d["default"].FILTER_TYPE.DATE)}},{key:"render",value:function(){var e=this.props.defaultValue;return p["default"].createElement("div",{className:"filter date-filter"},p["default"].createElement("select",{ref:"dateFilterComparator",className:"date-filter-comparator form-control",onChange:this.onChangeComparator,defaultValue:e?e.comparator:""},this.getComparatorOptions()),p["default"].createElement("input",{ref:"inputDate",className:"filter date-filter-input form-control",type:"date",onChange:this.filter,defaultValue:this.setDefaultDate()}))}}]),t}(u.Component);h.propTypes={filterHandler:u.PropTypes.func.isRequired,defaultValue:u.PropTypes.shape({date:u.PropTypes.object,comparator:u.PropTypes.oneOf(f)}),dateComparators:function(e,t){if(e[t])for(var r=0;r<e[t].length;r++){for(var o=!1,n=0;n<f.length;n++)if(f[n]===e[t][r]){o=!0;break}if(!o)return new Error("Date comparator provided is not supported.\n Use only "+f)}},columnName:u.PropTypes.string},t["default"]=h,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(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)}Object.defineProperty(t,"__esModule",{value:!0});var i=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}}(),s=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},l=r(1),u=o(l),p=r(3),c=o(p),d=r(2),f=o(d),h=["=",">",">=","<","<=","!="],y=function(e){function t(e){n(this,t),s(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),this.numberComparators=this.props.numberComparators||h,this.timeout=null,this.state={isPlaceholderSelected:void 0===this.props.defaultValue||void 0===this.props.defaultValue.number||this.props.options&&-1===this.props.options.indexOf(this.props.defaultValue.number)},this.onChangeNumber=this.onChangeNumber.bind(this),this.onChangeNumberSet=this.onChangeNumberSet.bind(this),this.onChangeComparator=this.onChangeComparator.bind(this)}return a(t,e),i(t,[{key:"onChangeNumber",value:function(e){var t=this,r=this.refs.numberFilterComparator.value;if(""!==r){this.timeout&&clearTimeout(this.timeout);var o=e.target.value;this.timeout=setTimeout(function(){t.props.filterHandler({number:o,comparator:r},f["default"].FILTER_TYPE.NUMBER)},this.props.delay)}}},{key:"onChangeNumberSet",value:function(e){var t=this.refs.numberFilterComparator.value,r=e.target.value;this.setState({isPlaceholderSelected:""===r}),""!==t&&this.props.filterHandler({number:r,comparator:t},f["default"].FILTER_TYPE.NUMBER)}},{key:"onChangeComparator",value:function(e){var t=this.refs.numberFilter.value,r=e.target.value;""!==t&&this.props.filterHandler({number:t,comparator:r},f["default"].FILTER_TYPE.NUMBER)}},{key:"cleanFiltered",value:function(){var e=this.props.defaultValue?this.props.defaultValue.number:"",t=this.props.defaultValue?this.props.defaultValue.comparator:"";this.setState({isPlaceholderSelected:""===e}),this.refs.numberFilterComparator.value=t,this.refs.numberFilter.value=e,this.props.filterHandler({number:e,comparator:t},f["default"].FILTER_TYPE.NUMBER)}},{key:"applyFilter",value:function(e){var t=e.number,r=e.comparator;this.setState({isPlaceholderSelected:""===t}),this.refs.numberFilterComparator.value=r,this.refs.numberFilter.value=t,this.props.filterHandler({number:t,comparator:r},f["default"].FILTER_TYPE.NUMBER)}},{key:"getComparatorOptions",value:function(){var e=[];e.push(u["default"].createElement("option",{key:"-1"}));for(var t=0;t<this.numberComparators.length;t++)e.push(u["default"].createElement("option",{key:t,value:this.numberComparators[t]},this.numberComparators[t]));return e}},{key:"getNumberOptions",value:function(){var e=[],t=this.props.options;e.push(u["default"].createElement("option",{key:"-1",value:""},this.props.placeholder||"Select "+this.props.columnName+"..."));for(var r=0;r<t.length;r++)e.push(u["default"].createElement("option",{key:r,value:t[r]},t[r]));return e}},{key:"componentDidMount",value:function(){var e=this.refs.numberFilterComparator.value,t=this.refs.numberFilter.value;e&&t&&this.props.filterHandler({number:t,comparator:e},f["default"].FILTER_TYPE.NUMBER)}},{key:"componentWillUnmount",value:function(){clearTimeout(this.timeout)}},{key:"render",value:function(){var e=(0,c["default"])("select-filter","number-filter-input","form-control",{"placeholder-selected":this.state.isPlaceholderSelected});return u["default"].createElement("div",{className:"filter number-filter"},u["default"].createElement("select",{ref:"numberFilterComparator",className:"number-filter-comparator form-control",onChange:this.onChangeComparator,defaultValue:this.props.defaultValue?this.props.defaultValue.comparator:""},this.getComparatorOptions()),this.props.options?u["default"].createElement("select",{ref:"numberFilter",className:e,onChange:this.onChangeNumberSet,defaultValue:this.props.defaultValue?this.props.defaultValue.number:""},this.getNumberOptions()):u["default"].createElement("input",{ref:"numberFilter",type:"number",className:"number-filter-input form-control",placeholder:this.props.placeholder||"Enter "+this.props.columnName+"...",onChange:this.onChangeNumber,defaultValue:this.props.defaultValue?this.props.defaultValue.number:""}))}}]),t}(l.Component);y.propTypes={filterHandler:l.PropTypes.func.isRequired,options:l.PropTypes.arrayOf(l.PropTypes.number),defaultValue:l.PropTypes.shape({number:l.PropTypes.number,comparator:l.PropTypes.oneOf(h)}),delay:l.PropTypes.number,numberComparators:function(e,t){if(e[t])for(var r=0;r<e[t].length;r++){for(var o=!1,n=0;n<h.length;n++)if(h[n]===e[t][r]){o=!0;break}if(!o)return new Error("Number comparator provided is not supported.\n Use only "+h)}},placeholder:l.PropTypes.string,columnName:l.PropTypes.string},y.defaultProps={delay:f["default"].FILTER_DELAY},t["default"]=y,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(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)}Object.defineProperty(t,"__esModule",{value:!0});var i=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}}(),s=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},l=r(1),u=o(l),p=r(2),c=o(p),d=function(e){function t(e){n(this,t),s(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),this.filter=this.filter.bind(this),this.timeout=null}return a(t,e),i(t,[{key:"filter",value:function(e){var t=this;this.timeout&&clearTimeout(this.timeout);var r=e.target.value;this.timeout=setTimeout(function(){t.props.filterHandler(r,c["default"].FILTER_TYPE.REGEX)},this.props.delay)}},{key:"cleanFiltered",value:function(){var e=this.props.defaultValue?this.props.defaultValue:"";this.refs.inputText.value=e,this.props.filterHandler(e,c["default"].FILTER_TYPE.TEXT)}},{key:"applyFilter",value:function(e){this.refs.inputText.value=e,this.props.filterHandler(e,c["default"].FILTER_TYPE.REGEX)}},{key:"componentDidMount",value:function(){var e=this.refs.inputText.value;e&&this.props.filterHandler(e,c["default"].FILTER_TYPE.REGEX)}},{key:"componentWillUnmount",value:function(){clearTimeout(this.timeout)}},{key:"render",value:function(){var e=this.props,t=e.defaultValue,r=e.placeholder,o=e.columnName;return u["default"].createElement("input",{ref:"inputText",className:"filter text-filter form-control",type:"text",onChange:this.filter,placeholder:r||"Enter Regex for "+o+"...",defaultValue:t?t:""})}}]),t}(l.Component);d.propTypes={filterHandler:l.PropTypes.func.isRequired,defaultValue:l.PropTypes.string,delay:l.PropTypes.number,placeholder:l.PropTypes.string,columnName:l.PropTypes.string},d.defaultProps={delay:c["default"].FILTER_DELAY},t["default"]=d,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(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)}Object.defineProperty(t,"__esModule",{value:!0});var i=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}}(),s=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},l=r(1),u=o(l),p=r(3),c=o(p),d=r(2),f=o(d),h=function(e){function t(e){n(this,t),s(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),this.filter=this.filter.bind(this),this.state={isPlaceholderSelected:void 0===this.props.defaultValue||!this.props.options.hasOwnProperty(this.props.defaultValue)}}return a(t,e),i(t,[{key:"filter",value:function(e){var t=e.target.value;this.setState({isPlaceholderSelected:""===t}),this.props.filterHandler(t,f["default"].FILTER_TYPE.SELECT)}},{key:"cleanFiltered",value:function(){var e=void 0!==this.props.defaultValue?this.props.defaultValue:"";this.setState({isPlaceholderSelected:""===e}),this.refs.selectInput.value=e,this.props.filterHandler(e,f["default"].FILTER_TYPE.SELECT)}},{key:"applyFilter",value:function(e){e+="",this.setState({isPlaceholderSelected:""===e}),this.refs.selectInput.value=e,this.props.filterHandler(e,f["default"].FILTER_TYPE.SELECT)}},{key:"getOptions",value:function(){var e=[],t=this.props,r=t.options,o=t.placeholder,n=t.columnName;return e.push(u["default"].createElement("option",{key:"-1",value:""},o||"Select "+n+"...")),Object.keys(r).map(function(t){e.push(u["default"].createElement("option",{key:t,value:t},r[t]))}),e}},{key:"componentDidMount",value:function(){var e=this.refs.selectInput.value;e&&this.props.filterHandler(e,f["default"].FILTER_TYPE.SELECT)}},{key:"render",value:function(){var e=(0,c["default"])("filter","select-filter","form-control",{"placeholder-selected":this.state.isPlaceholderSelected});return u["default"].createElement("select",{ref:"selectInput",className:e,onChange:this.filter,defaultValue:void 0!==this.props.defaultValue?this.props.defaultValue:""},this.getOptions())}}]),t}(l.Component);h.propTypes={filterHandler:l.PropTypes.func.isRequired,options:l.PropTypes.object.isRequired,placeholder:l.PropTypes.string,columnName:l.PropTypes.string},t["default"]=h,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(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)}Object.defineProperty(t,"__esModule",{value:!0});var i=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}}(),s=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},l=r(1),u=o(l),p=r(2),c=o(p),d=function(e){function t(e){n(this,t),s(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),this.filter=this.filter.bind(this),this.timeout=null}return a(t,e),i(t,[{key:"filter",value:function(e){var t=this;this.timeout&&clearTimeout(this.timeout);var r=e.target.value;this.timeout=setTimeout(function(){t.props.filterHandler(r,c["default"].FILTER_TYPE.TEXT)},this.props.delay)}},{key:"cleanFiltered",value:function(){var e=this.props.defaultValue?this.props.defaultValue:"";this.refs.inputText.value=e,this.props.filterHandler(e,c["default"].FILTER_TYPE.TEXT)}},{key:"applyFilter",value:function(e){this.refs.inputText.value=e,this.props.filterHandler(e,c["default"].FILTER_TYPE.TEXT)}},{key:"componentDidMount",value:function(){var e=this.refs.inputText.value;e&&this.props.filterHandler(e,c["default"].FILTER_TYPE.TEXT)}},{key:"componentWillUnmount",value:function(){clearTimeout(this.timeout)}},{key:"render",value:function(){var e=this.props,t=e.placeholder,r=e.columnName,o=e.defaultValue;return u["default"].createElement("input",{ref:"inputText",className:"filter text-filter form-control",type:"text",onChange:this.filter,placeholder:t||"Enter "+r+"...",defaultValue:o?o:""})}}]),t}(l.Component);d.propTypes={filterHandler:l.PropTypes.func.isRequired,defaultValue:l.PropTypes.string,delay:l.PropTypes.number,placeholder:l.PropTypes.string,columnName:l.PropTypes.string},d.defaultProps={delay:c["default"].FILTER_DELAY},t["default"]=d,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(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)}Object.defineProperty(t,"__esModule",{value:!0});var i=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}}(),s=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},l=r(1),u=o(l),p=r(3),c=o(p),d=function(e){function t(e){var r=this;n(this,t),s(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),this.pageBtnClick=function(e){e.preventDefault(),r.props.changePage(e.currentTarget.textContent)}}return a(t,e),i(t,[{key:"render",value:function(){var e=(0,c["default"])({active:this.props.active,disabled:this.props.disable,hidden:this.props.hidden});return u["default"].createElement("li",{className:e},u["default"].createElement("a",{href:"#",onClick:this.pageBtnClick},this.props.children))}}]),t}(l.Component);d.propTypes={changePage:l.PropTypes.func,active:l.PropTypes.bool,disable:l.PropTypes.bool,hidden:l.PropTypes.bool,children:l.PropTypes.node},t["default"]=d,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(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)}Object.defineProperty(t,"__esModule",{value:!0});var i=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}}(),s=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},l=r(1),u=o(l),p=r(27),c=o(p),d=r(2),f=o(d),h=function(e){function t(){var e=this;n(this,t),s(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments),this.changePage=function(t){var r=e.props,o=r.pageStartIndex,n=r.prePage,a=r.currPage,i=r.nextPage,s=r.lastPage,l=r.firstPage,u=r.sizePerPage;t=t===n?o>a-1?o:a-1:t===i?a+1>e.lastPage?e.lastPage:a+1:t===s?e.lastPage:t===l?o:parseInt(t,10),t!==a&&e.props.changePage(t,u)},this.changeSizePerPage=function(t){t.preventDefault();var r=parseInt(t.currentTarget.text,10),o=e.props.currPage;r!==e.props.sizePerPage&&(e.totalPages=Math.ceil(e.props.dataSize/r),e.lastPage=e.props.pageStartIndex+e.totalPages-1,o>e.lastPage&&(o=e.lastPage),e.props.changePage(o,r),e.props.onSizePerPageList&&e.props.onSizePerPageList(r))}}return a(t,e),i(t,[{key:"render",value:function(){var e=this,t=this.props,r=t.currPage,o=t.dataSize,n=t.sizePerPage,a=t.sizePerPageList,i=t.paginationShowsTotal,s=t.pageStartIndex,l=t.hideSizePerPage;this.totalPages=Math.ceil(o/n),this.lastPage=this.props.pageStartIndex+this.totalPages-1;var p=this.makePage(),c={"float":"right",marginTop:"0px"},d=a.map(function(t){return u["default"].createElement("li",{key:t,role:"presentation"},u["default"].createElement("a",{role:"menuitem",tabIndex:"-1",href:"#",onClick:e.changeSizePerPage},t))}),h=Math.abs(f["default"].PAGE_START_INDEX-s),y=(r-s)*n,v=Math.min(n*(r+h)-1,o),m=i?u["default"].createElement("span",null,"Showing rows ",y," to ",v," of ",o):null;"function"==typeof i&&(m=i(y,v,o));var g={visibility:l?"hidden":"visible"};return u["default"].createElement("div",{className:"row",style:{marginTop:15}},a.length>1?u["default"].createElement("div",null,u["default"].createElement("div",{className:"col-md-6"},m," ",u["default"].createElement("span",{className:"dropdown",style:g},u["default"].createElement("button",{className:"btn btn-default dropdown-toggle",type:"button",id:"pageDropDown","data-toggle":"dropdown","aria-expanded":"true"},n,u["default"].createElement("span",null," ",u["default"].createElement("span",{className:"caret"}))),u["default"].createElement("ul",{className:"dropdown-menu",role:"menu","aria-labelledby":"pageDropDown"},d))),u["default"].createElement("div",{className:"col-md-6"},u["default"].createElement("ul",{className:"pagination",style:c},p))):u["default"].createElement("div",null,u["default"].createElement("div",{className:"col-md-6"},m),u["default"].createElement("div",{className:"col-md-6"},u["default"].createElement("ul",{className:"pagination",style:c},p))))}},{key:"makePage",value:function(){var e=this.getPages();return e.map(function(e){var t=e===this.props.currPage,r=!1,o=!1;return this.props.currPage!==this.props.pageStartIndex||e!==this.props.firstPage&&e!==this.props.prePage||(r=!0,o=!0),this.props.currPage!==this.lastPage||e!==this.props.nextPage&&e!==this.props.lastPage||(r=!0,o=!0),u["default"].createElement(c["default"],{key:e,changePage:this.changePage,active:t,disable:r,hidden:o},e)},this)}},{key:"getPages",value:function(){var e=void 0,t=this.totalPages;if(0>=t)return[];var r=Math.max(this.props.currPage-Math.floor(this.props.paginationSize/2),this.props.pageStartIndex);t=r+this.props.paginationSize-1,t>this.lastPage&&(t=this.lastPage,r=t-this.props.paginationSize+1),e=r!==this.props.pageStartIndex&&this.totalPages>this.props.paginationSize?[this.props.firstPage,this.props.prePage]:this.totalPages>1?[this.props.prePage]:[];for(var o=r;t>=o;o++)o>=this.props.pageStartIndex&&e.push(o);return t<this.lastPage?(e.push(this.props.nextPage),e.push(this.props.lastPage)):t===this.lastPage&&this.props.currPage!==this.lastPage&&e.push(this.props.nextPage),e}}]),t}(l.Component);h.propTypes={currPage:l.PropTypes.number,sizePerPage:l.PropTypes.number,dataSize:l.PropTypes.number,changePage:l.PropTypes.func,sizePerPageList:l.PropTypes.array,paginationShowsTotal:l.PropTypes.bool,paginationSize:l.PropTypes.number,remote:l.PropTypes.bool,onSizePerPageList:l.PropTypes.func,prePage:l.PropTypes.string,pageStartIndex:l.PropTypes.number,hideSizePerPage:l.PropTypes.bool},h.defaultProps={sizePerPage:f["default"].SIZE_PER_PAGE,pageStartIndex:f["default"].PAGE_START_INDEX},t["default"]=h,e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t,r,o,n){r=r.toLowerCase();var a=r===l["default"].SORT_DESC;return e.sort(function(e,i){if(o)return o(e,i,r,t,n);var s=null===e[t]?"":e[t],l=null===i[t]?"":i[t];return a?"string"==typeof l?l.localeCompare(s):s>l?-1:l>s?1:0:"string"==typeof s?s.localeCompare(l):l>s?-1:s>l?1:0}),e}Object.defineProperty(t,"__esModule",{value:!0});var i=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}}(),s=r(2),l=o(s),u=function(){function e(t){n(this,e),this.data=t,this.colInfos=null,this.filteredData=null,this.isOnFilter=!1,this.filterObj=null,this.searchText=null,this.sortObj=null,this.pageObj={},this.selected=[],this.multiColumnSearch=!1,this.showOnlySelected=!1,this.remote=!1}return i(e,[{key:"setProps",value:function(e){this.keyField=e.keyField,this.enablePagination=e.isPagination,this.colInfos=e.colInfos,this.remote=e.remote,this.multiColumnSearch=e.multiColumnSearch}},{key:"setData",value:function(e){this.data=e,this.remote||this._refresh(!0)}},{key:"getColInfos",value:function(){return this.colInfos}},{key:"getSortInfo",value:function(){return this.sortObj}},{key:"setSortInfo",value:function(e,t){this.sortObj={order:e,sortField:t}}},{key:"setSelectedRowKey",value:function(e){this.selected=e}},{key:"getRowByKey",value:function(e){var t=this;return e.map(function(e){var r=t.data.filter(function(r){return r[t.keyField]===e});return 0!==r.length?r[0]:void 0})}},{key:"getSelectedRowKeys",value:function(){return this.selected}},{key:"getCurrentDisplayData",value:function(){return this.isOnFilter?this.filteredData:this.data}},{key:"_refresh",value:function(e){this.isOnFilter&&(null!==this.filterObj&&this.filter(this.filterObj),null!==this.searchText&&this.search(this.searchText)),!e&&this.sortObj&&this.sort(this.sortObj.order,this.sortObj.sortField)}},{key:"ignoreNonSelected",value:function(){var e=this;this.showOnlySelected=!this.showOnlySelected,this.showOnlySelected?(this.isOnFilter=!0,this.filteredData=this.data.filter(function(t){var r=e.selected.find(function(r){return t[e.keyField]===r});return"undefined"!=typeof r?!0:!1})):this.isOnFilter=!1}},{key:"sort",value:function(e,t){this.setSortInfo(e,t);var r=this.getCurrentDisplayData();if(!this.colInfos[t])return this;var o=this.colInfos[t],n=o.sortFunc,i=o.sortFuncExtraData;return r=a(r,t,e,n,i),this}},{key:"page",value:function(e,t){return this.pageObj.end=e*t-1,this.pageObj.start=this.pageObj.end-(t-1),this}},{key:"edit",value:function(e,t,r){var o=this.getCurrentDisplayData(),n=void 0;return this.enablePagination?(o[this.pageObj.start+t][r]=e,n=o[this.pageObj.start+t][this.keyField]):(o[t][r]=e,n=o[t][this.keyField]),this.isOnFilter&&(this.data.forEach(function(t){t[this.keyField]===n&&(t[r]=e)},this),null!==this.filterObj&&this.filter(this.filterObj),null!==this.searchText&&this.search(this.searchText)),this}},{key:"addAtBegin",value:function(e){if(!e[this.keyField]||""===e[this.keyField].toString())throw this.keyField+" can't be empty value.";var t=this.getCurrentDisplayData();t.forEach(function(t){if(t[this.keyField].toString()===e[this.keyField].toString())throw this.keyField+" "+e[this.keyField]+" already exists"},this),t.unshift(e),this.isOnFilter&&this.data.unshift(e),this._refresh(!1)}},{key:"add",value:function(e){if(!e[this.keyField]||""===e[this.keyField].toString())throw this.keyField+" can't be empty value.";var t=this.getCurrentDisplayData();t.forEach(function(t){if(t[this.keyField].toString()===e[this.keyField].toString())throw this.keyField+" "+e[this.keyField]+" already exists"},this),t.push(e),this.isOnFilter&&this.data.push(e),this._refresh(!1)}},{key:"remove",value:function(e){var t=this,r=this.getCurrentDisplayData(),o=r.filter(function(r){return-1===e.indexOf(r[t.keyField])});this.isOnFilter?(this.data=this.data.filter(function(r){return-1===e.indexOf(r[t.keyField])}),this.filteredData=o):this.data=o}},{key:"filter",value:function(e){if(0===Object.keys(e).length)this.filteredData=null,this.isOnFilter=!1,this.filterObj=null,this.searchText&&this._search(this.data);else{var t=this.data;this.filterObj=e,this.searchText&&(this._search(t),t=this.filteredData),this._filter(t)}}},{key:"filterNumber",value:function(e,t,r){var o=!0;switch(r){case"=":e!=t&&(o=!1);break;case">":
t>=e&&(o=!1);break;case">=":t>e&&(o=!1);break;case"<":e>=t&&(o=!1);break;case"<=":e>t&&(o=!1);break;case"!=":e==t&&(o=!1);break;default:console.error("Number comparator provided is not supported")}return o}},{key:"filterDate",value:function(e,t,r){var o=!0;switch(r){case"=":e!=t&&(o=!1);break;case">":t>=e&&(o=!1);break;case">=":t>e&&(o=!1);break;case"<":e>=t&&(o=!1);break;case"<=":e>t&&(o=!1);break;case"!=":e==t&&(o=!1);break;default:console.error("Date comparator provided is not supported")}return o}},{key:"filterRegex",value:function(e,t){try{return new RegExp(t,"i").test(e)}catch(r){return console.error("Invalid regular expression"),!0}}},{key:"filterCustom",value:function(e,t,r){return null!==r&&"object"==typeof r?r.callback(e,r.callbackParameters):this.filterText(e,t)}},{key:"filterText",value:function(e,t){return-1===e.toString().toLowerCase().indexOf(t)?!1:!0}},{key:"search",value:function(e){if(""===e.trim())this.filteredData=null,this.isOnFilter=!1,this.searchText=null,this.filterObj&&this._filter(this.data);else{var t=this.data;this.searchText=e,this.filterObj&&(this._filter(t),t=this.filteredData),this._search(t)}}},{key:"_filter",value:function(e){var t=this,r=this.filterObj;this.filteredData=e.filter(function(e,o){var n=!0,a=void 0;for(var i in r){var s=e[i];switch((null===s||void 0===s)&&(s=""),r[i].type){case l["default"].FILTER_TYPE.NUMBER:a=r[i].value.number;break;case l["default"].FILTER_TYPE.CUSTOM:a="object"==typeof r[i].value?void 0:"string"==typeof r[i].value?r[i].value.toLowerCase():r[i].value;break;case l["default"].FILTER_TYPE.DATE:a=r[i].value.date;break;case l["default"].FILTER_TYPE.REGEX:a=r[i].value;break;default:a="string"==typeof r[i].value?r[i].value.toLowerCase():r[i].value,void 0===a&&(a=r[i].toLowerCase())}var u=void 0,p=void 0,c=void 0,d=void 0;switch(t.colInfos[i]&&(u=t.colInfos[i].format,p=t.colInfos[i].filterFormatted,c=t.colInfos[i].formatExtraData,d=t.colInfos[i].filterValue,p&&u?s=u(e[i],e,c,o):d&&(s=d(e[i],e))),r[i].type){case l["default"].FILTER_TYPE.NUMBER:n=t.filterNumber(s,a,r[i].value.comparator);break;case l["default"].FILTER_TYPE.DATE:n=t.filterDate(s,a,r[i].value.comparator);break;case l["default"].FILTER_TYPE.REGEX:n=t.filterRegex(s,a);break;case l["default"].FILTER_TYPE.CUSTOM:n=t.filterCustom(s,a,r[i].value);break;default:r[i].type===l["default"].FILTER_TYPE.SELECT&&p&&p&&u&&(a=u(a,e,c,o)),n=t.filterText(s,a)}if(!n)break}return n}),this.isOnFilter=!0}},{key:"_search",value:function(e){var t=this,r=[];this.multiColumnSearch?r=this.searchText.split(" "):r.push(this.searchText),this.filteredData=e.filter(function(e,o){for(var n=Object.keys(e),a=!1,i=0,s=n.length;s>i;i++){var l=n[i];if(t.colInfos[l]&&e[l]){var u=t.colInfos[l],p=u.format,c=u.filterFormatted,d=u.filterValue,f=u.formatExtraData,h=u.searchable,y=e[l];if(h){c&&p?y=p(y,e,f,o):d&&(y=d(y,e));for(var v=0,m=r.length;m>v;v++){var g=r[v].toLowerCase();if(-1!==y.toString().toLowerCase().indexOf(g)){a=!0;break}}}}}return a}),this.isOnFilter=!0}},{key:"getDataIgnoringPagination",value:function(){return this.getCurrentDisplayData()}},{key:"get",value:function(){var e=this.getCurrentDisplayData();if(0===e.length)return e;if(this.remote||!this.enablePagination)return e;for(var t=[],r=this.pageObj.start;r<=this.pageObj.end&&(t.push(e[r]),r+1!==e.length);r++);return t}},{key:"getKeyField",value:function(){return this.keyField}},{key:"getDataNum",value:function(){return this.getCurrentDisplayData().length}},{key:"isChangedPage",value:function(){return this.pageObj.start&&this.pageObj.end?!0:!1}},{key:"isEmpty",value:function(){return 0===this.data.length||null===this.data||void 0===this.data}},{key:"getAllRowkey",value:function(){var e=this;return this.data.map(function(t){return t[e.keyField]})}}]),e}();t.TableDataStore=u},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(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)}Object.defineProperty(t,"__esModule",{value:!0});var i=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}}(),s=function(e,t,r){for(var o=!0;o;){var n=e,a=t,i=r;o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,a);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(i)}var u=Object.getPrototypeOf(n);if(null===u)return;e=u,t=a,r=i,o=!0,s=u=void 0}},l=r(1),u=o(l),p=r(3),c=o(p),d=r(2),f=o(d),h=r(7),y=o(h),v=r(8),m=o(v),g=function(e){function t(e){var r=this,o=arguments;n(this,t),s(Object.getPrototypeOf(t.prototype),"constructor",this).call(this,e),this.handleSaveBtnClick=function(){var e=r.checkAndParseForm();if(e){var t=r.props.onAddRow(e);t?(r.refs.notifier.notice("error",t,"Pressed ESC can cancel"),r.clearTimeout(),r.setState({shakeEditor:!0,validateState:"this is hack for prevent bootstrap modal hide"}),r.timeouteClear=setTimeout(function(){r.setState({shakeEditor:!1})},300)):(r.setState({validateState:null,shakeEditor:!1},function(){document.querySelector(".modal-backdrop").click(),document.querySelector("."+r.modalClassName).click()}),r.refs.form.reset())}},this.handleShowOnlyToggle=function(){r.setState({showSelected:!r.state.showSelected}),r.props.onShowOnlySelected()},this.handleDropRowBtnClick=function(){r.props.onDropRow()},this.handleDebounce=function(e,t,n){var a=void 0;return function(){var i=function(){a=null,n||e.apply(r,o)},s=n&&!a;clearTimeout(a),a=setTimeout(i,t||0),s&&e.appy(r,o)}},this.handleKeyUp=function(e){e.persist(),r.debounceCallback(e)},this.handleExportCSV=function(){r.props.onExportCSV()},this.handleClearBtnClick=function(){r.refs.seachInput.value="",r.props.onSearch("")},this.timeouteClear=0,this.modalClassName,this.state={isInsertRowTrigger:!0,validateState:null,shakeEditor:!1,showSelected:!1}}return a(t,e),i(t,null,[{key:"modalSeq",value:0,enumerable:!0}]),i(t,[{key:"componentWillMount",value:function(){var e=this,t=this.props.searchDelayTime?this.props.searchDelayTime:0;this.debounceCallback=this.handleDebounce(function(){e.props.onSearch(e.refs.seachInput.value)},t)}},{key:"componentWillUnmount",value:function(){this.clearTimeout()}},{key:"clearTimeout",value:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(){this.timeouteClear&&(clearTimeout(this.timeouteClear),this.timeouteClear=0)})},{key:"checkAndParseForm",value:function(){var e=this,t={},r={},o=!0,n=void 0,a=void 0;return this.props.columns.forEach(function(e,i){if(e.autoValue){var s=(new Date).getTime();n="function"==typeof e.autoValue?e.autoValue():"autovalue-"+s}else if(e.hiddenOnInsert)n="";else{var l=this.refs[e.field+i];if(n=l.value,e.editable&&"checkbox"===e.editable.type){var u=n.split(":");n=l.checked?u[0]:u[1]}e.editable&&e.editable.validator&&(a=e.editable.validator(n),a!==!0&&(o=!1,r[e.field]=a))}t[e.field]=n},this),o?t:(this.clearTimeout(),this.setState({validateState:r,shakeEditor:!0}),this.refs.notifier.notice("error","Form validate errors, please checking!","Pressed ESC can cancel"),this.timeouteClear=setTimeout(function(){e.setState({shakeEditor:!1})},300),null)}},{key:"handleCloseBtn",value:function(){this.refs.warning.style.display="none"}},{key:"render",value:function(){this.modalClassName="bs-table-modal-sm"+t.modalSeq++;var e=null,r=null,o=null,n=null;this.props.enableInsert&&(e=u["default"].createElement("button",{type:"button",className:"btn btn-info react-bs-table-add-btn","data-toggle":"modal","data-target":"."+this.modalClassName},u["default"].createElement("i",{className:"glyphicon glyphicon-plus"})," ",this.props.insertText)),this.props.enableDelete&&(r=u["default"].createElement("button",{type:"button",className:"btn btn-warning react-bs-table-del-btn","data-toggle":"tooltip","data-placement":"right",title:"Drop selected row",onClick:this.handleDropRowBtnClick},u["default"].createElement("i",{className:"glyphicon glyphicon-trash"})," ",this.props.deleteText)),this.props.enableShowOnlySelected&&(n=u["default"].createElement("button",{type:"button",onClick:this.handleShowOnlyToggle,className:"btn btn-primary","data-toggle":"button","aria-pressed":"false"},this.state.showSelected?f["default"].SHOW_ALL:f["default"].SHOW_ONLY_SELECT)),this.props.enableExportCSV&&(o=u["default"].createElement("button",{type:"button",className:"btn btn-success",onClick:this.handleExportCSV},u["default"].createElement("i",{className:"glyphicon glyphicon-export"}),this.props.exportCSVText));var a=this.renderSearchPanel(),i=this.props.enableInsert?this.renderInsertRowModal():null;return u["default"].createElement("div",{className:"row"},u["default"].createElement("div",{className:"col-xs-12 col-sm-6 col-md-6 col-lg-8"},u["default"].createElement("div",{className:"btn-group btn-group-sm",role:"group"},o,e,r,n)),u["default"].createElement("div",{className:"col-xs-12 col-sm-6 col-md-6 col-lg-4"},a),u["default"].createElement(m["default"],{ref:"notifier"}),i)}},{key:"renderSearchPanel",value:function(){if(this.props.enableSearch){var e="form-group form-group-sm react-bs-table-search-form",t=null;return this.props.clearSearch&&(t=u["default"].createElement("span",{className:"input-group-btn"},u["default"].createElement("button",{className:"btn btn-default",type:"button",onClick:this.handleClearBtnClick},"Clear")),e+=" input-group input-group-sm"),u["default"].createElement("div",{className:e},u["default"].createElement("input",{ref:"seachInput",className:"form-control",type:"text",defaultValue:this.props.defaultSearch,placeholder:this.props.searchPlaceholder?this.props.searchPlaceholder:"Search",onKeyUp:this.handleKeyUp}),t)}return null}},{key:"renderInsertRowModal",value:function(){var e=this,t=this.state.validateState||{},r=this.state.shakeEditor,o=this.props.columns.map(function(r,o){var n=r.editable,a=r.format,i=r.field,s=r.name,l=r.autoValue,p=r.hiddenOnInsert,c={ref:i+o,placeholder:n.placeholder?n.placeholder:s};if(l||p)return null;var d=t[i]?u["default"].createElement("span",{className:"help-block bg-danger"},t[i]):null;return u["default"].createElement("div",{className:"form-group",key:i},u["default"].createElement("label",null,s),(0,y["default"])(n,c,a,"",void 0,e.props.ignoreEditable),d)}),n=(0,c["default"])("modal","fade",this.modalClassName,{"in":r||this.state.validateState}),a=(0,c["default"])("modal-dialog","modal-sm",{animated:r,shake:r});return u["default"].createElement("div",{ref:"modal",className:n,tabIndex:"-1",role:"dialog"},u["default"].createElement("div",{className:a},u["default"].createElement("div",{className:"modal-content"},u["default"].createElement("div",{className:"modal-header"},u["default"].createElement("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":"Close"},u["default"].createElement("span",{"aria-hidden":"true"},"×")),u["default"].createElement("h4",{className:"modal-title"},"New Record")),u["default"].createElement("div",{className:"modal-body"},u["default"].createElement("form",{ref:"form"},o)),u["default"].createElement("div",{className:"modal-footer"},u["default"].createElement("button",{type:"button",className:"btn btn-default","data-dismiss":"modal"},this.props.closeText),u["default"].createElement("button",{type:"button",className:"btn btn-primary",onClick:this.handleSaveBtnClick},this.props.saveText)))))}}]),t}(l.Component);g.propTypes={onAddRow:l.PropTypes.func,onDropRow:l.PropTypes.func,onShowOnlySelected:l.PropTypes.func,enableInsert:l.PropTypes.bool,enableDelete:l.PropTypes.bool,enableSearch:l.PropTypes.bool,enableShowOnlySelected:l.PropTypes.bool,columns:l.PropTypes.array,searchPlaceholder:l.PropTypes.string,exportCSVText:l.PropTypes.string,insertText:l.PropTypes.string,deleteText:l.PropTypes.string,saveText:l.PropTypes.string,closeText:l.PropTypes.string,clearSearch:l.PropTypes.bool,ignoreEditable:l.PropTypes.bool,defaultSearch:l.PropTypes.string},g.defaultProps={enableInsert:!1,enableDelete:!1,enableSearch:!1,enableShowOnlySelected:!1,clearSearch:!1,ignoreEditable:!1,exportCSVText:f["default"].EXPORT_CSV_TEXT,insertText:f["default"].INSERT_BTN_TEXT,deleteText:f["default"].DELETE_BTN_TEXT,saveText:f["default"].SAVE_BTN_TEXT,closeText:f["default"].CLOSE_BTN_TEXT},t["default"]=g,e.exports=t["default"]},function(e,t,r){var o,n,a=a||function(e){"use strict";if("undefined"==typeof navigator||!/MSIE [1-9]\./.test(navigator.userAgent)){var t=e.document,r=function(){return e.URL||e.webkitURL||e},o=t.createElementNS("http://www.w3.org/1999/xhtml","a"),n="download"in o,a=function(e){var t=new MouseEvent("click");e.dispatchEvent(t)},i=/Version\/[\d\.]+.*Safari/.test(navigator.userAgent),s=e.webkitRequestFileSystem,l=e.requestFileSystem||s||e.mozRequestFileSystem,u=function(t){(e.setImmediate||e.setTimeout)(function(){throw t},0)},p="application/octet-stream",c=0,d=500,f=function(t){var o=function(){"string"==typeof t?r().revokeObjectURL(t):t.remove()};e.chrome?o():setTimeout(o,d)},h=function(e,t,r){t=[].concat(t);for(var o=t.length;o--;){var n=e["on"+t[o]];if("function"==typeof n)try{n.call(e,r||e)}catch(a){u(a)}}},y=function(e){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\ufeff",e],{type:e.type}):e},v=function(t,u,d){d||(t=y(t));var v,m,g,b=this,T=t.type,E=!1,P=function(){h(b,"writestart progress write writeend".split(" "))},_=function(){if(m&&i&&"undefined"!=typeof FileReader){var o=new FileReader;return o.onloadend=function(){var e=o.result;m.location.href="data:attachment/file"+e.slice(e.search(/[,;]/)),b.readyState=b.DONE,P()},o.readAsDataURL(t),void(b.readyState=b.INIT)}if((E||!v)&&(v=r().createObjectURL(t)),m)m.location.href=v;else{var n=e.open(v,"_blank");void 0==n&&i&&(e.location.href=v)}b.readyState=b.DONE,P(),f(v)},w=function(e){return function(){return b.readyState!==b.DONE?e.apply(this,arguments):void 0}},O={create:!0,exclusive:!1};return b.readyState=b.INIT,u||(u="download"),n?(v=r().createObjectURL(t),o.href=v,o.download=u,void setTimeout(function(){a(o),P(),f(v),b.readyState=b.DONE})):(e.chrome&&T&&T!==p&&(g=t.slice||t.webkitSlice,t=g.call(t,0,t.size,p),E=!0),s&&"download"!==u&&(u+=".download"),(T===p||s)&&(m=e),l?(c+=t.size,void l(e.TEMPORARY,c,w(function(e){e.root.getDirectory("saved",O,w(function(e){var r=function(){e.getFile(u,O,w(function(e){e.createWriter(w(function(r){r.onwriteend=function(t){m.location.href=e.toURL(),b.readyState=b.DONE,h(b,"writeend",t),f(e)},r.onerror=function(){var e=r.error;e.code!==e.ABORT_ERR&&_()},"writestart progress write abort".split(" ").forEach(function(e){r["on"+e]=b["on"+e]}),r.write(t),b.abort=function(){r.abort(),b.readyState=b.DONE},b.readyState=b.WRITING}),_)}),_)};e.getFile(u,{create:!1},w(function(e){e.remove(),r()}),w(function(e){e.code===e.NOT_FOUND_ERR?r():_()}))}),_)}),_)):void _())},m=v.prototype,g=function(e,t,r){return new v(e,t,r)};return"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob?function(e,t,r){return r||(e=y(e)),navigator.msSaveOrOpenBlob(e,t||"download")}:(m.abort=function(){var e=this;e.readyState=e.DONE,h(e,"abort")},m.readyState=m.INIT=0,m.WRITING=1,m.DONE=2,m.error=m.onwritestart=m.onprogress=m.onwrite=m.onabort=m.onerror=m.onwriteend=null,g)}}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||(void 0).content);"undefined"!=typeof e&&e.exports?e.exports.saveAs=a:null!==r(44)&&null!=r(45)&&(o=[],n=function(){return a}.apply(t,o),!(void 0!==n&&(e.exports=n)))},function(e,t,r){(function(t){"use strict";var o=r(33),n={addClass:function(e,r){return/\s/.test(r)?"production"!==t.env.NODE_ENV?o(!1,'CSSCore.addClass takes only a single class name. "%s" contains multiple classes.',r):o(!1):void 0,r&&(e.classList?e.classList.add(r):n.hasClass(e,r)||(e.className=e.className+" "+r)),e},removeClass:function(e,r){return/\s/.test(r)?"production"!==t.env.NODE_ENV?o(!1,'CSSCore.removeClass takes only a single class name. "%s" contains multiple classes.',r):o(!1):void 0,r&&(e.classList?e.classList.remove(r):n.hasClass(e,r)&&(e.className=e.className.replace(new RegExp("(^|\\s)"+r+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,""))),e},conditionClass:function(e,t,r){return(r?n.addClass:n.removeClass)(e,t)},hasClass:function(e,r){return/\s/.test(r)?"production"!==t.env.NODE_ENV?o(!1,"CSS.hasClass takes only a single class name."):o(!1):void 0,e.classList?!!r&&e.classList.contains(r):(" "+e.className+" ").indexOf(" "+r+" ")>-1}};e.exports=n}).call(t,r(4))},function(e,t,r){(function(t){"use strict";function r(e,r,o,n,a,i,s,l){if("production"!==t.env.NODE_ENV&&void 0===r)throw new Error("invariant requires an error message argument");if(!e){var u;if(void 0===r)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var p=[o,n,a,i,s,l],c=0;u=new Error(r.replace(/%s/g,function(){return p[c++]})),u.name="Invariant Violation"}throw u.framesToPop=1,u}}e.exports=r}).call(t,r(4))},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}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 a(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 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)}var l=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},u=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}}();Object.defineProperty(t,"__esModule",{value:!0});var p=r(1),c=o(p),d=r(10),f=o(d),h=r(9),y=o(h),v=function(e){function t(){var e,r,o,n;a(this,t);for(var s=arguments.length,l=Array(s),u=0;s>u;u++)l[u]=arguments[u];return r=o=i(this,(e=Object.getPrototypeOf(t)).call.apply(e,[this].concat(l))),o.state={toasts:[],toastId:0,previousMessage:null},n=r,i(o,n)}return s(t,e),u(t,[{key:"error",value:function(e,t,r){this._notify(this.props.toastType.error,e,t,r)}},{key:"info",value:function(e,t,r){this._notify(this.props.toastType.info,e,t,r)}},{key:"success",value:function(e,t,r){this._notify(this.props.toastType.success,e,t,r)}},{key:"warning",value:function(e,t,r){this._notify(this.props.toastType.warning,e,t,r)}},{key:"clear",value:function(){var e=this;Object.keys(this.refs).forEach(function(t){e.refs[t].hideToast(!1)})}},{key:"render",value:function(){var e=this;return c["default"].createElement("div",l({},this.props,{"aria-live":"polite",role:"alert"}),this.state.toasts.map(function(t){return e.props.toastMessageFactory(t)}))}},{key:"_notify",value:function(e,t,r){var o=this,a=arguments.length<=3||void 0===arguments[3]?{}:arguments[3];if(!this.props.preventDuplicates||this.state.previousMessage!==t){var i=this.state.toastId++,s=i,l=(0,f["default"])(a,{$merge:{type:e,title:r,message:t,toastId:s,key:i,ref:"toasts__"+i,handleOnClick:function(e){return"function"==typeof a.handleOnClick&&a.handleOnClick(),o._handle_toast_on_click(e)},handleRemove:this._handle_toast_remove.bind(this)}}),u=n({},""+(this.props.newestOnTop?"$unshift":"$push"),[l]),p=(0,f["default"])(this.state,{toasts:u,previousMessage:{$set:t}});this.setState(p)}}},{key:"_handle_toast_on_click",value:function(e){this.props.onClick(e),e.defaultPrevented||(e.preventDefault(),e.stopPropagation())}},{key:"_handle_toast_remove",value:function(e){var t=this,r=""+(this.props.newestOnTop?"reduceRight":"reduce");this.state.toasts[r](function(r,o,n){return r||o.toastId!==e?!1:(t.setState((0,f["default"])(t.state,{toasts:{$splice:[[n,1]]}})),!0)},!1)}}]),t}(p.Component);v.defaultProps={toastType:{error:"error",info:"info",success:"success",warning:"warning"},id:"toast-container",toastMessageFactory:c["default"].createFactory(y["default"]),preventDuplicates:!1,newestOnTop:!0,onClick:function(){}},t["default"]=v},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var n=r(32),a=o(n),i=r(39),s=o(i),l=r(6),u=o(l),p=17,c=Object.prototype.toString;t["default"]={getDefaultProps:function(){return{transition:null,showAnimation:"animated bounceIn",hideAnimation:"animated bounceOut",timeOut:5e3,extendedTimeOut:1e3}},componentWillMount:function(){this.classNameQueue=[],this.isHiding=!1,this.intervalId=null},componentDidMount:function(){var e=this;this._is_mounted=!0,this._show();var t=u["default"].findDOMNode(this),r=function o(){e.isHiding&&(e._set_is_hiding(!1),s["default"].removeEndEventListener(t,o),e._handle_remove())};s["default"].addEndEventListener(t,r),this.props.timeOut>0&&this._set_interval_id(setTimeout(this.hideToast,this.props.timeOut))},componentWillUnmount:function(){this._is_mounted=!1,this.intervalId&&clearTimeout(this.intervalId)},_set_transition:function(e){var t=e?"leave":"enter",r=u["default"].findDOMNode(this),o=this.props.transition+"-"+t,n=o+"-active",i=function l(e){e&&e.target!==r||(a["default"].removeClass(r,o),a["default"].removeClass(r,n),s["default"].removeEndEventListener(r,l))};s["default"].addEndEventListener(r,i),a["default"].addClass(r,o),this._queue_class(n)},_clear_transition:function(e){var t=u["default"].findDOMNode(this),r=e?"leave":"enter",o=this.props.transition+"-"+r,n=o+"-active";a["default"].removeClass(t,o),a["default"].removeClass(t,n)},_set_animation:function(e){var t=u["default"].findDOMNode(this),r=this._get_animation_classes(e),o=function n(e){e&&e.target!==t||(r.forEach(function(e){a["default"].removeClass(t,e)}),s["default"].removeEndEventListener(t,n))};s["default"].addEndEventListener(t,o),r.forEach(function(e){a["default"].addClass(t,e)})},_get_animation_classes:function(e){var t=e?this.props.hideAnimation:this.props.showAnimation;return"[object Array]"===c.call(t)?t:"string"==typeof t?t.split(" "):void 0},_clear_animation:function(e){var t=this,r=this._get_animation_classes(e);r.forEach(function(e){a["default"].removeClass(u["default"].findDOMNode(t),e)})},_queue_class:function(e){this.classNameQueue.push(e),this.timeout||(this.timeout=setTimeout(this._flush_class_name_queue,p))},_flush_class_name_queue:function(){this._is_mounted&&this.classNameQueue.forEach(a["default"].addClass.bind(a["default"],u["default"].findDOMNode(this))),this.classNameQueue.length=0,this.timeout=null},_show:function(){this.props.transition?this._set_transition():this.props.showAnimation&&this._set_animation()},handleMouseEnter:function(){clearTimeout(this.intervalId),this._set_interval_id(null),this.isHiding&&(this._set_is_hiding(!1),this.props.hideAnimation?this._clear_animation(!0):this.props.transition&&this._clear_transition(!0))},handleMouseLeave:function(){!this.isHiding&&(this.props.timeOut>0||this.props.extendedTimeOut>0)&&this._set_interval_id(setTimeout(this.hideToast,this.props.extendedTimeOut))},hideToast:function(e){this.isHiding||null===this.intervalId&&!e||(this._set_is_hiding(!0),this.props.transition?this._set_transition(!0):this.props.hideAnimation?this._set_animation(!0):this._handle_remove())},_set_interval_id:function(e){this.intervalId=e},_set_is_hiding:function(e){this.isHiding=e}}},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){e[t.showMethod]({duration:t.showDuration,easing:t.showEasing})}Object.defineProperty(t,"__esModule",{value:!0});var a=r(6),i=o(a);t["default"]={getDefaultProps:function(){return{style:{display:"none"},showMethod:"fadeIn",showDuration:300,showEasing:"swing",hideMethod:"fadeOut",hideDuration:1e3,hideEasing:"swing",timeOut:5e3,extendedTimeOut:1e3}},getInitialState:function(){return{intervalId:null,isHiding:!1}},componentDidMount:function(){n(this._get_$_node(),this.props),this.props.timeOut>0&&this._set_interval_id(setTimeout(this.hideToast,this.props.timeOut))},handleMouseEnter:function(){clearTimeout(this.state.intervalId),this._set_interval_id(null),this._set_is_hiding(!1),n(this._get_$_node().stop(!0,!0),this.props)},handleMouseLeave:function(){!this.state.isHiding&&(this.props.timeOut>0||this.props.extendedTimeOut>0)&&this._set_interval_id(setTimeout(this.hideToast,this.props.extendedTimeOut))},hideToast:function(e){this.state.isHiding||null===this.state.intervalId&&!e||(this.setState({isHiding:!0}),this._get_$_node()[this.props.hideMethod]({duration:this.props.hideDuration,easing:this.props.hideEasing,complete:this._handle_remove}))},_get_$_node:function(){return jQuery(i["default"].findDOMNode(this))},_set_interval_id:function(e){this.setState({intervalId:e})},_set_is_hiding:function(e){this.setState({isHiding:e})}}},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.ToastMessage=t.ToastContainer=void 0;var n=r(34),a=o(n),i=r(9),s=o(i);t.ToastContainer=a["default"],t.ToastMessage=s["default"]},function(e,t){"use strict";function r(e,t){if(null==e)throw new TypeError("Object.assign target cannot be null or undefined");for(var r=Object(e),o=Object.prototype.hasOwnProperty,n=1;n<arguments.length;n++){var a=arguments[n];if(null!=a){var i=Object(a);for(var s in i)o.call(i,s)&&(r[s]=i[s])}}return r}e.exports=r},function(e,t,r){"use strict";function o(){var e=document.createElement("div"),t=e.style;"AnimationEvent"in window||delete s.animationend.animation,"TransitionEvent"in window||delete s.transitionend.transition;for(var r in s){var o=s[r];for(var n in o)if(n in t){l.push(o[n]);break}}}function n(e,t,r){e.addEventListener(t,r,!1)}function a(e,t,r){e.removeEventListener(t,r,!1)}var i=r(41),s={transitionend:{transition:"transitionend",WebkitTransition:"webkitTransitionEnd",MozTransition:"mozTransitionEnd",OTransition:"oTransitionEnd",msTransition:"MSTransitionEnd"},animationend:{animation:"animationend",WebkitAnimation:"webkitAnimationEnd",MozAnimation:"mozAnimationEnd",OAnimation:"oAnimationEnd",msAnimation:"MSAnimationEnd"}},l=[];i.canUseDOM&&o();var u={addEndEventListener:function(e,t){return 0===l.length?void window.setTimeout(t,0):void l.forEach(function(r){n(e,r,t)})},removeEndEventListener:function(e,t){0!==l.length&&l.forEach(function(r){a(e,r,t)})}};e.exports=u},function(e,t,r){(function(t){"use strict";function o(e){return Array.isArray(e)?e.concat():e&&"object"==typeof e?i(new e.constructor,e):e}function n(e,r,o){Array.isArray(e)?void 0:"production"!==t.env.NODE_ENV?l(!1,"update(): expected target of %s to be an array; got %s.",o,e):l(!1);var n=r[o];Array.isArray(n)?void 0:"production"!==t.env.NODE_ENV?l(!1,"update(): expected spec of %s to be an array; got %s. Did you forget to wrap your parameter in an array?",o,n):l(!1)}function a(e,r){if("object"!=typeof r?"production"!==t.env.NODE_ENV?l(!1,"update(): You provided a key path to update() that did not contain one of %s. Did you forget to include {%s: ...}?",v.join(", "),f):l(!1):void 0,u.call(r,f))return 1!==Object.keys(r).length?"production"!==t.env.NODE_ENV?l(!1,"Cannot have more than one key in an object with %s",f):l(!1):void 0,r[f];var s=o(e);if(u.call(r,h)){var g=r[h];g&&"object"==typeof g?void 0:"production"!==t.env.NODE_ENV?l(!1,"update(): %s expects a spec of type 'object'; got %s",h,g):l(!1),s&&"object"==typeof s?void 0:"production"!==t.env.NODE_ENV?l(!1,"update(): %s expects a target of type 'object'; got %s",h,s):l(!1),i(s,r[h])}u.call(r,p)&&(n(e,r,p),r[p].forEach(function(e){s.push(e)})),u.call(r,c)&&(n(e,r,c),r[c].forEach(function(e){s.unshift(e)})),u.call(r,d)&&(Array.isArray(e)?void 0:"production"!==t.env.NODE_ENV?l(!1,"Expected %s target to be an array; got %s",d,e):l(!1),Array.isArray(r[d])?void 0:"production"!==t.env.NODE_ENV?l(!1,"update(): expected spec of %s to be an array of arrays; got %s. Did you forget to wrap your parameters in an array?",d,r[d]):l(!1),r[d].forEach(function(e){Array.isArray(e)?void 0:"production"!==t.env.NODE_ENV?l(!1,"update(): expected spec of %s to be an array of arrays; got %s. Did you forget to wrap your parameters in an array?",d,r[d]):l(!1),s.splice.apply(s,e)})),u.call(r,y)&&("function"!=typeof r[y]?"production"!==t.env.NODE_ENV?l(!1,"update(): expected spec of %s to be a function; got %s.",y,r[y]):l(!1):void 0,s=r[y](s));for(var b in r)m.hasOwnProperty(b)&&m[b]||(s[b]=a(e[b],r[b]));return s}var i=r(38),s=r(43),l=r(42),u={}.hasOwnProperty,p=s({$push:null}),c=s({$unshift:null}),d=s({$splice:null}),f=s({$set:null}),h=s({$merge:null}),y=s({$apply:null}),v=[p,c,d,f,h,y],m={};v.forEach(function(e){m[e]=!0}),e.exports=a}).call(t,r(4))},function(e,t){"use strict";var r=!("undefined"==typeof window||!window.document||!window.document.createElement),o={canUseDOM:r,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:r&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:r&&!!window.screen,isInWorker:!r};e.exports=o},function(e,t,r){(function(t){"use strict";function r(e,r,o,n,a,i,s,l){if("production"!==t.env.NODE_ENV&&void 0===r)throw new Error("invariant requires an error message argument");if(!e){var u;if(void 0===r)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var p=[o,n,a,i,s,l],c=0;u=new Error(r.replace(/%s/g,function(){return p[c++]})),u.name="Invariant Violation"}throw u.framesToPop=1,u}}e.exports=r}).call(t,r(4))},function(e,t){"use strict";var r=function(e){var t;for(t in e)if(e.hasOwnProperty(t))return t;return null};e.exports=r},function(e,t){e.exports=function(){throw new Error("define cannot be used indirect")}},function(e,t){(function(t){e.exports=t}).call(t,{})},function(e,t){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function o(e){return"function"==typeof e}function n(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function i(e){return void 0===e}e.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if(!n(e)||0>e||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,r,n,s,l,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;throw TypeError('Uncaught, unspecified "error" event.')}if(r=this._events[e],i(r))return!1;if(o(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),r.apply(this,s)}else if(a(r))for(s=Array.prototype.slice.call(arguments,1),u=r.slice(),n=u.length,l=0;n>l;l++)u[l].apply(this,s);return!0},r.prototype.addListener=function(e,t){var n;if(!o(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,o(t.listener)?t.listener:t),this._events[e]?a(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,
a(this._events[e])&&!this._events[e].warned&&(n=i(this._maxListeners)?r.defaultMaxListeners:this._maxListeners,n&&n>0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function r(){this.removeListener(e,r),n||(n=!0,t.apply(this,arguments))}if(!o(t))throw TypeError("listener must be a function");var n=!1;return r.listener=t,this.on(e,r),this},r.prototype.removeListener=function(e,t){var r,n,i,s;if(!o(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],i=r.length,n=-1,r===t||o(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(a(r)){for(s=i;s-- >0;)if(r[s]===t||r[s].listener&&r[s].listener===t){n=s;break}if(0>n)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(n,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[e],o(r))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?o(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(o(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}}])});
|
src/components/ResultFishers.js
|
superphy/reactapp
|
import React, { Component } from 'react';
import { connect } from 'react-refetch'
// progress bar
import CircularProgress from 'react-md/lib/Progress/CircularProgress';
// requests
import { API_ROOT } from '../middleware/api'
// Table
import { BootstrapTable, TableHeaderColumn } from 'react-bootstrap-table';
class ResultFishers extends Component {
render() {
const { results } = this.props
const options = {
searchPosition: 'left'
};
if (results.pending){
return <div>Waiting for server response...<CircularProgress key="progress" id='contentLoadingProgress' /></div>
} else if (results.rejected){
return <div>Couldn't retrieve job: {this.props.jobId}</div>
} else if (results.fulfilled){
console.log(results)
return (
<BootstrapTable data={results.value.data} exportCSV search options={options}>
<TableHeaderColumn isKey dataField='0' dataSort filter={ { type: 'TextFilter', placeholder: 'Please enter a value' } } width='400' csvHeader='Target'>Target</TableHeaderColumn>
<TableHeaderColumn dataField='1' dataSort filter={ { type: 'TextFilter', placeholder: 'Please enter a value' } } csvHeader='QueryA'>QueryA</TableHeaderColumn>
<TableHeaderColumn dataField='2' dataSort filter={ { type: 'TextFilter', placeholder: 'Please enter a value' } } csvHeader='QueryB'>QueryB</TableHeaderColumn>
<TableHeaderColumn dataField='3' dataSort filter={ { type: 'TextFilter', placeholder: 'Please enter a value' } } width='140' csvHeader='#Present QueryA'>#Present QueryA</TableHeaderColumn>
<TableHeaderColumn dataField='4' dataSort filter={ { type: 'TextFilter', placeholder: 'Please enter a value' } } width='140' csvHeader='#Absent QueryA'>#Absent QueryA</TableHeaderColumn>
<TableHeaderColumn dataField='5' dataSort filter={ { type: 'TextFilter', placeholder: 'Please enter a value' } } width='140' csvHeader='#Present QueryB'>#Present QueryB</TableHeaderColumn>
<TableHeaderColumn dataField='6' dataSort filter={ { type: 'TextFilter', placeholder: 'Please enter a value' } } width='140' csvHeader='#Absent QueryB'>#Absent QueryB</TableHeaderColumn>
<TableHeaderColumn dataField='7' dataSort filter={ { type: 'TextFilter', placeholder: 'Please enter a value' } } width='140' csvHeader='P-Value'>P-Value</TableHeaderColumn>
<TableHeaderColumn dataField='8' dataSort filter={ { type: 'TextFilter', placeholder: 'Please enter a value' } } width='140' csvHeader='Odds Ratio'>Odds Ratio</TableHeaderColumn>
</BootstrapTable>
);
}
}
}
export default connect(props => ({
results: {url: API_ROOT + `results/${props.jobId}`}
}))(ResultFishers)
|
ajax/libs/typescript/1.8.10/typescript.min.js
|
x112358/cdnjs
|
var __extends=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},ts;!function(e){!function(e){e[e.Unknown=0]="Unknown",e[e.EndOfFileToken=1]="EndOfFileToken",e[e.SingleLineCommentTrivia=2]="SingleLineCommentTrivia",e[e.MultiLineCommentTrivia=3]="MultiLineCommentTrivia",e[e.NewLineTrivia=4]="NewLineTrivia",e[e.WhitespaceTrivia=5]="WhitespaceTrivia",e[e.ShebangTrivia=6]="ShebangTrivia",e[e.ConflictMarkerTrivia=7]="ConflictMarkerTrivia",e[e.NumericLiteral=8]="NumericLiteral",e[e.StringLiteral=9]="StringLiteral",e[e.RegularExpressionLiteral=10]="RegularExpressionLiteral",e[e.NoSubstitutionTemplateLiteral=11]="NoSubstitutionTemplateLiteral",e[e.TemplateHead=12]="TemplateHead",e[e.TemplateMiddle=13]="TemplateMiddle",e[e.TemplateTail=14]="TemplateTail",e[e.OpenBraceToken=15]="OpenBraceToken",e[e.CloseBraceToken=16]="CloseBraceToken",e[e.OpenParenToken=17]="OpenParenToken",e[e.CloseParenToken=18]="CloseParenToken",e[e.OpenBracketToken=19]="OpenBracketToken",e[e.CloseBracketToken=20]="CloseBracketToken",e[e.DotToken=21]="DotToken",e[e.DotDotDotToken=22]="DotDotDotToken",e[e.SemicolonToken=23]="SemicolonToken",e[e.CommaToken=24]="CommaToken",e[e.LessThanToken=25]="LessThanToken",e[e.LessThanSlashToken=26]="LessThanSlashToken",e[e.GreaterThanToken=27]="GreaterThanToken",e[e.LessThanEqualsToken=28]="LessThanEqualsToken",e[e.GreaterThanEqualsToken=29]="GreaterThanEqualsToken",e[e.EqualsEqualsToken=30]="EqualsEqualsToken",e[e.ExclamationEqualsToken=31]="ExclamationEqualsToken",e[e.EqualsEqualsEqualsToken=32]="EqualsEqualsEqualsToken",e[e.ExclamationEqualsEqualsToken=33]="ExclamationEqualsEqualsToken",e[e.EqualsGreaterThanToken=34]="EqualsGreaterThanToken",e[e.PlusToken=35]="PlusToken",e[e.MinusToken=36]="MinusToken",e[e.AsteriskToken=37]="AsteriskToken",e[e.AsteriskAsteriskToken=38]="AsteriskAsteriskToken",e[e.SlashToken=39]="SlashToken",e[e.PercentToken=40]="PercentToken",e[e.PlusPlusToken=41]="PlusPlusToken",e[e.MinusMinusToken=42]="MinusMinusToken",e[e.LessThanLessThanToken=43]="LessThanLessThanToken",e[e.GreaterThanGreaterThanToken=44]="GreaterThanGreaterThanToken",e[e.GreaterThanGreaterThanGreaterThanToken=45]="GreaterThanGreaterThanGreaterThanToken",e[e.AmpersandToken=46]="AmpersandToken",e[e.BarToken=47]="BarToken",e[e.CaretToken=48]="CaretToken",e[e.ExclamationToken=49]="ExclamationToken",e[e.TildeToken=50]="TildeToken",e[e.AmpersandAmpersandToken=51]="AmpersandAmpersandToken",e[e.BarBarToken=52]="BarBarToken",e[e.QuestionToken=53]="QuestionToken",e[e.ColonToken=54]="ColonToken",e[e.AtToken=55]="AtToken",e[e.EqualsToken=56]="EqualsToken",e[e.PlusEqualsToken=57]="PlusEqualsToken",e[e.MinusEqualsToken=58]="MinusEqualsToken",e[e.AsteriskEqualsToken=59]="AsteriskEqualsToken",e[e.AsteriskAsteriskEqualsToken=60]="AsteriskAsteriskEqualsToken",e[e.SlashEqualsToken=61]="SlashEqualsToken",e[e.PercentEqualsToken=62]="PercentEqualsToken",e[e.LessThanLessThanEqualsToken=63]="LessThanLessThanEqualsToken",e[e.GreaterThanGreaterThanEqualsToken=64]="GreaterThanGreaterThanEqualsToken",e[e.GreaterThanGreaterThanGreaterThanEqualsToken=65]="GreaterThanGreaterThanGreaterThanEqualsToken",e[e.AmpersandEqualsToken=66]="AmpersandEqualsToken",e[e.BarEqualsToken=67]="BarEqualsToken",e[e.CaretEqualsToken=68]="CaretEqualsToken",e[e.Identifier=69]="Identifier",e[e.BreakKeyword=70]="BreakKeyword",e[e.CaseKeyword=71]="CaseKeyword",e[e.CatchKeyword=72]="CatchKeyword",e[e.ClassKeyword=73]="ClassKeyword",e[e.ConstKeyword=74]="ConstKeyword",e[e.ContinueKeyword=75]="ContinueKeyword",e[e.DebuggerKeyword=76]="DebuggerKeyword",e[e.DefaultKeyword=77]="DefaultKeyword",e[e.DeleteKeyword=78]="DeleteKeyword",e[e.DoKeyword=79]="DoKeyword",e[e.ElseKeyword=80]="ElseKeyword",e[e.EnumKeyword=81]="EnumKeyword",e[e.ExportKeyword=82]="ExportKeyword",e[e.ExtendsKeyword=83]="ExtendsKeyword",e[e.FalseKeyword=84]="FalseKeyword",e[e.FinallyKeyword=85]="FinallyKeyword",e[e.ForKeyword=86]="ForKeyword",e[e.FunctionKeyword=87]="FunctionKeyword",e[e.IfKeyword=88]="IfKeyword",e[e.ImportKeyword=89]="ImportKeyword",e[e.InKeyword=90]="InKeyword",e[e.InstanceOfKeyword=91]="InstanceOfKeyword",e[e.NewKeyword=92]="NewKeyword",e[e.NullKeyword=93]="NullKeyword",e[e.ReturnKeyword=94]="ReturnKeyword",e[e.SuperKeyword=95]="SuperKeyword",e[e.SwitchKeyword=96]="SwitchKeyword",e[e.ThisKeyword=97]="ThisKeyword",e[e.ThrowKeyword=98]="ThrowKeyword",e[e.TrueKeyword=99]="TrueKeyword",e[e.TryKeyword=100]="TryKeyword",e[e.TypeOfKeyword=101]="TypeOfKeyword",e[e.VarKeyword=102]="VarKeyword",e[e.VoidKeyword=103]="VoidKeyword",e[e.WhileKeyword=104]="WhileKeyword",e[e.WithKeyword=105]="WithKeyword",e[e.ImplementsKeyword=106]="ImplementsKeyword",e[e.InterfaceKeyword=107]="InterfaceKeyword",e[e.LetKeyword=108]="LetKeyword",e[e.PackageKeyword=109]="PackageKeyword",e[e.PrivateKeyword=110]="PrivateKeyword",e[e.ProtectedKeyword=111]="ProtectedKeyword",e[e.PublicKeyword=112]="PublicKeyword",e[e.StaticKeyword=113]="StaticKeyword",e[e.YieldKeyword=114]="YieldKeyword",e[e.AbstractKeyword=115]="AbstractKeyword",e[e.AsKeyword=116]="AsKeyword",e[e.AnyKeyword=117]="AnyKeyword",e[e.AsyncKeyword=118]="AsyncKeyword",e[e.AwaitKeyword=119]="AwaitKeyword",e[e.BooleanKeyword=120]="BooleanKeyword",e[e.ConstructorKeyword=121]="ConstructorKeyword",e[e.DeclareKeyword=122]="DeclareKeyword",e[e.GetKeyword=123]="GetKeyword",e[e.IsKeyword=124]="IsKeyword",e[e.ModuleKeyword=125]="ModuleKeyword",e[e.NamespaceKeyword=126]="NamespaceKeyword",e[e.RequireKeyword=127]="RequireKeyword",e[e.NumberKeyword=128]="NumberKeyword",e[e.SetKeyword=129]="SetKeyword",e[e.StringKeyword=130]="StringKeyword",e[e.SymbolKeyword=131]="SymbolKeyword",e[e.TypeKeyword=132]="TypeKeyword",e[e.FromKeyword=133]="FromKeyword",e[e.GlobalKeyword=134]="GlobalKeyword",e[e.OfKeyword=135]="OfKeyword",e[e.QualifiedName=136]="QualifiedName",e[e.ComputedPropertyName=137]="ComputedPropertyName",e[e.TypeParameter=138]="TypeParameter",e[e.Parameter=139]="Parameter",e[e.Decorator=140]="Decorator",e[e.PropertySignature=141]="PropertySignature",e[e.PropertyDeclaration=142]="PropertyDeclaration",e[e.MethodSignature=143]="MethodSignature",e[e.MethodDeclaration=144]="MethodDeclaration",e[e.Constructor=145]="Constructor",e[e.GetAccessor=146]="GetAccessor",e[e.SetAccessor=147]="SetAccessor",e[e.CallSignature=148]="CallSignature",e[e.ConstructSignature=149]="ConstructSignature",e[e.IndexSignature=150]="IndexSignature",e[e.TypePredicate=151]="TypePredicate",e[e.TypeReference=152]="TypeReference",e[e.FunctionType=153]="FunctionType",e[e.ConstructorType=154]="ConstructorType",e[e.TypeQuery=155]="TypeQuery",e[e.TypeLiteral=156]="TypeLiteral",e[e.ArrayType=157]="ArrayType",e[e.TupleType=158]="TupleType",e[e.UnionType=159]="UnionType",e[e.IntersectionType=160]="IntersectionType",e[e.ParenthesizedType=161]="ParenthesizedType",e[e.ThisType=162]="ThisType",e[e.StringLiteralType=163]="StringLiteralType",e[e.ObjectBindingPattern=164]="ObjectBindingPattern",e[e.ArrayBindingPattern=165]="ArrayBindingPattern",e[e.BindingElement=166]="BindingElement",e[e.ArrayLiteralExpression=167]="ArrayLiteralExpression",e[e.ObjectLiteralExpression=168]="ObjectLiteralExpression",e[e.PropertyAccessExpression=169]="PropertyAccessExpression",e[e.ElementAccessExpression=170]="ElementAccessExpression",e[e.CallExpression=171]="CallExpression",e[e.NewExpression=172]="NewExpression",e[e.TaggedTemplateExpression=173]="TaggedTemplateExpression",e[e.TypeAssertionExpression=174]="TypeAssertionExpression",e[e.ParenthesizedExpression=175]="ParenthesizedExpression",e[e.FunctionExpression=176]="FunctionExpression",e[e.ArrowFunction=177]="ArrowFunction",e[e.DeleteExpression=178]="DeleteExpression",e[e.TypeOfExpression=179]="TypeOfExpression",e[e.VoidExpression=180]="VoidExpression",e[e.AwaitExpression=181]="AwaitExpression",e[e.PrefixUnaryExpression=182]="PrefixUnaryExpression",e[e.PostfixUnaryExpression=183]="PostfixUnaryExpression",e[e.BinaryExpression=184]="BinaryExpression",e[e.ConditionalExpression=185]="ConditionalExpression",e[e.TemplateExpression=186]="TemplateExpression",e[e.YieldExpression=187]="YieldExpression",e[e.SpreadElementExpression=188]="SpreadElementExpression",e[e.ClassExpression=189]="ClassExpression",e[e.OmittedExpression=190]="OmittedExpression",e[e.ExpressionWithTypeArguments=191]="ExpressionWithTypeArguments",e[e.AsExpression=192]="AsExpression",e[e.TemplateSpan=193]="TemplateSpan",e[e.SemicolonClassElement=194]="SemicolonClassElement",e[e.Block=195]="Block",e[e.VariableStatement=196]="VariableStatement",e[e.EmptyStatement=197]="EmptyStatement",e[e.ExpressionStatement=198]="ExpressionStatement",e[e.IfStatement=199]="IfStatement",e[e.DoStatement=200]="DoStatement",e[e.WhileStatement=201]="WhileStatement",e[e.ForStatement=202]="ForStatement",e[e.ForInStatement=203]="ForInStatement",e[e.ForOfStatement=204]="ForOfStatement",e[e.ContinueStatement=205]="ContinueStatement",e[e.BreakStatement=206]="BreakStatement",e[e.ReturnStatement=207]="ReturnStatement",e[e.WithStatement=208]="WithStatement",e[e.SwitchStatement=209]="SwitchStatement",e[e.LabeledStatement=210]="LabeledStatement",e[e.ThrowStatement=211]="ThrowStatement",e[e.TryStatement=212]="TryStatement",e[e.DebuggerStatement=213]="DebuggerStatement",e[e.VariableDeclaration=214]="VariableDeclaration",e[e.VariableDeclarationList=215]="VariableDeclarationList",e[e.FunctionDeclaration=216]="FunctionDeclaration",e[e.ClassDeclaration=217]="ClassDeclaration",e[e.InterfaceDeclaration=218]="InterfaceDeclaration",e[e.TypeAliasDeclaration=219]="TypeAliasDeclaration",e[e.EnumDeclaration=220]="EnumDeclaration",e[e.ModuleDeclaration=221]="ModuleDeclaration",e[e.ModuleBlock=222]="ModuleBlock",e[e.CaseBlock=223]="CaseBlock",e[e.ImportEqualsDeclaration=224]="ImportEqualsDeclaration",e[e.ImportDeclaration=225]="ImportDeclaration",e[e.ImportClause=226]="ImportClause",e[e.NamespaceImport=227]="NamespaceImport",e[e.NamedImports=228]="NamedImports",e[e.ImportSpecifier=229]="ImportSpecifier",e[e.ExportAssignment=230]="ExportAssignment",e[e.ExportDeclaration=231]="ExportDeclaration",e[e.NamedExports=232]="NamedExports",e[e.ExportSpecifier=233]="ExportSpecifier",e[e.MissingDeclaration=234]="MissingDeclaration",e[e.ExternalModuleReference=235]="ExternalModuleReference",e[e.JsxElement=236]="JsxElement",e[e.JsxSelfClosingElement=237]="JsxSelfClosingElement",e[e.JsxOpeningElement=238]="JsxOpeningElement",e[e.JsxText=239]="JsxText",e[e.JsxClosingElement=240]="JsxClosingElement",e[e.JsxAttribute=241]="JsxAttribute",e[e.JsxSpreadAttribute=242]="JsxSpreadAttribute",e[e.JsxExpression=243]="JsxExpression",e[e.CaseClause=244]="CaseClause",e[e.DefaultClause=245]="DefaultClause",e[e.HeritageClause=246]="HeritageClause",e[e.CatchClause=247]="CatchClause",e[e.PropertyAssignment=248]="PropertyAssignment",e[e.ShorthandPropertyAssignment=249]="ShorthandPropertyAssignment",e[e.EnumMember=250]="EnumMember",e[e.SourceFile=251]="SourceFile",e[e.JSDocTypeExpression=252]="JSDocTypeExpression",e[e.JSDocAllType=253]="JSDocAllType",e[e.JSDocUnknownType=254]="JSDocUnknownType",e[e.JSDocArrayType=255]="JSDocArrayType",e[e.JSDocUnionType=256]="JSDocUnionType",e[e.JSDocTupleType=257]="JSDocTupleType",e[e.JSDocNullableType=258]="JSDocNullableType",e[e.JSDocNonNullableType=259]="JSDocNonNullableType",e[e.JSDocRecordType=260]="JSDocRecordType",e[e.JSDocRecordMember=261]="JSDocRecordMember",e[e.JSDocTypeReference=262]="JSDocTypeReference",e[e.JSDocOptionalType=263]="JSDocOptionalType",e[e.JSDocFunctionType=264]="JSDocFunctionType",e[e.JSDocVariadicType=265]="JSDocVariadicType",e[e.JSDocConstructorType=266]="JSDocConstructorType",e[e.JSDocThisType=267]="JSDocThisType",e[e.JSDocComment=268]="JSDocComment",e[e.JSDocTag=269]="JSDocTag",e[e.JSDocParameterTag=270]="JSDocParameterTag",e[e.JSDocReturnTag=271]="JSDocReturnTag",e[e.JSDocTypeTag=272]="JSDocTypeTag",e[e.JSDocTemplateTag=273]="JSDocTemplateTag",e[e.SyntaxList=274]="SyntaxList",e[e.Count=275]="Count",e[e.FirstAssignment=56]="FirstAssignment",e[e.LastAssignment=68]="LastAssignment",e[e.FirstReservedWord=70]="FirstReservedWord",e[e.LastReservedWord=105]="LastReservedWord",e[e.FirstKeyword=70]="FirstKeyword",e[e.LastKeyword=135]="LastKeyword",e[e.FirstFutureReservedWord=106]="FirstFutureReservedWord",e[e.LastFutureReservedWord=114]="LastFutureReservedWord",e[e.FirstTypeNode=151]="FirstTypeNode",e[e.LastTypeNode=163]="LastTypeNode",e[e.FirstPunctuation=15]="FirstPunctuation",e[e.LastPunctuation=68]="LastPunctuation",e[e.FirstToken=0]="FirstToken",e[e.LastToken=135]="LastToken",e[e.FirstTriviaToken=2]="FirstTriviaToken",e[e.LastTriviaToken=7]="LastTriviaToken",e[e.FirstLiteralToken=8]="FirstLiteralToken",e[e.LastLiteralToken=11]="LastLiteralToken",e[e.FirstTemplateToken=11]="FirstTemplateToken",e[e.LastTemplateToken=14]="LastTemplateToken",e[e.FirstBinaryOperator=25]="FirstBinaryOperator",e[e.LastBinaryOperator=68]="LastBinaryOperator",e[e.FirstNode=136]="FirstNode"}(e.SyntaxKind||(e.SyntaxKind={}));e.SyntaxKind;!function(e){e[e.None=0]="None",e[e.Export=2]="Export",e[e.Ambient=4]="Ambient",e[e.Public=8]="Public",e[e.Private=16]="Private",e[e.Protected=32]="Protected",e[e.Static=64]="Static",e[e.Abstract=128]="Abstract",e[e.Async=256]="Async",e[e.Default=512]="Default",e[e.MultiLine=1024]="MultiLine",e[e.Synthetic=2048]="Synthetic",e[e.DeclarationFile=4096]="DeclarationFile",e[e.Let=8192]="Let",e[e.Const=16384]="Const",e[e.OctalLiteral=32768]="OctalLiteral",e[e.Namespace=65536]="Namespace",e[e.ExportContext=131072]="ExportContext",e[e.ContainsThis=262144]="ContainsThis",e[e.HasImplicitReturn=524288]="HasImplicitReturn",e[e.HasExplicitReturn=1048576]="HasExplicitReturn",e[e.GlobalAugmentation=2097152]="GlobalAugmentation",e[e.HasClassExtends=4194304]="HasClassExtends",e[e.HasDecorators=8388608]="HasDecorators",e[e.HasParamDecorators=16777216]="HasParamDecorators",e[e.HasAsyncFunctions=33554432]="HasAsyncFunctions",e[e.HasJsxSpreadAttribute=1073741824]="HasJsxSpreadAttribute",e[e.Modifier=1022]="Modifier",e[e.AccessibilityModifier=56]="AccessibilityModifier",e[e.BlockScoped=24576]="BlockScoped",e[e.ReachabilityCheckFlags=1572864]="ReachabilityCheckFlags",e[e.EmitHelperFlags=62914560]="EmitHelperFlags"}(e.NodeFlags||(e.NodeFlags={}));e.NodeFlags;!function(e){e[e.None=0]="None",e[e.DisallowIn=1]="DisallowIn",e[e.Yield=2]="Yield",e[e.Decorator=4]="Decorator",e[e.Await=8]="Await",e[e.ThisNodeHasError=16]="ThisNodeHasError",e[e.JavaScriptFile=32]="JavaScriptFile",e[e.ParserGeneratedFlags=63]="ParserGeneratedFlags",e[e.TypeExcludesFlags=10]="TypeExcludesFlags",e[e.ThisNodeOrAnySubNodesHasError=64]="ThisNodeOrAnySubNodesHasError",e[e.HasAggregatedChildData=128]="HasAggregatedChildData"}(e.ParserContextFlags||(e.ParserContextFlags={}));e.ParserContextFlags;!function(e){e[e.None=0]="None",e[e.IntrinsicNamedElement=1]="IntrinsicNamedElement",e[e.IntrinsicIndexedElement=2]="IntrinsicIndexedElement",e[e.ValueElement=4]="ValueElement",e[e.UnknownElement=16]="UnknownElement",e[e.IntrinsicElement=3]="IntrinsicElement"}(e.JsxFlags||(e.JsxFlags={}));e.JsxFlags;!function(e){e[e.Succeeded=1]="Succeeded",e[e.Failed=2]="Failed",e[e.FailedAndReported=3]="FailedAndReported"}(e.RelationComparisonResult||(e.RelationComparisonResult={}));var t=(e.RelationComparisonResult,function(){function e(){}return e}());e.OperationCanceledException=t,function(e){e[e.Success=0]="Success",e[e.DiagnosticsPresent_OutputsSkipped=1]="DiagnosticsPresent_OutputsSkipped",e[e.DiagnosticsPresent_OutputsGenerated=2]="DiagnosticsPresent_OutputsGenerated"}(e.ExitStatus||(e.ExitStatus={}));e.ExitStatus;!function(e){e[e.None=0]="None",e[e.WriteArrayAsGenericType=1]="WriteArrayAsGenericType",e[e.UseTypeOfFunction=2]="UseTypeOfFunction",e[e.NoTruncation=4]="NoTruncation",e[e.WriteArrowStyleSignature=8]="WriteArrowStyleSignature",e[e.WriteOwnNameForAnyLike=16]="WriteOwnNameForAnyLike",e[e.WriteTypeArgumentsOfSignature=32]="WriteTypeArgumentsOfSignature",e[e.InElementType=64]="InElementType",e[e.UseFullyQualifiedType=128]="UseFullyQualifiedType"}(e.TypeFormatFlags||(e.TypeFormatFlags={}));e.TypeFormatFlags;!function(e){e[e.None=0]="None",e[e.WriteTypeParametersOrArguments=1]="WriteTypeParametersOrArguments",e[e.UseOnlyExternalAliasing=2]="UseOnlyExternalAliasing"}(e.SymbolFormatFlags||(e.SymbolFormatFlags={}));e.SymbolFormatFlags;!function(e){e[e.Accessible=0]="Accessible",e[e.NotAccessible=1]="NotAccessible",e[e.CannotBeNamed=2]="CannotBeNamed"}(e.SymbolAccessibility||(e.SymbolAccessibility={}));e.SymbolAccessibility;!function(e){e[e.This=0]="This",e[e.Identifier=1]="Identifier"}(e.TypePredicateKind||(e.TypePredicateKind={}));e.TypePredicateKind;!function(e){e[e.Unknown=0]="Unknown",e[e.TypeWithConstructSignatureAndValue=1]="TypeWithConstructSignatureAndValue",e[e.VoidType=2]="VoidType",e[e.NumberLikeType=3]="NumberLikeType",e[e.StringLikeType=4]="StringLikeType",e[e.BooleanType=5]="BooleanType",e[e.ArrayLikeType=6]="ArrayLikeType",e[e.ESSymbolType=7]="ESSymbolType",e[e.TypeWithCallSignature=8]="TypeWithCallSignature",e[e.ObjectType=9]="ObjectType"}(e.TypeReferenceSerializationKind||(e.TypeReferenceSerializationKind={}));e.TypeReferenceSerializationKind;!function(e){e[e.None=0]="None",e[e.FunctionScopedVariable=1]="FunctionScopedVariable",e[e.BlockScopedVariable=2]="BlockScopedVariable",e[e.Property=4]="Property",e[e.EnumMember=8]="EnumMember",e[e.Function=16]="Function",e[e.Class=32]="Class",e[e.Interface=64]="Interface",e[e.ConstEnum=128]="ConstEnum",e[e.RegularEnum=256]="RegularEnum",e[e.ValueModule=512]="ValueModule",e[e.NamespaceModule=1024]="NamespaceModule",e[e.TypeLiteral=2048]="TypeLiteral",e[e.ObjectLiteral=4096]="ObjectLiteral",e[e.Method=8192]="Method",e[e.Constructor=16384]="Constructor",e[e.GetAccessor=32768]="GetAccessor",e[e.SetAccessor=65536]="SetAccessor",e[e.Signature=131072]="Signature",e[e.TypeParameter=262144]="TypeParameter",e[e.TypeAlias=524288]="TypeAlias",e[e.ExportValue=1048576]="ExportValue",e[e.ExportType=2097152]="ExportType",e[e.ExportNamespace=4194304]="ExportNamespace",e[e.Alias=8388608]="Alias",e[e.Instantiated=16777216]="Instantiated",e[e.Merged=33554432]="Merged",e[e.Transient=67108864]="Transient",e[e.Prototype=134217728]="Prototype",e[e.SyntheticProperty=268435456]="SyntheticProperty",e[e.Optional=536870912]="Optional",e[e.ExportStar=1073741824]="ExportStar",e[e.Enum=384]="Enum",e[e.Variable=3]="Variable",e[e.Value=107455]="Value",e[e.Type=793056]="Type",e[e.Namespace=1536]="Namespace",e[e.Module=1536]="Module",e[e.Accessor=98304]="Accessor",e[e.FunctionScopedVariableExcludes=107454]="FunctionScopedVariableExcludes",e[e.BlockScopedVariableExcludes=107455]="BlockScopedVariableExcludes",e[e.ParameterExcludes=107455]="ParameterExcludes",e[e.PropertyExcludes=107455]="PropertyExcludes",e[e.EnumMemberExcludes=107455]="EnumMemberExcludes",e[e.FunctionExcludes=106927]="FunctionExcludes",e[e.ClassExcludes=899519]="ClassExcludes",e[e.InterfaceExcludes=792960]="InterfaceExcludes",e[e.RegularEnumExcludes=899327]="RegularEnumExcludes",e[e.ConstEnumExcludes=899967]="ConstEnumExcludes",e[e.ValueModuleExcludes=106639]="ValueModuleExcludes",e[e.NamespaceModuleExcludes=0]="NamespaceModuleExcludes",e[e.MethodExcludes=99263]="MethodExcludes",e[e.GetAccessorExcludes=41919]="GetAccessorExcludes",e[e.SetAccessorExcludes=74687]="SetAccessorExcludes",e[e.TypeParameterExcludes=530912]="TypeParameterExcludes",e[e.TypeAliasExcludes=793056]="TypeAliasExcludes",e[e.AliasExcludes=8388608]="AliasExcludes",e[e.ModuleMember=8914931]="ModuleMember",e[e.ExportHasLocal=944]="ExportHasLocal",e[e.HasExports=1952]="HasExports",e[e.HasMembers=6240]="HasMembers",e[e.BlockScoped=418]="BlockScoped",e[e.PropertyOrAccessor=98308]="PropertyOrAccessor",e[e.Export=7340032]="Export",e[e.Classifiable=788448]="Classifiable"}(e.SymbolFlags||(e.SymbolFlags={}));e.SymbolFlags;!function(e){e[e.TypeChecked=1]="TypeChecked",e[e.LexicalThis=2]="LexicalThis",e[e.CaptureThis=4]="CaptureThis",e[e.SuperInstance=256]="SuperInstance",e[e.SuperStatic=512]="SuperStatic",e[e.ContextChecked=1024]="ContextChecked",e[e.AsyncMethodWithSuper=2048]="AsyncMethodWithSuper",e[e.AsyncMethodWithSuperBinding=4096]="AsyncMethodWithSuperBinding",e[e.CaptureArguments=8192]="CaptureArguments",e[e.EnumValuesComputed=16384]="EnumValuesComputed",e[e.LexicalModuleMergesWithClass=32768]="LexicalModuleMergesWithClass",e[e.LoopWithCapturedBlockScopedBinding=65536]="LoopWithCapturedBlockScopedBinding",e[e.CapturedBlockScopedBinding=131072]="CapturedBlockScopedBinding",e[e.BlockScopedBindingInLoop=262144]="BlockScopedBindingInLoop",e[e.ClassWithBodyScopedClassBinding=524288]="ClassWithBodyScopedClassBinding",e[e.BodyScopedClassBinding=1048576]="BodyScopedClassBinding",e[e.NeedsLoopOutParameter=2097152]="NeedsLoopOutParameter"}(e.NodeCheckFlags||(e.NodeCheckFlags={}));e.NodeCheckFlags;!function(e){e[e.Any=1]="Any",e[e.String=2]="String",e[e.Number=4]="Number",e[e.Boolean=8]="Boolean",e[e.Void=16]="Void",e[e.Undefined=32]="Undefined",e[e.Null=64]="Null",e[e.Enum=128]="Enum",e[e.StringLiteral=256]="StringLiteral",e[e.TypeParameter=512]="TypeParameter",e[e.Class=1024]="Class",e[e.Interface=2048]="Interface",e[e.Reference=4096]="Reference",e[e.Tuple=8192]="Tuple",e[e.Union=16384]="Union",e[e.Intersection=32768]="Intersection",e[e.Anonymous=65536]="Anonymous",e[e.Instantiated=131072]="Instantiated",e[e.FromSignature=262144]="FromSignature",e[e.ObjectLiteral=524288]="ObjectLiteral",e[e.FreshObjectLiteral=1048576]="FreshObjectLiteral",e[e.ContainsUndefinedOrNull=2097152]="ContainsUndefinedOrNull",e[e.ContainsObjectLiteral=4194304]="ContainsObjectLiteral",e[e.ContainsAnyFunctionType=8388608]="ContainsAnyFunctionType",e[e.ESSymbol=16777216]="ESSymbol",e[e.ThisType=33554432]="ThisType",e[e.ObjectLiteralPatternWithComputedProperties=67108864]="ObjectLiteralPatternWithComputedProperties",e[e.Intrinsic=16777343]="Intrinsic",e[e.Primitive=16777726]="Primitive",e[e.StringLike=258]="StringLike",e[e.NumberLike=132]="NumberLike",e[e.ObjectType=80896]="ObjectType",e[e.UnionOrIntersection=49152]="UnionOrIntersection",e[e.StructuredType=130048]="StructuredType",e[e.RequiresWidening=6291456]="RequiresWidening",e[e.PropagatingFlags=14680064]="PropagatingFlags"}(e.TypeFlags||(e.TypeFlags={}));e.TypeFlags;!function(e){e[e.Call=0]="Call",e[e.Construct=1]="Construct"}(e.SignatureKind||(e.SignatureKind={}));e.SignatureKind;!function(e){e[e.String=0]="String",e[e.Number=1]="Number"}(e.IndexKind||(e.IndexKind={}));e.IndexKind;!function(e){e[e.None=0]="None",e[e.ExportsProperty=1]="ExportsProperty",e[e.ModuleExports=2]="ModuleExports",e[e.PrototypeProperty=3]="PrototypeProperty",e[e.ThisProperty=4]="ThisProperty"}(e.SpecialPropertyAssignmentKind||(e.SpecialPropertyAssignmentKind={}));e.SpecialPropertyAssignmentKind;!function(e){e[e.Warning=0]="Warning",e[e.Error=1]="Error",e[e.Message=2]="Message"}(e.DiagnosticCategory||(e.DiagnosticCategory={}));e.DiagnosticCategory;!function(e){e[e.Classic=1]="Classic",e[e.NodeJs=2]="NodeJs"}(e.ModuleResolutionKind||(e.ModuleResolutionKind={}));e.ModuleResolutionKind;!function(e){e[e.None=0]="None",e[e.CommonJS=1]="CommonJS",e[e.AMD=2]="AMD",e[e.UMD=3]="UMD",e[e.System=4]="System",e[e.ES6=5]="ES6",e[e.ES2015=5]="ES2015"}(e.ModuleKind||(e.ModuleKind={}));e.ModuleKind;!function(e){e[e.None=0]="None",e[e.Preserve=1]="Preserve",e[e.React=2]="React"}(e.JsxEmit||(e.JsxEmit={}));e.JsxEmit;!function(e){e[e.CarriageReturnLineFeed=0]="CarriageReturnLineFeed",e[e.LineFeed=1]="LineFeed"}(e.NewLineKind||(e.NewLineKind={}));e.NewLineKind;!function(e){e[e.Unknown=0]="Unknown",e[e.JS=1]="JS",e[e.JSX=2]="JSX",e[e.TS=3]="TS",e[e.TSX=4]="TSX"}(e.ScriptKind||(e.ScriptKind={}));e.ScriptKind;!function(e){e[e.ES3=0]="ES3",e[e.ES5=1]="ES5",e[e.ES6=2]="ES6",e[e.ES2015=2]="ES2015",e[e.Latest=2]="Latest"}(e.ScriptTarget||(e.ScriptTarget={}));e.ScriptTarget;!function(e){e[e.Standard=0]="Standard",e[e.JSX=1]="JSX"}(e.LanguageVariant||(e.LanguageVariant={}));e.LanguageVariant;!function(e){e[e.Simple=0]="Simple",e[e.Pretty=1]="Pretty"}(e.DiagnosticStyle||(e.DiagnosticStyle={}));e.DiagnosticStyle;!function(e){e[e.nullCharacter=0]="nullCharacter",e[e.maxAsciiCharacter=127]="maxAsciiCharacter",e[e.lineFeed=10]="lineFeed",e[e.carriageReturn=13]="carriageReturn",e[e.lineSeparator=8232]="lineSeparator",e[e.paragraphSeparator=8233]="paragraphSeparator",e[e.nextLine=133]="nextLine",e[e.space=32]="space",e[e.nonBreakingSpace=160]="nonBreakingSpace",e[e.enQuad=8192]="enQuad",e[e.emQuad=8193]="emQuad",e[e.enSpace=8194]="enSpace",e[e.emSpace=8195]="emSpace",e[e.threePerEmSpace=8196]="threePerEmSpace",e[e.fourPerEmSpace=8197]="fourPerEmSpace",e[e.sixPerEmSpace=8198]="sixPerEmSpace",e[e.figureSpace=8199]="figureSpace",e[e.punctuationSpace=8200]="punctuationSpace",e[e.thinSpace=8201]="thinSpace",e[e.hairSpace=8202]="hairSpace",e[e.zeroWidthSpace=8203]="zeroWidthSpace",e[e.narrowNoBreakSpace=8239]="narrowNoBreakSpace",e[e.ideographicSpace=12288]="ideographicSpace",e[e.mathematicalSpace=8287]="mathematicalSpace",e[e.ogham=5760]="ogham",e[e._=95]="_",e[e.$=36]="$",e[e._0=48]="_0",e[e._1=49]="_1",e[e._2=50]="_2",e[e._3=51]="_3",e[e._4=52]="_4",e[e._5=53]="_5",e[e._6=54]="_6",e[e._7=55]="_7",e[e._8=56]="_8",e[e._9=57]="_9",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.ampersand=38]="ampersand",e[e.asterisk=42]="asterisk",e[e.at=64]="at",e[e.backslash=92]="backslash",e[e.backtick=96]="backtick",e[e.bar=124]="bar",e[e.caret=94]="caret",e[e.closeBrace=125]="closeBrace",e[e.closeBracket=93]="closeBracket",e[e.closeParen=41]="closeParen",e[e.colon=58]="colon",e[e.comma=44]="comma",e[e.dot=46]="dot",e[e.doubleQuote=34]="doubleQuote",e[e.equals=61]="equals",e[e.exclamation=33]="exclamation",e[e.greaterThan=62]="greaterThan",e[e.hash=35]="hash",e[e.lessThan=60]="lessThan",e[e.minus=45]="minus",e[e.openBrace=123]="openBrace",e[e.openBracket=91]="openBracket",e[e.openParen=40]="openParen",e[e.percent=37]="percent",e[e.plus=43]="plus",e[e.question=63]="question",e[e.semicolon=59]="semicolon",e[e.singleQuote=39]="singleQuote",e[e.slash=47]="slash",e[e.tilde=126]="tilde",e[e.backspace=8]="backspace",e[e.formFeed=12]="formFeed",e[e.byteOrderMark=65279]="byteOrderMark",e[e.tab=9]="tab",e[e.verticalTab=11]="verticalTab"}(e.CharacterCodes||(e.CharacterCodes={}));e.CharacterCodes}(ts||(ts={}));var ts;!function(e){function t(e){function t(e){for(var t in c)e(t,c[t])}function n(e){return c[s(e)]}function r(e,t){c[s(e)]=t}function a(e){return h(c,s(e))}function i(e){var t=s(e);delete c[t]}function o(){c={}}function s(t){return e?e(t):t}var c={};return{get:n,set:r,contains:a,remove:i,forEachValue:t,clear:o}}function n(e,t,n){var r=Q(e)?H(e):Z(e,t);return n(r)}function r(e,t){if(e)for(var n=0,r=e.length;r>n;n++){var a=t(e[n],n);if(a)return a}}function a(e,t){if(e)for(var n=0,r=e;n<r.length;n++){var a=r[n];if(a===t)return!0}return!1}function i(e,t){if(e)for(var n=0,r=e.length;r>n;n++)if(e[n]===t)return n;return-1}function o(e,t){var n=0;if(e)for(var r=0,a=e;r<a.length;r++){var i=a[r];t(i)&&n++}return n}function s(e,t){var n;if(e){n=[];for(var r=0,a=e;r<a.length;r++){var i=a[r];t(i)&&n.push(i)}}return n}function c(e,t){var n;if(e){n=[];for(var r=0,a=e;r<a.length;r++){var i=a[r];n.push(t(i))}}return n}function _(e,t){return t&&t.length?e&&e.length?e.concat(t):t:e}function u(e){var t;if(e){t=[];for(var n=0,r=e;n<r.length;n++){var i=r[n];a(t,i)||t.push(i)}}return t}function l(e,t){for(var n=0,r=0,a=e;r<a.length;r++){var i=a[r];n+=i[t]}return n}function d(e,t){if(e&&t)for(var n=0,r=t;n<r.length;n++){var a=r[n];e.push(a)}}function p(e,t,n,r){for(;r>n;){if(e[n]!==t[n])return!1;n++}return!0}function f(e){return 0!==e.length?e[e.length-1]:void 0}function m(e,t){for(var n=0,r=e.length-1;r>=n;){var a=n+(r-n>>1),i=e[a];if(i===t)return a;i>t?r=a-1:n=a+1}return~n}function g(e,t,n){if(e){var r=e.length;if(r>0){var a=0,i=arguments.length<=2?e[a]:n;for(a++;r>a;)i=t(i,e[a]),a++;return i}}return n}function y(e,t,n){if(e){var r=e.length-1;if(r>=0){var a=arguments.length<=2?e[r]:n;for(r--;r>=0;)a=t(a,e[r]),r--;return a}}return n}function h(e,t){return he.call(e,t)}function v(e){var t=[];for(var n in e)t.push(n);return t}function k(e,t){return he.call(e,t)?e[t]:void 0}function b(e){for(var t in e)if(h(e,t))return!1;return!0}function x(e){var t={};for(var n in e)t[n]=e[n];return t}function C(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)h(n,r)||(n[r]=t[r]);return n}function D(e,t){var n;for(var r in e)if(n=t(e[r]))break;return n}function S(e,t){var n;for(var r in e)if(n=t(r))break;return n}function T(e,t){return h(e,t)?e[t]:void 0}function E(e,t){for(var n in e)t[n]=e[n]}function w(e,t){var n={};return r(e,function(e){n[t(e)]=e}),n}function A(e,t,n){var r=n;if(e)for(var a in e)h(e,a)&&(r=t(r,e[a],String(a)));return r}function P(e){return Array.isArray?Array.isArray(e):e instanceof Array}function N(e){var t;return function(){return e&&(t=e(),e=void 0),t}}function O(e,t,n){return n=n||0,e.replace(/{(\d+)}/g,function(e,r){return t[+r+n]})}function R(t){return e.localizedDiagnosticMessages&&e.localizedDiagnosticMessages[t.key]?e.localizedDiagnosticMessages[t.key]:t.message}function I(e,t,n,r){var a=t+n;be.assert(t>=0,"start must be non-negative, is "+t),be.assert(n>=0,"length must be non-negative, is "+n),e&&(be.assert(t<=e.text.length,"start must be within the bounds of the file. "+t+" > "+e.text.length),be.assert(a<=e.text.length,"end must be the bounds of the file. "+a+" > "+e.text.length));var i=R(r);return arguments.length>4&&(i=O(i,arguments,4)),{file:e,start:t,length:n,messageText:i,category:r.category,code:r.code}}function F(e){var t=R(e);return arguments.length>1&&(t=O(t,arguments,1)),{file:void 0,start:void 0,length:void 0,messageText:t,category:e.category,code:e.code}}function L(e,t){var n=R(t);return arguments.length>2&&(n=O(n,arguments,2)),{messageText:n,category:t.category,code:t.code,next:e}}function M(e,t){for(var n=e;n.next;)n=n.next;return n.next=t,e}function B(e,t){return e===t?0:void 0===e?-1:void 0===t?1:t>e?-1:1}function z(e){return e.file?e.file.fileName:void 0}function K(e,t){return B(z(e),z(t))||B(e.start,t.start)||B(e.length,t.length)||B(e.code,t.code)||j(e.messageText,t.messageText)||0}function j(e,t){for(;e&&t;){var n="string"==typeof e?e:e.messageText,r="string"==typeof t?t:t.messageText,a=B(n,r);if(a)return a;e="string"==typeof e?void 0:e.next,t="string"==typeof t?void 0:t.next}return e||t?e?1:-1:0}function J(e){return U(e.sort(K))}function U(e){if(e.length<2)return e;for(var t=[e[0]],n=e[0],r=1;r<e.length;r++){var a=e[r],i=0===K(a,n);i||(t.push(a),n=a)}return t}function q(e){return e.replace(/\\/g,"/")}function W(e){if(47===e.charCodeAt(0)){if(47!==e.charCodeAt(1))return 1;var t=e.indexOf("/",2);if(0>t)return 2;var n=e.indexOf("/",t+1);return 0>n?t+1:n+1}if(58===e.charCodeAt(1))return 47===e.charCodeAt(2)?3:2;if(0===e.lastIndexOf("file:///",0))return"file:///".length;var r=e.indexOf("://");return-1!==r?r+"://".length:0}function V(t,n){for(var r=t.substr(n).split(e.directorySeparator),a=[],i=0,o=r;i<o.length;i++){var s=o[i];"."!==s&&(".."===s&&a.length>0&&".."!==f(a)?a.pop():s&&a.push(s))}return a}function H(t){t=q(t);var n=W(t),r=V(t,n);return t.substr(0,n)+r.join(e.directorySeparator)}function G(t){return t.substr(0,Math.max(W(t),t.lastIndexOf(e.directorySeparator)))}function X(e){return e&&!Q(e)&&-1!==e.indexOf("://");
}function Q(e){return 0!==W(e)}function Y(e,t){var n=V(e,t);return[e.substr(0,t)].concat(n)}function $(e,t){e=q(e);var n=W(e);return 0===n&&(e=ie(q(t),e),n=W(e)),Y(e,n)}function Z(e,t){return ee($(e,t))}function ee(t){return t&&t.length?t[0]+t.slice(1).join(e.directorySeparator):void 0}function te(t){for(var n=t.length,r=t.indexOf("://")+"://".length;n>r&&47===t.charCodeAt(r);)r++;if(r===n)return[t];var a=t.indexOf(e.directorySeparator,r);return-1!==a?(r=a+1,Y(t,r)):[t+e.directorySeparator]}function ne(e,t){return X(e)?te(e):$(e,t)}function re(t,n,r,a,i){var o=ne(n,r),s=ne(t,r);s.length>1&&""===f(s)&&s.length--;var c;for(c=0;c<o.length&&c<s.length&&a(s[c])===a(o[c]);c++);if(c){for(var _="",u=o.slice(c,o.length);c<s.length;c++)""!==s[c]&&(_=_+".."+e.directorySeparator);return _+u.join(e.directorySeparator)}var l=ee(o);return i&&Q(l)&&(l="file:///"+l),l}function ae(t){if(void 0!==t){var n=t.lastIndexOf(e.directorySeparator);return 0>n?t:t.substring(n+1)}}function ie(t,n){return t&&t.length?n&&n.length?0!==W(n)?n:t.charAt(t.length-1)===e.directorySeparator?t+n:t+e.directorySeparator+n:t:n}function oe(e,t){var n=e.length,r=t.length;return n>r&&e.substr(n-r,r)===t}function se(e,t){return t||ce(e)||3}function ce(e){var t=e.substr(e.lastIndexOf("."));switch(t.toLowerCase()){case".js":return 1;case".jsx":return 2;case".ts":return 3;case".tsx":return 4;default:return 0}}function _e(t){return t&&t.allowJs?ve:e.supportedTypeScriptExtensions}function ue(e,t){if(!e)return!1;for(var n=0,r=_e(t);n<r.length;n++){var a=r[n];if(oe(e,a))return!0}return!1}function le(e){for(var t=0,n=ke;t<n.length;t++){var r=n[t];if(oe(e,r))return e.substr(0,e.length-r.length)}return e}function de(e,t){this.flags=e,this.name=t,this.declarations=void 0}function pe(e,t){this.flags=t}function fe(e){}function me(e,t,n){this.kind=e,this.pos=t,this.end=n,this.flags=0,this.parent=void 0}function ge(e,t){for(var n=[],r=0,a=t;r<a.length;r++){var i=a[r];i!==e&&n.push(i)}return n}function ye(e){return e?function(e){return e}:function(e){return e.toLowerCase()}}!function(e){e[e.False=0]="False",e[e.Maybe=1]="Maybe",e[e.True=-1]="True"}(e.Ternary||(e.Ternary={}));e.Ternary;e.createFileMap=t,e.toPath=n,function(e){e[e.LessThan=-1]="LessThan",e[e.EqualTo=0]="EqualTo",e[e.GreaterThan=1]="GreaterThan"}(e.Comparison||(e.Comparison={}));e.Comparison;e.forEach=r,e.contains=a,e.indexOf=i,e.countWhere=o,e.filter=s,e.map=c,e.concatenate=_,e.deduplicate=u,e.sum=l,e.addRange=d,e.rangeEquals=p,e.lastOrUndefined=f,e.binarySearch=m,e.reduceLeft=g,e.reduceRight=y;var he=Object.prototype.hasOwnProperty;e.hasProperty=h,e.getKeys=v,e.getProperty=k,e.isEmpty=b,e.clone=x,e.extend=C,e.forEachValue=D,e.forEachKey=S,e.lookUp=T,e.copyMap=E,e.arrayToMap=w,e.reduceProperties=A,e.isArray=P,e.memoize=N,e.localizedDiagnosticMessages=void 0,e.getLocaleSpecificMessage=R,e.createFileDiagnostic=I,e.createCompilerDiagnostic=F,e.chainDiagnosticMessages=L,e.concatenateDiagnosticMessageChains=M,e.compareValues=B,e.compareDiagnostics=K,e.sortAndDeduplicateDiagnostics=J,e.deduplicateSortedDiagnostics=U,e.normalizeSlashes=q,e.getRootLength=W,e.directorySeparator="/",e.normalizePath=H,e.getDirectoryPath=G,e.isUrl=X,e.isRootedDiskPath=Q,e.getNormalizedPathComponents=$,e.getNormalizedAbsolutePath=Z,e.getNormalizedPathFromPathComponents=ee,e.getRelativePathToDirectoryOrUrl=re,e.getBaseFileName=ae,e.combinePaths=ie,e.fileExtensionIs=oe,e.ensureScriptKind=se,e.getScriptKindFromFileName=ce,e.supportedTypeScriptExtensions=[".ts",".tsx",".d.ts"],e.supportedJavascriptExtensions=[".js",".jsx"];var ve=e.supportedTypeScriptExtensions.concat(e.supportedJavascriptExtensions);e.getSupportedExtensions=_e,e.isSupportedSourceFileName=ue;var ke=[".d.ts",".ts",".js",".tsx",".jsx"];e.removeFileExtension=le,e.objectAllocator={getNodeConstructor:function(){return me},getSourceFileConstructor:function(){return me},getSymbolConstructor:function(){return de},getTypeConstructor:function(){return pe},getSignatureConstructor:function(){return fe}},function(e){e[e.None=0]="None",e[e.Normal=1]="Normal",e[e.Aggressive=2]="Aggressive",e[e.VeryAggressive=3]="VeryAggressive"}(e.AssertionLevel||(e.AssertionLevel={}));var be;e.AssertionLevel;!function(e){function t(e){return a>=e}function n(e,t,n){if(!e){var r="";throw n&&(r="\r\nVerbose Debug Information: "+n()),new Error("Debug Failure. False expression: "+(t||"")+r)}}function r(t){e.assert(!1,t)}var a=0;e.shouldAssert=t,e.assert=n,e.fail=r}(be=e.Debug||(e.Debug={})),e.copyListRemovingItem=ge,e.createGetCanonicalFileName=ye}(ts||(ts={}));var ts;!function(e){e.sys=function(){function t(){function t(e,t){if(o.FileExists(e)){s.Open();try{if(t)s.Charset=t,s.LoadFromFile(e);else{s.Charset="x-ansi",s.LoadFromFile(e);var n=s.ReadText(2)||"";s.Position=0,s.Charset=n.length>=2&&(255===n.charCodeAt(0)&&254===n.charCodeAt(1)||254===n.charCodeAt(0)&&255===n.charCodeAt(1))?"unicode":"utf-8"}return s.ReadText()}catch(r){throw r}finally{s.Close()}}}function n(e,t,n){s.Open(),c.Open();try{s.Charset="utf-8",s.WriteText(t),n?s.Position=0:s.Position=3,s.CopyTo(c),c.SaveToFile(e,2)}finally{c.Close(),s.Close()}}function r(e){return e.toLowerCase()}function a(e){for(var t=[],n=new Enumerator(e);!n.atEnd();n.moveNext())t.push(n.item().Name);return t.sort()}function i(t,n,i){function s(t){for(var _=o.GetFolder(t||"."),u=a(_.files),l=0,d=u;l<d.length;l++){var p=d[l],f=e.combinePaths(t,p);n&&!e.fileExtensionIs(f,n)||e.contains(i,r(f))||c.push(f)}for(var m=a(_.subfolders),g=0,y=m;g<y.length;g++){var p=y[g],h=e.combinePaths(t,p);e.contains(i,r(h))||s(h)}}var c=[];return i=e.map(i,function(n){return r(e.combinePaths(t,n))}),s(t),c}var o=new ActiveXObject("Scripting.FileSystemObject"),s=new ActiveXObject("ADODB.Stream");s.Type=2;var c=new ActiveXObject("ADODB.Stream");c.Type=1;for(var _=[],u=0;u<WScript.Arguments.length;u++)_[u]=WScript.Arguments.Item(u);return{args:_,newLine:"\r\n",useCaseSensitiveFileNames:!1,write:function(e){WScript.StdOut.Write(e)},readFile:t,writeFile:n,resolvePath:function(e){return o.GetAbsolutePathName(e)},fileExists:function(e){return o.FileExists(e)},directoryExists:function(e){return o.FolderExists(e)},createDirectory:function(e){this.directoryExists(e)||o.CreateFolder(e)},getExecutingFilePath:function(){return WScript.ScriptFullName},getCurrentDirectory:function(){return new ActiveXObject("WScript.Shell").CurrentDirectory},readDirectory:i,exit:function(e){try{WScript.Quit(e)}catch(t){}}}}function n(){function t(t,n){function r(e){return c.statSync(e).mtime}function a(e){var t=u[e];t&&c.stat(t.filePath,function(e,n){e?t.callback(t.filePath):t.mtime.getTime()!==n.mtime.getTime()&&(t.mtime=r(t.filePath),t.callback(t.filePath,0===t.mtime.getTime()))})}function i(){_=setInterval(function(){for(var e=0,t=l,r=-1;n>e&&t!==r;)a(t),0>r&&(r=t),t++,t===u.length&&(t=0),e++;l=t},t)}function o(e,t){var n={filePath:e,callback:t,mtime:r(e)};return u.push(n),1===u.length&&i(),n}function s(t){u=e.copyListRemovingItem(t,u)}void 0===t&&(t=2500),void 0===n&&(n=30);var _,u=[],l=0;return{getModifiedTime:r,poll:a,startWatchTimer:i,addFile:o,removeFile:s}}function n(){function t(t){var n=e.getDirectoryPath(t);if(_.contains(n)){var r=_.get(n);r.referenceCount-=1,r.referenceCount<=0&&(r.close(),_.remove(n))}}function n(e){if(_.contains(e)){var t=_.get(e);return void(t.referenceCount+=1)}var n=c.watch(e,{persistent:!0},function(t,n){return s(t,n,e)});n.referenceCount=1,_.set(e,n)}function r(e,t){u.contains(e)?u.get(e).push(t):u.set(e,[t])}function a(t,a){return r(t,a),n(e.getDirectoryPath(t)),{filePath:t,callback:a}}function i(e){o(e.filePath,e.callback),t(e.filePath)}function o(t,n){if(u.contains(t)){var r=e.copyListRemovingItem(n,u.get(t));0===r.length?u.remove(t):u.set(t,r)}}function s(t,n,r){var a="string"!=typeof n?void 0:e.toPath(n,r,e.createGetCanonicalFileName(e.sys.useCaseSensitiveFileNames));if(("change"===t||"rename"===t)&&u.contains(a))for(var i=0,o=u.get(a);i<o.length;i++){var s=o[i];s(a)}}var _=e.createFileMap(),u=e.createFileMap();return{addFile:a,removeFile:i}}function r(){return parseInt(process.version.charAt(1))>=4}function a(e,t){if(c.existsSync(e)){var n=c.readFileSync(e),r=n.length;if(r>=2&&254===n[0]&&255===n[1]){r&=-2;for(var a=0;r>a;a+=2){var i=n[a];n[a]=n[a+1],n[a+1]=i}return n.toString("utf16le",2)}return r>=2&&255===n[0]&&254===n[1]?n.toString("utf16le",2):r>=3&&239===n[0]&&187===n[1]&&191===n[2]?n.toString("utf8",3):n.toString("utf8")}}function i(e,t,n){n&&(t="\ufeff"+t);var r;try{r=c.openSync(e,"w"),c.writeSync(r,t,void 0,"utf8")}finally{void 0!==r&&c.closeSync(r)}}function o(e){return f?e:e.toLowerCase()}function s(t,n,r){function a(t){for(var s=c.readdirSync(t||".").sort(),_=[],u=0,l=s;u<l.length;u++){var d=l[u],p=e.combinePaths(t,d);if(!e.contains(r,o(p)))try{var f=c.statSync(p);f.isFile()?n&&!e.fileExtensionIs(p,n)||i.push(p):f.isDirectory()&&_.push(p)}catch(m){}}for(var g=0,y=_;g<y.length;g++){var d=y[g];a(d)}}var i=[];return r=e.map(r,function(n){return o(e.combinePaths(t,n))}),a(t),i}var c=require("fs"),_=require("path"),u=require("os"),l=t(),d=n(),p=u.platform(),f="win32"!==p&&"win64"!==p&&"darwin"!==p;return{args:process.argv.slice(2),newLine:u.EOL,useCaseSensitiveFileNames:f,write:function(e){process.stdout.write(e)},readFile:a,writeFile:i,watchFile:function(e,t){var n=r()?d:l,a=n.addFile(e,t);return{close:function(){return n.removeFile(a)}}},watchDirectory:function(t,n,a){var i;return i=!r()||"win32"!==process.platform&&"darwin"!==process.platform?{persistent:!0}:{persistent:!0,recursive:!!a},c.watch(t,i,function(r,a){"rename"===r&&n(a?e.normalizePath(e.combinePaths(t,a)):a)})},resolvePath:function(e){return _.resolve(e)},fileExists:function(e){return c.existsSync(e)},directoryExists:function(e){return c.existsSync(e)&&c.statSync(e).isDirectory()},createDirectory:function(e){this.directoryExists(e)||c.mkdirSync(e)},getExecutingFilePath:function(){return __filename},getCurrentDirectory:function(){return process.cwd()},readDirectory:s,getMemoryUsage:function(){return global.gc&&global.gc(),process.memoryUsage().heapUsed},exit:function(e){process.exit(e)}}}function r(){return{newLine:ChakraHost.newLine||"\r\n",args:ChakraHost.args,useCaseSensitiveFileNames:!!ChakraHost.useCaseSensitiveFileNames,write:ChakraHost.echo,readFile:function(e,t){return ChakraHost.readFile(e)},writeFile:function(e,t,n){n&&(t="\ufeff"+t),ChakraHost.writeFile(e,t)},resolvePath:ChakraHost.resolvePath,fileExists:ChakraHost.fileExists,directoryExists:ChakraHost.directoryExists,createDirectory:ChakraHost.createDirectory,getExecutingFilePath:function(){return ChakraHost.executingFile},getCurrentDirectory:function(){return ChakraHost.currentDirectory},readDirectory:ChakraHost.readDirectory,exit:ChakraHost.quit}}return"undefined"!=typeof WScript&&"function"==typeof ActiveXObject?t():"undefined"!=typeof process&&process.nextTick&&!process.browser&&"undefined"!=typeof require?n():"undefined"!=typeof ChakraHost?r():void 0}()}(ts||(ts={}));var ts;!function(e){e.Diagnostics={Unterminated_string_literal:{code:1002,category:e.DiagnosticCategory.Error,key:"Unterminated_string_literal_1002",message:"Unterminated string literal."},Identifier_expected:{code:1003,category:e.DiagnosticCategory.Error,key:"Identifier_expected_1003",message:"Identifier expected."},_0_expected:{code:1005,category:e.DiagnosticCategory.Error,key:"_0_expected_1005",message:"'{0}' expected."},A_file_cannot_have_a_reference_to_itself:{code:1006,category:e.DiagnosticCategory.Error,key:"A_file_cannot_have_a_reference_to_itself_1006",message:"A file cannot have a reference to itself."},Trailing_comma_not_allowed:{code:1009,category:e.DiagnosticCategory.Error,key:"Trailing_comma_not_allowed_1009",message:"Trailing comma not allowed."},Asterisk_Slash_expected:{code:1010,category:e.DiagnosticCategory.Error,key:"Asterisk_Slash_expected_1010",message:"'*/' expected."},Unexpected_token:{code:1012,category:e.DiagnosticCategory.Error,key:"Unexpected_token_1012",message:"Unexpected token."},A_rest_parameter_must_be_last_in_a_parameter_list:{code:1014,category:e.DiagnosticCategory.Error,key:"A_rest_parameter_must_be_last_in_a_parameter_list_1014",message:"A rest parameter must be last in a parameter list."},Parameter_cannot_have_question_mark_and_initializer:{code:1015,category:e.DiagnosticCategory.Error,key:"Parameter_cannot_have_question_mark_and_initializer_1015",message:"Parameter cannot have question mark and initializer."},A_required_parameter_cannot_follow_an_optional_parameter:{code:1016,category:e.DiagnosticCategory.Error,key:"A_required_parameter_cannot_follow_an_optional_parameter_1016",message:"A required parameter cannot follow an optional parameter."},An_index_signature_cannot_have_a_rest_parameter:{code:1017,category:e.DiagnosticCategory.Error,key:"An_index_signature_cannot_have_a_rest_parameter_1017",message:"An index signature cannot have a rest parameter."},An_index_signature_parameter_cannot_have_an_accessibility_modifier:{code:1018,category:e.DiagnosticCategory.Error,key:"An_index_signature_parameter_cannot_have_an_accessibility_modifier_1018",message:"An index signature parameter cannot have an accessibility modifier."},An_index_signature_parameter_cannot_have_a_question_mark:{code:1019,category:e.DiagnosticCategory.Error,key:"An_index_signature_parameter_cannot_have_a_question_mark_1019",message:"An index signature parameter cannot have a question mark."},An_index_signature_parameter_cannot_have_an_initializer:{code:1020,category:e.DiagnosticCategory.Error,key:"An_index_signature_parameter_cannot_have_an_initializer_1020",message:"An index signature parameter cannot have an initializer."},An_index_signature_must_have_a_type_annotation:{code:1021,category:e.DiagnosticCategory.Error,key:"An_index_signature_must_have_a_type_annotation_1021",message:"An index signature must have a type annotation."},An_index_signature_parameter_must_have_a_type_annotation:{code:1022,category:e.DiagnosticCategory.Error,key:"An_index_signature_parameter_must_have_a_type_annotation_1022",message:"An index signature parameter must have a type annotation."},An_index_signature_parameter_type_must_be_string_or_number:{code:1023,category:e.DiagnosticCategory.Error,key:"An_index_signature_parameter_type_must_be_string_or_number_1023",message:"An index signature parameter type must be 'string' or 'number'."},Accessibility_modifier_already_seen:{code:1028,category:e.DiagnosticCategory.Error,key:"Accessibility_modifier_already_seen_1028",message:"Accessibility modifier already seen."},_0_modifier_must_precede_1_modifier:{code:1029,category:e.DiagnosticCategory.Error,key:"_0_modifier_must_precede_1_modifier_1029",message:"'{0}' modifier must precede '{1}' modifier."},_0_modifier_already_seen:{code:1030,category:e.DiagnosticCategory.Error,key:"_0_modifier_already_seen_1030",message:"'{0}' modifier already seen."},_0_modifier_cannot_appear_on_a_class_element:{code:1031,category:e.DiagnosticCategory.Error,key:"_0_modifier_cannot_appear_on_a_class_element_1031",message:"'{0}' modifier cannot appear on a class element."},super_must_be_followed_by_an_argument_list_or_member_access:{code:1034,category:e.DiagnosticCategory.Error,key:"super_must_be_followed_by_an_argument_list_or_member_access_1034",message:"'super' must be followed by an argument list or member access."},Only_ambient_modules_can_use_quoted_names:{code:1035,category:e.DiagnosticCategory.Error,key:"Only_ambient_modules_can_use_quoted_names_1035",message:"Only ambient modules can use quoted names."},Statements_are_not_allowed_in_ambient_contexts:{code:1036,category:e.DiagnosticCategory.Error,key:"Statements_are_not_allowed_in_ambient_contexts_1036",message:"Statements are not allowed in ambient contexts."},A_declare_modifier_cannot_be_used_in_an_already_ambient_context:{code:1038,category:e.DiagnosticCategory.Error,key:"A_declare_modifier_cannot_be_used_in_an_already_ambient_context_1038",message:"A 'declare' modifier cannot be used in an already ambient context."},Initializers_are_not_allowed_in_ambient_contexts:{code:1039,category:e.DiagnosticCategory.Error,key:"Initializers_are_not_allowed_in_ambient_contexts_1039",message:"Initializers are not allowed in ambient contexts."},_0_modifier_cannot_be_used_in_an_ambient_context:{code:1040,category:e.DiagnosticCategory.Error,key:"_0_modifier_cannot_be_used_in_an_ambient_context_1040",message:"'{0}' modifier cannot be used in an ambient context."},_0_modifier_cannot_be_used_with_a_class_declaration:{code:1041,category:e.DiagnosticCategory.Error,key:"_0_modifier_cannot_be_used_with_a_class_declaration_1041",message:"'{0}' modifier cannot be used with a class declaration."},_0_modifier_cannot_be_used_here:{code:1042,category:e.DiagnosticCategory.Error,key:"_0_modifier_cannot_be_used_here_1042",message:"'{0}' modifier cannot be used here."},_0_modifier_cannot_appear_on_a_data_property:{code:1043,category:e.DiagnosticCategory.Error,key:"_0_modifier_cannot_appear_on_a_data_property_1043",message:"'{0}' modifier cannot appear on a data property."},_0_modifier_cannot_appear_on_a_module_element:{code:1044,category:e.DiagnosticCategory.Error,key:"_0_modifier_cannot_appear_on_a_module_element_1044",message:"'{0}' modifier cannot appear on a module element."},A_0_modifier_cannot_be_used_with_an_interface_declaration:{code:1045,category:e.DiagnosticCategory.Error,key:"A_0_modifier_cannot_be_used_with_an_interface_declaration_1045",message:"A '{0}' modifier cannot be used with an interface declaration."},A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file:{code:1046,category:e.DiagnosticCategory.Error,key:"A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file_1046",message:"A 'declare' modifier is required for a top level declaration in a .d.ts file."},A_rest_parameter_cannot_be_optional:{code:1047,category:e.DiagnosticCategory.Error,key:"A_rest_parameter_cannot_be_optional_1047",message:"A rest parameter cannot be optional."},A_rest_parameter_cannot_have_an_initializer:{code:1048,category:e.DiagnosticCategory.Error,key:"A_rest_parameter_cannot_have_an_initializer_1048",message:"A rest parameter cannot have an initializer."},A_set_accessor_must_have_exactly_one_parameter:{code:1049,category:e.DiagnosticCategory.Error,key:"A_set_accessor_must_have_exactly_one_parameter_1049",message:"A 'set' accessor must have exactly one parameter."},A_set_accessor_cannot_have_an_optional_parameter:{code:1051,category:e.DiagnosticCategory.Error,key:"A_set_accessor_cannot_have_an_optional_parameter_1051",message:"A 'set' accessor cannot have an optional parameter."},A_set_accessor_parameter_cannot_have_an_initializer:{code:1052,category:e.DiagnosticCategory.Error,key:"A_set_accessor_parameter_cannot_have_an_initializer_1052",message:"A 'set' accessor parameter cannot have an initializer."},A_set_accessor_cannot_have_rest_parameter:{code:1053,category:e.DiagnosticCategory.Error,key:"A_set_accessor_cannot_have_rest_parameter_1053",message:"A 'set' accessor cannot have rest parameter."},A_get_accessor_cannot_have_parameters:{code:1054,category:e.DiagnosticCategory.Error,key:"A_get_accessor_cannot_have_parameters_1054",message:"A 'get' accessor cannot have parameters."},Type_0_is_not_a_valid_async_function_return_type:{code:1055,category:e.DiagnosticCategory.Error,key:"Type_0_is_not_a_valid_async_function_return_type_1055",message:"Type '{0}' is not a valid async function return type."},Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher:{code:1056,category:e.DiagnosticCategory.Error,key:"Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher_1056",message:"Accessors are only available when targeting ECMAScript 5 and higher."},An_async_function_or_method_must_have_a_valid_awaitable_return_type:{code:1057,category:e.DiagnosticCategory.Error,key:"An_async_function_or_method_must_have_a_valid_awaitable_return_type_1057",message:"An async function or method must have a valid awaitable return type."},Operand_for_await_does_not_have_a_valid_callable_then_member:{code:1058,category:e.DiagnosticCategory.Error,key:"Operand_for_await_does_not_have_a_valid_callable_then_member_1058",message:"Operand for 'await' does not have a valid callable 'then' member."},Return_expression_in_async_function_does_not_have_a_valid_callable_then_member:{code:1059,category:e.DiagnosticCategory.Error,key:"Return_expression_in_async_function_does_not_have_a_valid_callable_then_member_1059",message:"Return expression in async function does not have a valid callable 'then' member."},Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member:{code:1060,category:e.DiagnosticCategory.Error,key:"Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member_1060",message:"Expression body for async arrow function does not have a valid callable 'then' member."},Enum_member_must_have_initializer:{code:1061,category:e.DiagnosticCategory.Error,key:"Enum_member_must_have_initializer_1061",message:"Enum member must have initializer."},_0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method:{code:1062,category:e.DiagnosticCategory.Error,key:"_0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062",message:"{0} is referenced directly or indirectly in the fulfillment callback of its own 'then' method."},An_export_assignment_cannot_be_used_in_a_namespace:{code:1063,category:e.DiagnosticCategory.Error,key:"An_export_assignment_cannot_be_used_in_a_namespace_1063",message:"An export assignment cannot be used in a namespace."},The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type:{code:1064,category:e.DiagnosticCategory.Error,key:"The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_1064",message:"The return type of an async function or method must be the global Promise<T> type."},In_ambient_enum_declarations_member_initializer_must_be_constant_expression:{code:1066,category:e.DiagnosticCategory.Error,key:"In_ambient_enum_declarations_member_initializer_must_be_constant_expression_1066",message:"In ambient enum declarations member initializer must be constant expression."},Unexpected_token_A_constructor_method_accessor_or_property_was_expected:{code:1068,category:e.DiagnosticCategory.Error,key:"Unexpected_token_A_constructor_method_accessor_or_property_was_expected_1068",message:"Unexpected token. A constructor, method, accessor, or property was expected."},A_0_modifier_cannot_be_used_with_an_import_declaration:{code:1079,category:e.DiagnosticCategory.Error,key:"A_0_modifier_cannot_be_used_with_an_import_declaration_1079",message:"A '{0}' modifier cannot be used with an import declaration."},Invalid_reference_directive_syntax:{code:1084,category:e.DiagnosticCategory.Error,key:"Invalid_reference_directive_syntax_1084",message:"Invalid 'reference' directive syntax."},Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher:{code:1085,category:e.DiagnosticCategory.Error,key:"Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_1085",message:"Octal literals are not available when targeting ECMAScript 5 and higher."},An_accessor_cannot_be_declared_in_an_ambient_context:{code:1086,category:e.DiagnosticCategory.Error,key:"An_accessor_cannot_be_declared_in_an_ambient_context_1086",message:"An accessor cannot be declared in an ambient context."},_0_modifier_cannot_appear_on_a_constructor_declaration:{code:1089,category:e.DiagnosticCategory.Error,key:"_0_modifier_cannot_appear_on_a_constructor_declaration_1089",message:"'{0}' modifier cannot appear on a constructor declaration."},_0_modifier_cannot_appear_on_a_parameter:{code:1090,category:e.DiagnosticCategory.Error,key:"_0_modifier_cannot_appear_on_a_parameter_1090",message:"'{0}' modifier cannot appear on a parameter."},Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement:{code:1091,category:e.DiagnosticCategory.Error,key:"Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement_1091",message:"Only a single variable declaration is allowed in a 'for...in' statement."},Type_parameters_cannot_appear_on_a_constructor_declaration:{code:1092,category:e.DiagnosticCategory.Error,key:"Type_parameters_cannot_appear_on_a_constructor_declaration_1092",message:"Type parameters cannot appear on a constructor declaration."},Type_annotation_cannot_appear_on_a_constructor_declaration:{code:1093,category:e.DiagnosticCategory.Error,key:"Type_annotation_cannot_appear_on_a_constructor_declaration_1093",message:"Type annotation cannot appear on a constructor declaration."},An_accessor_cannot_have_type_parameters:{code:1094,category:e.DiagnosticCategory.Error,key:"An_accessor_cannot_have_type_parameters_1094",message:"An accessor cannot have type parameters."},A_set_accessor_cannot_have_a_return_type_annotation:{code:1095,category:e.DiagnosticCategory.Error,key:"A_set_accessor_cannot_have_a_return_type_annotation_1095",message:"A 'set' accessor cannot have a return type annotation."},An_index_signature_must_have_exactly_one_parameter:{code:1096,category:e.DiagnosticCategory.Error,key:"An_index_signature_must_have_exactly_one_parameter_1096",message:"An index signature must have exactly one parameter."},_0_list_cannot_be_empty:{code:1097,category:e.DiagnosticCategory.Error,key:"_0_list_cannot_be_empty_1097",message:"'{0}' list cannot be empty."},Type_parameter_list_cannot_be_empty:{code:1098,category:e.DiagnosticCategory.Error,key:"Type_parameter_list_cannot_be_empty_1098",message:"Type parameter list cannot be empty."},Type_argument_list_cannot_be_empty:{code:1099,category:e.DiagnosticCategory.Error,key:"Type_argument_list_cannot_be_empty_1099",message:"Type argument list cannot be empty."},Invalid_use_of_0_in_strict_mode:{code:1100,category:e.DiagnosticCategory.Error,key:"Invalid_use_of_0_in_strict_mode_1100",message:"Invalid use of '{0}' in strict mode."},with_statements_are_not_allowed_in_strict_mode:{code:1101,category:e.DiagnosticCategory.Error,key:"with_statements_are_not_allowed_in_strict_mode_1101",message:"'with' statements are not allowed in strict mode."},delete_cannot_be_called_on_an_identifier_in_strict_mode:{code:1102,category:e.DiagnosticCategory.Error,key:"delete_cannot_be_called_on_an_identifier_in_strict_mode_1102",message:"'delete' cannot be called on an identifier in strict mode."},A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement:{code:1104,category:e.DiagnosticCategory.Error,key:"A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement_1104",message:"A 'continue' statement can only be used within an enclosing iteration statement."},A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement:{code:1105,category:e.DiagnosticCategory.Error,key:"A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement_1105",message:"A 'break' statement can only be used within an enclosing iteration or switch statement."},Jump_target_cannot_cross_function_boundary:{code:1107,category:e.DiagnosticCategory.Error,key:"Jump_target_cannot_cross_function_boundary_1107",message:"Jump target cannot cross function boundary."},A_return_statement_can_only_be_used_within_a_function_body:{code:1108,category:e.DiagnosticCategory.Error,key:"A_return_statement_can_only_be_used_within_a_function_body_1108",message:"A 'return' statement can only be used within a function body."},Expression_expected:{code:1109,category:e.DiagnosticCategory.Error,key:"Expression_expected_1109",message:"Expression expected."},Type_expected:{code:1110,category:e.DiagnosticCategory.Error,key:"Type_expected_1110",message:"Type expected."},A_class_member_cannot_be_declared_optional:{code:1112,category:e.DiagnosticCategory.Error,key:"A_class_member_cannot_be_declared_optional_1112",message:"A class member cannot be declared optional."},A_default_clause_cannot_appear_more_than_once_in_a_switch_statement:{code:1113,category:e.DiagnosticCategory.Error,key:"A_default_clause_cannot_appear_more_than_once_in_a_switch_statement_1113",message:"A 'default' clause cannot appear more than once in a 'switch' statement."},Duplicate_label_0:{code:1114,category:e.DiagnosticCategory.Error,key:"Duplicate_label_0_1114",message:"Duplicate label '{0}'"},A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement:{code:1115,category:e.DiagnosticCategory.Error,key:"A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement_1115",message:"A 'continue' statement can only jump to a label of an enclosing iteration statement."},A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement:{code:1116,category:e.DiagnosticCategory.Error,key:"A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement_1116",message:"A 'break' statement can only jump to a label of an enclosing statement."},An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode:{code:1117,category:e.DiagnosticCategory.Error,key:"An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode_1117",message:"An object literal cannot have multiple properties with the same name in strict mode."},An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name:{code:1118,category:e.DiagnosticCategory.Error,key:"An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name_1118",message:"An object literal cannot have multiple get/set accessors with the same name."},An_object_literal_cannot_have_property_and_accessor_with_the_same_name:{code:1119,category:e.DiagnosticCategory.Error,key:"An_object_literal_cannot_have_property_and_accessor_with_the_same_name_1119",message:"An object literal cannot have property and accessor with the same name."},An_export_assignment_cannot_have_modifiers:{code:1120,category:e.DiagnosticCategory.Error,key:"An_export_assignment_cannot_have_modifiers_1120",message:"An export assignment cannot have modifiers."},Octal_literals_are_not_allowed_in_strict_mode:{code:1121,category:e.DiagnosticCategory.Error,key:"Octal_literals_are_not_allowed_in_strict_mode_1121",message:"Octal literals are not allowed in strict mode."},A_tuple_type_element_list_cannot_be_empty:{code:1122,category:e.DiagnosticCategory.Error,key:"A_tuple_type_element_list_cannot_be_empty_1122",message:"A tuple type element list cannot be empty."},Variable_declaration_list_cannot_be_empty:{code:1123,category:e.DiagnosticCategory.Error,key:"Variable_declaration_list_cannot_be_empty_1123",message:"Variable declaration list cannot be empty."},Digit_expected:{code:1124,category:e.DiagnosticCategory.Error,key:"Digit_expected_1124",message:"Digit expected."},Hexadecimal_digit_expected:{code:1125,category:e.DiagnosticCategory.Error,key:"Hexadecimal_digit_expected_1125",message:"Hexadecimal digit expected."},Unexpected_end_of_text:{code:1126,category:e.DiagnosticCategory.Error,key:"Unexpected_end_of_text_1126",message:"Unexpected end of text."},Invalid_character:{code:1127,category:e.DiagnosticCategory.Error,key:"Invalid_character_1127",message:"Invalid character."},Declaration_or_statement_expected:{code:1128,category:e.DiagnosticCategory.Error,key:"Declaration_or_statement_expected_1128",message:"Declaration or statement expected."},Statement_expected:{code:1129,category:e.DiagnosticCategory.Error,key:"Statement_expected_1129",message:"Statement expected."},case_or_default_expected:{code:1130,category:e.DiagnosticCategory.Error,key:"case_or_default_expected_1130",message:"'case' or 'default' expected."},Property_or_signature_expected:{code:1131,category:e.DiagnosticCategory.Error,key:"Property_or_signature_expected_1131",message:"Property or signature expected."},Enum_member_expected:{code:1132,category:e.DiagnosticCategory.Error,key:"Enum_member_expected_1132",message:"Enum member expected."},Variable_declaration_expected:{code:1134,category:e.DiagnosticCategory.Error,key:"Variable_declaration_expected_1134",
message:"Variable declaration expected."},Argument_expression_expected:{code:1135,category:e.DiagnosticCategory.Error,key:"Argument_expression_expected_1135",message:"Argument expression expected."},Property_assignment_expected:{code:1136,category:e.DiagnosticCategory.Error,key:"Property_assignment_expected_1136",message:"Property assignment expected."},Expression_or_comma_expected:{code:1137,category:e.DiagnosticCategory.Error,key:"Expression_or_comma_expected_1137",message:"Expression or comma expected."},Parameter_declaration_expected:{code:1138,category:e.DiagnosticCategory.Error,key:"Parameter_declaration_expected_1138",message:"Parameter declaration expected."},Type_parameter_declaration_expected:{code:1139,category:e.DiagnosticCategory.Error,key:"Type_parameter_declaration_expected_1139",message:"Type parameter declaration expected."},Type_argument_expected:{code:1140,category:e.DiagnosticCategory.Error,key:"Type_argument_expected_1140",message:"Type argument expected."},String_literal_expected:{code:1141,category:e.DiagnosticCategory.Error,key:"String_literal_expected_1141",message:"String literal expected."},Line_break_not_permitted_here:{code:1142,category:e.DiagnosticCategory.Error,key:"Line_break_not_permitted_here_1142",message:"Line break not permitted here."},or_expected:{code:1144,category:e.DiagnosticCategory.Error,key:"or_expected_1144",message:"'{' or ';' expected."},Modifiers_not_permitted_on_index_signature_members:{code:1145,category:e.DiagnosticCategory.Error,key:"Modifiers_not_permitted_on_index_signature_members_1145",message:"Modifiers not permitted on index signature members."},Declaration_expected:{code:1146,category:e.DiagnosticCategory.Error,key:"Declaration_expected_1146",message:"Declaration expected."},Import_declarations_in_a_namespace_cannot_reference_a_module:{code:1147,category:e.DiagnosticCategory.Error,key:"Import_declarations_in_a_namespace_cannot_reference_a_module_1147",message:"Import declarations in a namespace cannot reference a module."},Cannot_compile_modules_unless_the_module_flag_is_provided_with_a_valid_module_type_Consider_setting_the_module_compiler_option_in_a_tsconfig_json_file:{code:1148,category:e.DiagnosticCategory.Error,key:"Cannot_compile_modules_unless_the_module_flag_is_provided_with_a_valid_module_type_Consider_setting__1148",message:"Cannot compile modules unless the '--module' flag is provided with a valid module type. Consider setting the 'module' compiler option in a 'tsconfig.json' file."},File_name_0_differs_from_already_included_file_name_1_only_in_casing:{code:1149,category:e.DiagnosticCategory.Error,key:"File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149",message:"File name '{0}' differs from already included file name '{1}' only in casing"},new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead:{code:1150,category:e.DiagnosticCategory.Error,key:"new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead_1150",message:"'new T[]' cannot be used to create an array. Use 'new Array<T>()' instead."},const_declarations_must_be_initialized:{code:1155,category:e.DiagnosticCategory.Error,key:"const_declarations_must_be_initialized_1155",message:"'const' declarations must be initialized"},const_declarations_can_only_be_declared_inside_a_block:{code:1156,category:e.DiagnosticCategory.Error,key:"const_declarations_can_only_be_declared_inside_a_block_1156",message:"'const' declarations can only be declared inside a block."},let_declarations_can_only_be_declared_inside_a_block:{code:1157,category:e.DiagnosticCategory.Error,key:"let_declarations_can_only_be_declared_inside_a_block_1157",message:"'let' declarations can only be declared inside a block."},Unterminated_template_literal:{code:1160,category:e.DiagnosticCategory.Error,key:"Unterminated_template_literal_1160",message:"Unterminated template literal."},Unterminated_regular_expression_literal:{code:1161,category:e.DiagnosticCategory.Error,key:"Unterminated_regular_expression_literal_1161",message:"Unterminated regular expression literal."},An_object_member_cannot_be_declared_optional:{code:1162,category:e.DiagnosticCategory.Error,key:"An_object_member_cannot_be_declared_optional_1162",message:"An object member cannot be declared optional."},A_yield_expression_is_only_allowed_in_a_generator_body:{code:1163,category:e.DiagnosticCategory.Error,key:"A_yield_expression_is_only_allowed_in_a_generator_body_1163",message:"A 'yield' expression is only allowed in a generator body."},Computed_property_names_are_not_allowed_in_enums:{code:1164,category:e.DiagnosticCategory.Error,key:"Computed_property_names_are_not_allowed_in_enums_1164",message:"Computed property names are not allowed in enums."},A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol:{code:1165,category:e.DiagnosticCategory.Error,key:"A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol_1165",message:"A computed property name in an ambient context must directly refer to a built-in symbol."},A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol:{code:1166,category:e.DiagnosticCategory.Error,key:"A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol_1166",message:"A computed property name in a class property declaration must directly refer to a built-in symbol."},A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol:{code:1168,category:e.DiagnosticCategory.Error,key:"A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol_1168",message:"A computed property name in a method overload must directly refer to a built-in symbol."},A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol:{code:1169,category:e.DiagnosticCategory.Error,key:"A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol_1169",message:"A computed property name in an interface must directly refer to a built-in symbol."},A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol:{code:1170,category:e.DiagnosticCategory.Error,key:"A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol_1170",message:"A computed property name in a type literal must directly refer to a built-in symbol."},A_comma_expression_is_not_allowed_in_a_computed_property_name:{code:1171,category:e.DiagnosticCategory.Error,key:"A_comma_expression_is_not_allowed_in_a_computed_property_name_1171",message:"A comma expression is not allowed in a computed property name."},extends_clause_already_seen:{code:1172,category:e.DiagnosticCategory.Error,key:"extends_clause_already_seen_1172",message:"'extends' clause already seen."},extends_clause_must_precede_implements_clause:{code:1173,category:e.DiagnosticCategory.Error,key:"extends_clause_must_precede_implements_clause_1173",message:"'extends' clause must precede 'implements' clause."},Classes_can_only_extend_a_single_class:{code:1174,category:e.DiagnosticCategory.Error,key:"Classes_can_only_extend_a_single_class_1174",message:"Classes can only extend a single class."},implements_clause_already_seen:{code:1175,category:e.DiagnosticCategory.Error,key:"implements_clause_already_seen_1175",message:"'implements' clause already seen."},Interface_declaration_cannot_have_implements_clause:{code:1176,category:e.DiagnosticCategory.Error,key:"Interface_declaration_cannot_have_implements_clause_1176",message:"Interface declaration cannot have 'implements' clause."},Binary_digit_expected:{code:1177,category:e.DiagnosticCategory.Error,key:"Binary_digit_expected_1177",message:"Binary digit expected."},Octal_digit_expected:{code:1178,category:e.DiagnosticCategory.Error,key:"Octal_digit_expected_1178",message:"Octal digit expected."},Unexpected_token_expected:{code:1179,category:e.DiagnosticCategory.Error,key:"Unexpected_token_expected_1179",message:"Unexpected token. '{' expected."},Property_destructuring_pattern_expected:{code:1180,category:e.DiagnosticCategory.Error,key:"Property_destructuring_pattern_expected_1180",message:"Property destructuring pattern expected."},Array_element_destructuring_pattern_expected:{code:1181,category:e.DiagnosticCategory.Error,key:"Array_element_destructuring_pattern_expected_1181",message:"Array element destructuring pattern expected."},A_destructuring_declaration_must_have_an_initializer:{code:1182,category:e.DiagnosticCategory.Error,key:"A_destructuring_declaration_must_have_an_initializer_1182",message:"A destructuring declaration must have an initializer."},An_implementation_cannot_be_declared_in_ambient_contexts:{code:1183,category:e.DiagnosticCategory.Error,key:"An_implementation_cannot_be_declared_in_ambient_contexts_1183",message:"An implementation cannot be declared in ambient contexts."},Modifiers_cannot_appear_here:{code:1184,category:e.DiagnosticCategory.Error,key:"Modifiers_cannot_appear_here_1184",message:"Modifiers cannot appear here."},Merge_conflict_marker_encountered:{code:1185,category:e.DiagnosticCategory.Error,key:"Merge_conflict_marker_encountered_1185",message:"Merge conflict marker encountered."},A_rest_element_cannot_have_an_initializer:{code:1186,category:e.DiagnosticCategory.Error,key:"A_rest_element_cannot_have_an_initializer_1186",message:"A rest element cannot have an initializer."},A_parameter_property_may_not_be_a_binding_pattern:{code:1187,category:e.DiagnosticCategory.Error,key:"A_parameter_property_may_not_be_a_binding_pattern_1187",message:"A parameter property may not be a binding pattern."},Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement:{code:1188,category:e.DiagnosticCategory.Error,key:"Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement_1188",message:"Only a single variable declaration is allowed in a 'for...of' statement."},The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer:{code:1189,category:e.DiagnosticCategory.Error,key:"The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189",message:"The variable declaration of a 'for...in' statement cannot have an initializer."},The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer:{code:1190,category:e.DiagnosticCategory.Error,key:"The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190",message:"The variable declaration of a 'for...of' statement cannot have an initializer."},An_import_declaration_cannot_have_modifiers:{code:1191,category:e.DiagnosticCategory.Error,key:"An_import_declaration_cannot_have_modifiers_1191",message:"An import declaration cannot have modifiers."},Module_0_has_no_default_export:{code:1192,category:e.DiagnosticCategory.Error,key:"Module_0_has_no_default_export_1192",message:"Module '{0}' has no default export."},An_export_declaration_cannot_have_modifiers:{code:1193,category:e.DiagnosticCategory.Error,key:"An_export_declaration_cannot_have_modifiers_1193",message:"An export declaration cannot have modifiers."},Export_declarations_are_not_permitted_in_a_namespace:{code:1194,category:e.DiagnosticCategory.Error,key:"Export_declarations_are_not_permitted_in_a_namespace_1194",message:"Export declarations are not permitted in a namespace."},Catch_clause_variable_name_must_be_an_identifier:{code:1195,category:e.DiagnosticCategory.Error,key:"Catch_clause_variable_name_must_be_an_identifier_1195",message:"Catch clause variable name must be an identifier."},Catch_clause_variable_cannot_have_a_type_annotation:{code:1196,category:e.DiagnosticCategory.Error,key:"Catch_clause_variable_cannot_have_a_type_annotation_1196",message:"Catch clause variable cannot have a type annotation."},Catch_clause_variable_cannot_have_an_initializer:{code:1197,category:e.DiagnosticCategory.Error,key:"Catch_clause_variable_cannot_have_an_initializer_1197",message:"Catch clause variable cannot have an initializer."},An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive:{code:1198,category:e.DiagnosticCategory.Error,key:"An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive_1198",message:"An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive."},Unterminated_Unicode_escape_sequence:{code:1199,category:e.DiagnosticCategory.Error,key:"Unterminated_Unicode_escape_sequence_1199",message:"Unterminated Unicode escape sequence."},Line_terminator_not_permitted_before_arrow:{code:1200,category:e.DiagnosticCategory.Error,key:"Line_terminator_not_permitted_before_arrow_1200",message:"Line terminator not permitted before arrow."},Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead:{code:1202,category:e.DiagnosticCategory.Error,key:"Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_import_Asterisk__1202",message:"Import assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"', 'import d from \"mod\"', or another module format instead."},Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_export_default_or_another_module_format_instead:{code:1203,category:e.DiagnosticCategory.Error,key:"Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_export_default_o_1203",message:"Export assignment cannot be used when targeting ECMAScript 6 modules. Consider using 'export default' or another module format instead."},Cannot_compile_modules_into_es2015_when_targeting_ES5_or_lower:{code:1204,category:e.DiagnosticCategory.Error,key:"Cannot_compile_modules_into_es2015_when_targeting_ES5_or_lower_1204",message:"Cannot compile modules into 'es2015' when targeting 'ES5' or lower."},Decorators_are_not_valid_here:{code:1206,category:e.DiagnosticCategory.Error,key:"Decorators_are_not_valid_here_1206",message:"Decorators are not valid here."},Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name:{code:1207,category:e.DiagnosticCategory.Error,key:"Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207",message:"Decorators cannot be applied to multiple get/set accessors of the same name."},Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided:{code:1208,category:e.DiagnosticCategory.Error,key:"Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided_1208",message:"Cannot compile namespaces when the '--isolatedModules' flag is provided."},Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided:{code:1209,category:e.DiagnosticCategory.Error,key:"Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided_1209",message:"Ambient const enums are not allowed when the '--isolatedModules' flag is provided."},Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode:{code:1210,category:e.DiagnosticCategory.Error,key:"Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode_1210",message:"Invalid use of '{0}'. Class definitions are automatically in strict mode."},A_class_declaration_without_the_default_modifier_must_have_a_name:{code:1211,category:e.DiagnosticCategory.Error,key:"A_class_declaration_without_the_default_modifier_must_have_a_name_1211",message:"A class declaration without the 'default' modifier must have a name"},Identifier_expected_0_is_a_reserved_word_in_strict_mode:{code:1212,category:e.DiagnosticCategory.Error,key:"Identifier_expected_0_is_a_reserved_word_in_strict_mode_1212",message:"Identifier expected. '{0}' is a reserved word in strict mode"},Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode:{code:1213,category:e.DiagnosticCategory.Error,key:"Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_stric_1213",message:"Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode."},Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode:{code:1214,category:e.DiagnosticCategory.Error,key:"Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode_1214",message:"Identifier expected. '{0}' is a reserved word in strict mode. Modules are automatically in strict mode."},Invalid_use_of_0_Modules_are_automatically_in_strict_mode:{code:1215,category:e.DiagnosticCategory.Error,key:"Invalid_use_of_0_Modules_are_automatically_in_strict_mode_1215",message:"Invalid use of '{0}'. Modules are automatically in strict mode."},Export_assignment_is_not_supported_when_module_flag_is_system:{code:1218,category:e.DiagnosticCategory.Error,key:"Export_assignment_is_not_supported_when_module_flag_is_system_1218",message:"Export assignment is not supported when '--module' flag is 'system'."},Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning:{code:1219,category:e.DiagnosticCategory.Error,key:"Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219",message:"Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning."},Generators_are_only_available_when_targeting_ECMAScript_6_or_higher:{code:1220,category:e.DiagnosticCategory.Error,key:"Generators_are_only_available_when_targeting_ECMAScript_6_or_higher_1220",message:"Generators are only available when targeting ECMAScript 6 or higher."},Generators_are_not_allowed_in_an_ambient_context:{code:1221,category:e.DiagnosticCategory.Error,key:"Generators_are_not_allowed_in_an_ambient_context_1221",message:"Generators are not allowed in an ambient context."},An_overload_signature_cannot_be_declared_as_a_generator:{code:1222,category:e.DiagnosticCategory.Error,key:"An_overload_signature_cannot_be_declared_as_a_generator_1222",message:"An overload signature cannot be declared as a generator."},_0_tag_already_specified:{code:1223,category:e.DiagnosticCategory.Error,key:"_0_tag_already_specified_1223",message:"'{0}' tag already specified."},Signature_0_must_have_a_type_predicate:{code:1224,category:e.DiagnosticCategory.Error,key:"Signature_0_must_have_a_type_predicate_1224",message:"Signature '{0}' must have a type predicate."},Cannot_find_parameter_0:{code:1225,category:e.DiagnosticCategory.Error,key:"Cannot_find_parameter_0_1225",message:"Cannot find parameter '{0}'."},Type_predicate_0_is_not_assignable_to_1:{code:1226,category:e.DiagnosticCategory.Error,key:"Type_predicate_0_is_not_assignable_to_1_1226",message:"Type predicate '{0}' is not assignable to '{1}'."},Parameter_0_is_not_in_the_same_position_as_parameter_1:{code:1227,category:e.DiagnosticCategory.Error,key:"Parameter_0_is_not_in_the_same_position_as_parameter_1_1227",message:"Parameter '{0}' is not in the same position as parameter '{1}'."},A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods:{code:1228,category:e.DiagnosticCategory.Error,key:"A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods_1228",message:"A type predicate is only allowed in return type position for functions and methods."},A_type_predicate_cannot_reference_a_rest_parameter:{code:1229,category:e.DiagnosticCategory.Error,key:"A_type_predicate_cannot_reference_a_rest_parameter_1229",message:"A type predicate cannot reference a rest parameter."},A_type_predicate_cannot_reference_element_0_in_a_binding_pattern:{code:1230,category:e.DiagnosticCategory.Error,key:"A_type_predicate_cannot_reference_element_0_in_a_binding_pattern_1230",message:"A type predicate cannot reference element '{0}' in a binding pattern."},An_export_assignment_can_only_be_used_in_a_module:{code:1231,category:e.DiagnosticCategory.Error,key:"An_export_assignment_can_only_be_used_in_a_module_1231",message:"An export assignment can only be used in a module."},An_import_declaration_can_only_be_used_in_a_namespace_or_module:{code:1232,category:e.DiagnosticCategory.Error,key:"An_import_declaration_can_only_be_used_in_a_namespace_or_module_1232",message:"An import declaration can only be used in a namespace or module."},An_export_declaration_can_only_be_used_in_a_module:{code:1233,category:e.DiagnosticCategory.Error,key:"An_export_declaration_can_only_be_used_in_a_module_1233",message:"An export declaration can only be used in a module."},An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file:{code:1234,category:e.DiagnosticCategory.Error,key:"An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234",message:"An ambient module declaration is only allowed at the top level in a file."},A_namespace_declaration_is_only_allowed_in_a_namespace_or_module:{code:1235,category:e.DiagnosticCategory.Error,key:"A_namespace_declaration_is_only_allowed_in_a_namespace_or_module_1235",message:"A namespace declaration is only allowed in a namespace or module."},The_return_type_of_a_property_decorator_function_must_be_either_void_or_any:{code:1236,category:e.DiagnosticCategory.Error,key:"The_return_type_of_a_property_decorator_function_must_be_either_void_or_any_1236",message:"The return type of a property decorator function must be either 'void' or 'any'."},The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any:{code:1237,category:e.DiagnosticCategory.Error,key:"The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any_1237",message:"The return type of a parameter decorator function must be either 'void' or 'any'."},Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression:{code:1238,category:e.DiagnosticCategory.Error,key:"Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression_1238",message:"Unable to resolve signature of class decorator when called as an expression."},Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression:{code:1239,category:e.DiagnosticCategory.Error,key:"Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression_1239",message:"Unable to resolve signature of parameter decorator when called as an expression."},Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression:{code:1240,category:e.DiagnosticCategory.Error,key:"Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression_1240",message:"Unable to resolve signature of property decorator when called as an expression."},Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression:{code:1241,category:e.DiagnosticCategory.Error,key:"Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression_1241",message:"Unable to resolve signature of method decorator when called as an expression."},abstract_modifier_can_only_appear_on_a_class_or_method_declaration:{code:1242,category:e.DiagnosticCategory.Error,key:"abstract_modifier_can_only_appear_on_a_class_or_method_declaration_1242",message:"'abstract' modifier can only appear on a class or method declaration."},_0_modifier_cannot_be_used_with_1_modifier:{code:1243,category:e.DiagnosticCategory.Error,key:"_0_modifier_cannot_be_used_with_1_modifier_1243",message:"'{0}' modifier cannot be used with '{1}' modifier."},Abstract_methods_can_only_appear_within_an_abstract_class:{code:1244,category:e.DiagnosticCategory.Error,key:"Abstract_methods_can_only_appear_within_an_abstract_class_1244",message:"Abstract methods can only appear within an abstract class."},Method_0_cannot_have_an_implementation_because_it_is_marked_abstract:{code:1245,category:e.DiagnosticCategory.Error,key:"Method_0_cannot_have_an_implementation_because_it_is_marked_abstract_1245",message:"Method '{0}' cannot have an implementation because it is marked abstract."},An_interface_property_cannot_have_an_initializer:{code:1246,category:e.DiagnosticCategory.Error,key:"An_interface_property_cannot_have_an_initializer_1246",message:"An interface property cannot have an initializer."},A_type_literal_property_cannot_have_an_initializer:{code:1247,category:e.DiagnosticCategory.Error,key:"A_type_literal_property_cannot_have_an_initializer_1247",message:"A type literal property cannot have an initializer."},A_class_member_cannot_have_the_0_keyword:{code:1248,category:e.DiagnosticCategory.Error,key:"A_class_member_cannot_have_the_0_keyword_1248",message:"A class member cannot have the '{0}' keyword."},A_decorator_can_only_decorate_a_method_implementation_not_an_overload:{code:1249,category:e.DiagnosticCategory.Error,key:"A_decorator_can_only_decorate_a_method_implementation_not_an_overload_1249",message:"A decorator can only decorate a method implementation, not an overload."},with_statements_are_not_allowed_in_an_async_function_block:{code:1300,category:e.DiagnosticCategory.Error,key:"with_statements_are_not_allowed_in_an_async_function_block_1300",message:"'with' statements are not allowed in an async function block."},await_expression_is_only_allowed_within_an_async_function:{code:1308,category:e.DiagnosticCategory.Error,key:"await_expression_is_only_allowed_within_an_async_function_1308",message:"'await' expression is only allowed within an async function."},Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher:{code:1311,category:e.DiagnosticCategory.Error,key:"Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher_1311",message:"Async functions are only available when targeting ECMAScript 6 and higher."},can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment:{code:1312,category:e.DiagnosticCategory.Error,key:"can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment_1312",message:"'=' can only be used in an object literal property inside a destructuring assignment."},The_body_of_an_if_statement_cannot_be_the_empty_statement:{code:1313,category:e.DiagnosticCategory.Error,key:"The_body_of_an_if_statement_cannot_be_the_empty_statement_1313",message:"The body of an 'if' statement cannot be the empty statement."},Duplicate_identifier_0:{code:2300,category:e.DiagnosticCategory.Error,key:"Duplicate_identifier_0_2300",message:"Duplicate identifier '{0}'."},Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor:{code:2301,category:e.DiagnosticCategory.Error,key:"Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301",message:"Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."},Static_members_cannot_reference_class_type_parameters:{code:2302,category:e.DiagnosticCategory.Error,key:"Static_members_cannot_reference_class_type_parameters_2302",message:"Static members cannot reference class type parameters."},Circular_definition_of_import_alias_0:{code:2303,category:e.DiagnosticCategory.Error,key:"Circular_definition_of_import_alias_0_2303",message:"Circular definition of import alias '{0}'."},Cannot_find_name_0:{code:2304,category:e.DiagnosticCategory.Error,key:"Cannot_find_name_0_2304",message:"Cannot find name '{0}'."},Module_0_has_no_exported_member_1:{code:2305,category:e.DiagnosticCategory.Error,key:"Module_0_has_no_exported_member_1_2305",message:"Module '{0}' has no exported member '{1}'."},File_0_is_not_a_module:{code:2306,category:e.DiagnosticCategory.Error,key:"File_0_is_not_a_module_2306",message:"File '{0}' is not a module."},Cannot_find_module_0:{code:2307,category:e.DiagnosticCategory.Error,key:"Cannot_find_module_0_2307",message:"Cannot find module '{0}'."},Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity:{code:2308,category:e.DiagnosticCategory.Error,key:"Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308",message:"Module {0} has already exported a member named '{1}'. Consider explicitly re-exporting to resolve the ambiguity."},An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements:{code:2309,category:e.DiagnosticCategory.Error,key:"An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements_2309",message:"An export assignment cannot be used in a module with other exported elements."},Type_0_recursively_references_itself_as_a_base_type:{code:2310,category:e.DiagnosticCategory.Error,key:"Type_0_recursively_references_itself_as_a_base_type_2310",message:"Type '{0}' recursively references itself as a base type."},A_class_may_only_extend_another_class:{code:2311,category:e.DiagnosticCategory.Error,key:"A_class_may_only_extend_another_class_2311",message:"A class may only extend another class."},An_interface_may_only_extend_a_class_or_another_interface:{code:2312,category:e.DiagnosticCategory.Error,key:"An_interface_may_only_extend_a_class_or_another_interface_2312",message:"An interface may only extend a class or another interface."},Type_parameter_0_has_a_circular_constraint:{code:2313,category:e.DiagnosticCategory.Error,key:"Type_parameter_0_has_a_circular_constraint_2313",message:"Type parameter '{0}' has a circular constraint."},Generic_type_0_requires_1_type_argument_s:{code:2314,category:e.DiagnosticCategory.Error,key:"Generic_type_0_requires_1_type_argument_s_2314",message:"Generic type '{0}' requires {1} type argument(s)."},Type_0_is_not_generic:{code:2315,category:e.DiagnosticCategory.Error,key:"Type_0_is_not_generic_2315",message:"Type '{0}' is not generic."},Global_type_0_must_be_a_class_or_interface_type:{code:2316,category:e.DiagnosticCategory.Error,key:"Global_type_0_must_be_a_class_or_interface_type_2316",message:"Global type '{0}' must be a class or interface type."},Global_type_0_must_have_1_type_parameter_s:{code:2317,category:e.DiagnosticCategory.Error,key:"Global_type_0_must_have_1_type_parameter_s_2317",message:"Global type '{0}' must have {1} type parameter(s)."},Cannot_find_global_type_0:{code:2318,category:e.DiagnosticCategory.Error,key:"Cannot_find_global_type_0_2318",message:"Cannot find global type '{0}'."},Named_property_0_of_types_1_and_2_are_not_identical:{code:2319,category:e.DiagnosticCategory.Error,key:"Named_property_0_of_types_1_and_2_are_not_identical_2319",message:"Named property '{0}' of types '{1}' and '{2}' are not identical."},Interface_0_cannot_simultaneously_extend_types_1_and_2:{code:2320,category:e.DiagnosticCategory.Error,key:"Interface_0_cannot_simultaneously_extend_types_1_and_2_2320",message:"Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'."},Excessive_stack_depth_comparing_types_0_and_1:{code:2321,category:e.DiagnosticCategory.Error,key:"Excessive_stack_depth_comparing_types_0_and_1_2321",message:"Excessive stack depth comparing types '{0}' and '{1}'."},Type_0_is_not_assignable_to_type_1:{code:2322,category:e.DiagnosticCategory.Error,key:"Type_0_is_not_assignable_to_type_1_2322",message:"Type '{0}' is not assignable to type '{1}'."},Cannot_redeclare_exported_variable_0:{code:2323,category:e.DiagnosticCategory.Error,key:"Cannot_redeclare_exported_variable_0_2323",message:"Cannot redeclare exported variable '{0}'."},Property_0_is_missing_in_type_1:{code:2324,category:e.DiagnosticCategory.Error,key:"Property_0_is_missing_in_type_1_2324",message:"Property '{0}' is missing in type '{1}'."},Property_0_is_private_in_type_1_but_not_in_type_2:{code:2325,category:e.DiagnosticCategory.Error,key:"Property_0_is_private_in_type_1_but_not_in_type_2_2325",message:"Property '{0}' is private in type '{1}' but not in type '{2}'."},Types_of_property_0_are_incompatible:{code:2326,category:e.DiagnosticCategory.Error,key:"Types_of_property_0_are_incompatible_2326",message:"Types of property '{0}' are incompatible."},Property_0_is_optional_in_type_1_but_required_in_type_2:{
code:2327,category:e.DiagnosticCategory.Error,key:"Property_0_is_optional_in_type_1_but_required_in_type_2_2327",message:"Property '{0}' is optional in type '{1}' but required in type '{2}'."},Types_of_parameters_0_and_1_are_incompatible:{code:2328,category:e.DiagnosticCategory.Error,key:"Types_of_parameters_0_and_1_are_incompatible_2328",message:"Types of parameters '{0}' and '{1}' are incompatible."},Index_signature_is_missing_in_type_0:{code:2329,category:e.DiagnosticCategory.Error,key:"Index_signature_is_missing_in_type_0_2329",message:"Index signature is missing in type '{0}'."},Index_signatures_are_incompatible:{code:2330,category:e.DiagnosticCategory.Error,key:"Index_signatures_are_incompatible_2330",message:"Index signatures are incompatible."},this_cannot_be_referenced_in_a_module_or_namespace_body:{code:2331,category:e.DiagnosticCategory.Error,key:"this_cannot_be_referenced_in_a_module_or_namespace_body_2331",message:"'this' cannot be referenced in a module or namespace body."},this_cannot_be_referenced_in_current_location:{code:2332,category:e.DiagnosticCategory.Error,key:"this_cannot_be_referenced_in_current_location_2332",message:"'this' cannot be referenced in current location."},this_cannot_be_referenced_in_constructor_arguments:{code:2333,category:e.DiagnosticCategory.Error,key:"this_cannot_be_referenced_in_constructor_arguments_2333",message:"'this' cannot be referenced in constructor arguments."},this_cannot_be_referenced_in_a_static_property_initializer:{code:2334,category:e.DiagnosticCategory.Error,key:"this_cannot_be_referenced_in_a_static_property_initializer_2334",message:"'this' cannot be referenced in a static property initializer."},super_can_only_be_referenced_in_a_derived_class:{code:2335,category:e.DiagnosticCategory.Error,key:"super_can_only_be_referenced_in_a_derived_class_2335",message:"'super' can only be referenced in a derived class."},super_cannot_be_referenced_in_constructor_arguments:{code:2336,category:e.DiagnosticCategory.Error,key:"super_cannot_be_referenced_in_constructor_arguments_2336",message:"'super' cannot be referenced in constructor arguments."},Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors:{code:2337,category:e.DiagnosticCategory.Error,key:"Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors_2337",message:"Super calls are not permitted outside constructors or in nested functions inside constructors."},super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class:{code:2338,category:e.DiagnosticCategory.Error,key:"super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_der_2338",message:"'super' property access is permitted only in a constructor, member function, or member accessor of a derived class."},Property_0_does_not_exist_on_type_1:{code:2339,category:e.DiagnosticCategory.Error,key:"Property_0_does_not_exist_on_type_1_2339",message:"Property '{0}' does not exist on type '{1}'."},Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword:{code:2340,category:e.DiagnosticCategory.Error,key:"Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340",message:"Only public and protected methods of the base class are accessible via the 'super' keyword."},Property_0_is_private_and_only_accessible_within_class_1:{code:2341,category:e.DiagnosticCategory.Error,key:"Property_0_is_private_and_only_accessible_within_class_1_2341",message:"Property '{0}' is private and only accessible within class '{1}'."},An_index_expression_argument_must_be_of_type_string_number_symbol_or_any:{code:2342,category:e.DiagnosticCategory.Error,key:"An_index_expression_argument_must_be_of_type_string_number_symbol_or_any_2342",message:"An index expression argument must be of type 'string', 'number', 'symbol', or 'any'."},Type_0_does_not_satisfy_the_constraint_1:{code:2344,category:e.DiagnosticCategory.Error,key:"Type_0_does_not_satisfy_the_constraint_1_2344",message:"Type '{0}' does not satisfy the constraint '{1}'."},Argument_of_type_0_is_not_assignable_to_parameter_of_type_1:{code:2345,category:e.DiagnosticCategory.Error,key:"Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_2345",message:"Argument of type '{0}' is not assignable to parameter of type '{1}'."},Supplied_parameters_do_not_match_any_signature_of_call_target:{code:2346,category:e.DiagnosticCategory.Error,key:"Supplied_parameters_do_not_match_any_signature_of_call_target_2346",message:"Supplied parameters do not match any signature of call target."},Untyped_function_calls_may_not_accept_type_arguments:{code:2347,category:e.DiagnosticCategory.Error,key:"Untyped_function_calls_may_not_accept_type_arguments_2347",message:"Untyped function calls may not accept type arguments."},Value_of_type_0_is_not_callable_Did_you_mean_to_include_new:{code:2348,category:e.DiagnosticCategory.Error,key:"Value_of_type_0_is_not_callable_Did_you_mean_to_include_new_2348",message:"Value of type '{0}' is not callable. Did you mean to include 'new'?"},Cannot_invoke_an_expression_whose_type_lacks_a_call_signature:{code:2349,category:e.DiagnosticCategory.Error,key:"Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_2349",message:"Cannot invoke an expression whose type lacks a call signature."},Only_a_void_function_can_be_called_with_the_new_keyword:{code:2350,category:e.DiagnosticCategory.Error,key:"Only_a_void_function_can_be_called_with_the_new_keyword_2350",message:"Only a void function can be called with the 'new' keyword."},Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature:{code:2351,category:e.DiagnosticCategory.Error,key:"Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature_2351",message:"Cannot use 'new' with an expression whose type lacks a call or construct signature."},Neither_type_0_nor_type_1_is_assignable_to_the_other:{code:2352,category:e.DiagnosticCategory.Error,key:"Neither_type_0_nor_type_1_is_assignable_to_the_other_2352",message:"Neither type '{0}' nor type '{1}' is assignable to the other."},Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1:{code:2353,category:e.DiagnosticCategory.Error,key:"Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353",message:"Object literal may only specify known properties, and '{0}' does not exist in type '{1}'."},No_best_common_type_exists_among_return_expressions:{code:2354,category:e.DiagnosticCategory.Error,key:"No_best_common_type_exists_among_return_expressions_2354",message:"No best common type exists among return expressions."},A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value:{code:2355,category:e.DiagnosticCategory.Error,key:"A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355",message:"A function whose declared type is neither 'void' nor 'any' must return a value."},An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type:{code:2356,category:e.DiagnosticCategory.Error,key:"An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type_2356",message:"An arithmetic operand must be of type 'any', 'number' or an enum type."},The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer:{code:2357,category:e.DiagnosticCategory.Error,key:"The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer_2357",message:"The operand of an increment or decrement operator must be a variable, property or indexer."},The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter:{code:2358,category:e.DiagnosticCategory.Error,key:"The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358",message:"The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter."},The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type:{code:2359,category:e.DiagnosticCategory.Error,key:"The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359",message:"The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type."},The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol:{code:2360,category:e.DiagnosticCategory.Error,key:"The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol_2360",message:"The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'."},The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter:{code:2361,category:e.DiagnosticCategory.Error,key:"The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter_2361",message:"The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter"},The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type:{code:2362,category:e.DiagnosticCategory.Error,key:"The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2362",message:"The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type."},The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type:{code:2363,category:e.DiagnosticCategory.Error,key:"The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2363",message:"The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type."},Invalid_left_hand_side_of_assignment_expression:{code:2364,category:e.DiagnosticCategory.Error,key:"Invalid_left_hand_side_of_assignment_expression_2364",message:"Invalid left-hand side of assignment expression."},Operator_0_cannot_be_applied_to_types_1_and_2:{code:2365,category:e.DiagnosticCategory.Error,key:"Operator_0_cannot_be_applied_to_types_1_and_2_2365",message:"Operator '{0}' cannot be applied to types '{1}' and '{2}'."},Type_parameter_name_cannot_be_0:{code:2368,category:e.DiagnosticCategory.Error,key:"Type_parameter_name_cannot_be_0_2368",message:"Type parameter name cannot be '{0}'"},A_parameter_property_is_only_allowed_in_a_constructor_implementation:{code:2369,category:e.DiagnosticCategory.Error,key:"A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369",message:"A parameter property is only allowed in a constructor implementation."},A_rest_parameter_must_be_of_an_array_type:{code:2370,category:e.DiagnosticCategory.Error,key:"A_rest_parameter_must_be_of_an_array_type_2370",message:"A rest parameter must be of an array type."},A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation:{code:2371,category:e.DiagnosticCategory.Error,key:"A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation_2371",message:"A parameter initializer is only allowed in a function or constructor implementation."},Parameter_0_cannot_be_referenced_in_its_initializer:{code:2372,category:e.DiagnosticCategory.Error,key:"Parameter_0_cannot_be_referenced_in_its_initializer_2372",message:"Parameter '{0}' cannot be referenced in its initializer."},Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it:{code:2373,category:e.DiagnosticCategory.Error,key:"Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it_2373",message:"Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it."},Duplicate_string_index_signature:{code:2374,category:e.DiagnosticCategory.Error,key:"Duplicate_string_index_signature_2374",message:"Duplicate string index signature."},Duplicate_number_index_signature:{code:2375,category:e.DiagnosticCategory.Error,key:"Duplicate_number_index_signature_2375",message:"Duplicate number index signature."},A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties:{code:2376,category:e.DiagnosticCategory.Error,key:"A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_proper_2376",message:"A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties."},Constructors_for_derived_classes_must_contain_a_super_call:{code:2377,category:e.DiagnosticCategory.Error,key:"Constructors_for_derived_classes_must_contain_a_super_call_2377",message:"Constructors for derived classes must contain a 'super' call."},A_get_accessor_must_return_a_value:{code:2378,category:e.DiagnosticCategory.Error,key:"A_get_accessor_must_return_a_value_2378",message:"A 'get' accessor must return a value."},Getter_and_setter_accessors_do_not_agree_in_visibility:{code:2379,category:e.DiagnosticCategory.Error,key:"Getter_and_setter_accessors_do_not_agree_in_visibility_2379",message:"Getter and setter accessors do not agree in visibility."},get_and_set_accessor_must_have_the_same_type:{code:2380,category:e.DiagnosticCategory.Error,key:"get_and_set_accessor_must_have_the_same_type_2380",message:"'get' and 'set' accessor must have the same type."},A_signature_with_an_implementation_cannot_use_a_string_literal_type:{code:2381,category:e.DiagnosticCategory.Error,key:"A_signature_with_an_implementation_cannot_use_a_string_literal_type_2381",message:"A signature with an implementation cannot use a string literal type."},Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature:{code:2382,category:e.DiagnosticCategory.Error,key:"Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature_2382",message:"Specialized overload signature is not assignable to any non-specialized signature."},Overload_signatures_must_all_be_exported_or_not_exported:{code:2383,category:e.DiagnosticCategory.Error,key:"Overload_signatures_must_all_be_exported_or_not_exported_2383",message:"Overload signatures must all be exported or not exported."},Overload_signatures_must_all_be_ambient_or_non_ambient:{code:2384,category:e.DiagnosticCategory.Error,key:"Overload_signatures_must_all_be_ambient_or_non_ambient_2384",message:"Overload signatures must all be ambient or non-ambient."},Overload_signatures_must_all_be_public_private_or_protected:{code:2385,category:e.DiagnosticCategory.Error,key:"Overload_signatures_must_all_be_public_private_or_protected_2385",message:"Overload signatures must all be public, private or protected."},Overload_signatures_must_all_be_optional_or_required:{code:2386,category:e.DiagnosticCategory.Error,key:"Overload_signatures_must_all_be_optional_or_required_2386",message:"Overload signatures must all be optional or required."},Function_overload_must_be_static:{code:2387,category:e.DiagnosticCategory.Error,key:"Function_overload_must_be_static_2387",message:"Function overload must be static."},Function_overload_must_not_be_static:{code:2388,category:e.DiagnosticCategory.Error,key:"Function_overload_must_not_be_static_2388",message:"Function overload must not be static."},Function_implementation_name_must_be_0:{code:2389,category:e.DiagnosticCategory.Error,key:"Function_implementation_name_must_be_0_2389",message:"Function implementation name must be '{0}'."},Constructor_implementation_is_missing:{code:2390,category:e.DiagnosticCategory.Error,key:"Constructor_implementation_is_missing_2390",message:"Constructor implementation is missing."},Function_implementation_is_missing_or_not_immediately_following_the_declaration:{code:2391,category:e.DiagnosticCategory.Error,key:"Function_implementation_is_missing_or_not_immediately_following_the_declaration_2391",message:"Function implementation is missing or not immediately following the declaration."},Multiple_constructor_implementations_are_not_allowed:{code:2392,category:e.DiagnosticCategory.Error,key:"Multiple_constructor_implementations_are_not_allowed_2392",message:"Multiple constructor implementations are not allowed."},Duplicate_function_implementation:{code:2393,category:e.DiagnosticCategory.Error,key:"Duplicate_function_implementation_2393",message:"Duplicate function implementation."},Overload_signature_is_not_compatible_with_function_implementation:{code:2394,category:e.DiagnosticCategory.Error,key:"Overload_signature_is_not_compatible_with_function_implementation_2394",message:"Overload signature is not compatible with function implementation."},Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local:{code:2395,category:e.DiagnosticCategory.Error,key:"Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local_2395",message:"Individual declarations in merged declaration '{0}' must be all exported or all local."},Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters:{code:2396,category:e.DiagnosticCategory.Error,key:"Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters_2396",message:"Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters."},Declaration_name_conflicts_with_built_in_global_identifier_0:{code:2397,category:e.DiagnosticCategory.Error,key:"Declaration_name_conflicts_with_built_in_global_identifier_0_2397",message:"Declaration name conflicts with built-in global identifier '{0}'."},Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference:{code:2399,category:e.DiagnosticCategory.Error,key:"Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference_2399",message:"Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference."},Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference:{code:2400,category:e.DiagnosticCategory.Error,key:"Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference_2400",message:"Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference."},Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference:{code:2401,category:e.DiagnosticCategory.Error,key:"Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference_2401",message:"Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference."},Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference:{code:2402,category:e.DiagnosticCategory.Error,key:"Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference_2402",message:"Expression resolves to '_super' that compiler uses to capture base class reference."},Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2:{code:2403,category:e.DiagnosticCategory.Error,key:"Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_t_2403",message:"Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'."},The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation:{code:2404,category:e.DiagnosticCategory.Error,key:"The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation_2404",message:"The left-hand side of a 'for...in' statement cannot use a type annotation."},The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any:{code:2405,category:e.DiagnosticCategory.Error,key:"The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any_2405",message:"The left-hand side of a 'for...in' statement must be of type 'string' or 'any'."},Invalid_left_hand_side_in_for_in_statement:{code:2406,category:e.DiagnosticCategory.Error,key:"Invalid_left_hand_side_in_for_in_statement_2406",message:"Invalid left-hand side in 'for...in' statement."},The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter:{code:2407,category:e.DiagnosticCategory.Error,key:"The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_2407",message:"The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter."},Setters_cannot_return_a_value:{code:2408,category:e.DiagnosticCategory.Error,key:"Setters_cannot_return_a_value_2408",message:"Setters cannot return a value."},Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class:{code:2409,category:e.DiagnosticCategory.Error,key:"Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class_2409",message:"Return type of constructor signature must be assignable to the instance type of the class"},All_symbols_within_a_with_block_will_be_resolved_to_any:{code:2410,category:e.DiagnosticCategory.Error,key:"All_symbols_within_a_with_block_will_be_resolved_to_any_2410",message:"All symbols within a 'with' block will be resolved to 'any'."},Property_0_of_type_1_is_not_assignable_to_string_index_type_2:{code:2411,category:e.DiagnosticCategory.Error,key:"Property_0_of_type_1_is_not_assignable_to_string_index_type_2_2411",message:"Property '{0}' of type '{1}' is not assignable to string index type '{2}'."},Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2:{code:2412,category:e.DiagnosticCategory.Error,key:"Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2_2412",message:"Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'."},Numeric_index_type_0_is_not_assignable_to_string_index_type_1:{code:2413,category:e.DiagnosticCategory.Error,key:"Numeric_index_type_0_is_not_assignable_to_string_index_type_1_2413",message:"Numeric index type '{0}' is not assignable to string index type '{1}'."},Class_name_cannot_be_0:{code:2414,category:e.DiagnosticCategory.Error,key:"Class_name_cannot_be_0_2414",message:"Class name cannot be '{0}'"},Class_0_incorrectly_extends_base_class_1:{code:2415,category:e.DiagnosticCategory.Error,key:"Class_0_incorrectly_extends_base_class_1_2415",message:"Class '{0}' incorrectly extends base class '{1}'."},Class_static_side_0_incorrectly_extends_base_class_static_side_1:{code:2417,category:e.DiagnosticCategory.Error,key:"Class_static_side_0_incorrectly_extends_base_class_static_side_1_2417",message:"Class static side '{0}' incorrectly extends base class static side '{1}'."},Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0:{code:2419,category:e.DiagnosticCategory.Error,key:"Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0_2419",message:"Type name '{0}' in extends clause does not reference constructor function for '{0}'."},Class_0_incorrectly_implements_interface_1:{code:2420,category:e.DiagnosticCategory.Error,key:"Class_0_incorrectly_implements_interface_1_2420",message:"Class '{0}' incorrectly implements interface '{1}'."},A_class_may_only_implement_another_class_or_interface:{code:2422,category:e.DiagnosticCategory.Error,key:"A_class_may_only_implement_another_class_or_interface_2422",message:"A class may only implement another class or interface."},Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor:{code:2423,category:e.DiagnosticCategory.Error,key:"Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_access_2423",message:"Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor."},Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property:{code:2424,category:e.DiagnosticCategory.Error,key:"Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_proper_2424",message:"Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property."},Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function:{code:2425,category:e.DiagnosticCategory.Error,key:"Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_functi_2425",message:"Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function."},Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function:{code:2426,category:e.DiagnosticCategory.Error,key:"Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_functi_2426",message:"Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function."},Interface_name_cannot_be_0:{code:2427,category:e.DiagnosticCategory.Error,key:"Interface_name_cannot_be_0_2427",message:"Interface name cannot be '{0}'"},All_declarations_of_an_interface_must_have_identical_type_parameters:{code:2428,category:e.DiagnosticCategory.Error,key:"All_declarations_of_an_interface_must_have_identical_type_parameters_2428",message:"All declarations of an interface must have identical type parameters."},Interface_0_incorrectly_extends_interface_1:{code:2430,category:e.DiagnosticCategory.Error,key:"Interface_0_incorrectly_extends_interface_1_2430",message:"Interface '{0}' incorrectly extends interface '{1}'."},Enum_name_cannot_be_0:{code:2431,category:e.DiagnosticCategory.Error,key:"Enum_name_cannot_be_0_2431",message:"Enum name cannot be '{0}'"},In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element:{code:2432,category:e.DiagnosticCategory.Error,key:"In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enu_2432",message:"In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element."},A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged:{code:2433,category:e.DiagnosticCategory.Error,key:"A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merg_2433",message:"A namespace declaration cannot be in a different file from a class or function with which it is merged"},A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged:{code:2434,category:e.DiagnosticCategory.Error,key:"A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434",message:"A namespace declaration cannot be located prior to a class or function with which it is merged"},Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces:{code:2435,category:e.DiagnosticCategory.Error,key:"Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces_2435",message:"Ambient modules cannot be nested in other modules or namespaces."},Ambient_module_declaration_cannot_specify_relative_module_name:{code:2436,category:e.DiagnosticCategory.Error,key:"Ambient_module_declaration_cannot_specify_relative_module_name_2436",message:"Ambient module declaration cannot specify relative module name."},Module_0_is_hidden_by_a_local_declaration_with_the_same_name:{code:2437,category:e.DiagnosticCategory.Error,key:"Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437",message:"Module '{0}' is hidden by a local declaration with the same name"},Import_name_cannot_be_0:{code:2438,category:e.DiagnosticCategory.Error,key:"Import_name_cannot_be_0_2438",message:"Import name cannot be '{0}'"},Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name:{code:2439,category:e.DiagnosticCategory.Error,key:"Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relati_2439",message:"Import or export declaration in an ambient module declaration cannot reference module through relative module name."},Import_declaration_conflicts_with_local_declaration_of_0:{code:2440,category:e.DiagnosticCategory.Error,key:"Import_declaration_conflicts_with_local_declaration_of_0_2440",message:"Import declaration conflicts with local declaration of '{0}'"},Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module:{code:2441,category:e.DiagnosticCategory.Error,key:"Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_2441",message:"Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module."},Types_have_separate_declarations_of_a_private_property_0:{code:2442,category:e.DiagnosticCategory.Error,key:"Types_have_separate_declarations_of_a_private_property_0_2442",message:"Types have separate declarations of a private property '{0}'."},Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2:{code:2443,category:e.DiagnosticCategory.Error,key:"Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2_2443",message:"Property '{0}' is protected but type '{1}' is not a class derived from '{2}'."},Property_0_is_protected_in_type_1_but_public_in_type_2:{code:2444,category:e.DiagnosticCategory.Error,key:"Property_0_is_protected_in_type_1_but_public_in_type_2_2444",message:"Property '{0}' is protected in type '{1}' but public in type '{2}'."},Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses:{code:2445,category:e.DiagnosticCategory.Error,key:"Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses_2445",message:"Property '{0}' is protected and only accessible within class '{1}' and its subclasses."},Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1:{code:2446,category:e.DiagnosticCategory.Error,key:"Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_2446",message:"Property '{0}' is protected and only accessible through an instance of class '{1}'."},The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead:{code:2447,category:e.DiagnosticCategory.Error,key:"The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead_2447",message:"The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead."},Block_scoped_variable_0_used_before_its_declaration:{code:2448,category:e.DiagnosticCategory.Error,key:"Block_scoped_variable_0_used_before_its_declaration_2448",message:"Block-scoped variable '{0}' used before its declaration."},The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant:{code:2449,category:e.DiagnosticCategory.Error,key:"The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant_2449",message:"The operand of an increment or decrement operator cannot be a constant."},Left_hand_side_of_assignment_expression_cannot_be_a_constant:{code:2450,category:e.DiagnosticCategory.Error,key:"Left_hand_side_of_assignment_expression_cannot_be_a_constant_2450",message:"Left-hand side of assignment expression cannot be a constant."},Cannot_redeclare_block_scoped_variable_0:{code:2451,category:e.DiagnosticCategory.Error,key:"Cannot_redeclare_block_scoped_variable_0_2451",message:"Cannot redeclare block-scoped variable '{0}'."},An_enum_member_cannot_have_a_numeric_name:{code:2452,category:e.DiagnosticCategory.Error,key:"An_enum_member_cannot_have_a_numeric_name_2452",message:"An enum member cannot have a numeric name."},The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly:{code:2453,category:e.DiagnosticCategory.Error,key:"The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_typ_2453",message:"The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly."},Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0:{
code:2455,category:e.DiagnosticCategory.Error,key:"Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0_2455",message:"Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'."},Type_alias_0_circularly_references_itself:{code:2456,category:e.DiagnosticCategory.Error,key:"Type_alias_0_circularly_references_itself_2456",message:"Type alias '{0}' circularly references itself."},Type_alias_name_cannot_be_0:{code:2457,category:e.DiagnosticCategory.Error,key:"Type_alias_name_cannot_be_0_2457",message:"Type alias name cannot be '{0}'"},An_AMD_module_cannot_have_multiple_name_assignments:{code:2458,category:e.DiagnosticCategory.Error,key:"An_AMD_module_cannot_have_multiple_name_assignments_2458",message:"An AMD module cannot have multiple name assignments."},Type_0_has_no_property_1_and_no_string_index_signature:{code:2459,category:e.DiagnosticCategory.Error,key:"Type_0_has_no_property_1_and_no_string_index_signature_2459",message:"Type '{0}' has no property '{1}' and no string index signature."},Type_0_has_no_property_1:{code:2460,category:e.DiagnosticCategory.Error,key:"Type_0_has_no_property_1_2460",message:"Type '{0}' has no property '{1}'."},Type_0_is_not_an_array_type:{code:2461,category:e.DiagnosticCategory.Error,key:"Type_0_is_not_an_array_type_2461",message:"Type '{0}' is not an array type."},A_rest_element_must_be_last_in_an_array_destructuring_pattern:{code:2462,category:e.DiagnosticCategory.Error,key:"A_rest_element_must_be_last_in_an_array_destructuring_pattern_2462",message:"A rest element must be last in an array destructuring pattern"},A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature:{code:2463,category:e.DiagnosticCategory.Error,key:"A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature_2463",message:"A binding pattern parameter cannot be optional in an implementation signature."},A_computed_property_name_must_be_of_type_string_number_symbol_or_any:{code:2464,category:e.DiagnosticCategory.Error,key:"A_computed_property_name_must_be_of_type_string_number_symbol_or_any_2464",message:"A computed property name must be of type 'string', 'number', 'symbol', or 'any'."},this_cannot_be_referenced_in_a_computed_property_name:{code:2465,category:e.DiagnosticCategory.Error,key:"this_cannot_be_referenced_in_a_computed_property_name_2465",message:"'this' cannot be referenced in a computed property name."},super_cannot_be_referenced_in_a_computed_property_name:{code:2466,category:e.DiagnosticCategory.Error,key:"super_cannot_be_referenced_in_a_computed_property_name_2466",message:"'super' cannot be referenced in a computed property name."},A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type:{code:2467,category:e.DiagnosticCategory.Error,key:"A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type_2467",message:"A computed property name cannot reference a type parameter from its containing type."},Cannot_find_global_value_0:{code:2468,category:e.DiagnosticCategory.Error,key:"Cannot_find_global_value_0_2468",message:"Cannot find global value '{0}'."},The_0_operator_cannot_be_applied_to_type_symbol:{code:2469,category:e.DiagnosticCategory.Error,key:"The_0_operator_cannot_be_applied_to_type_symbol_2469",message:"The '{0}' operator cannot be applied to type 'symbol'."},Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object:{code:2470,category:e.DiagnosticCategory.Error,key:"Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object_2470",message:"'Symbol' reference does not refer to the global Symbol constructor object."},A_computed_property_name_of_the_form_0_must_be_of_type_symbol:{code:2471,category:e.DiagnosticCategory.Error,key:"A_computed_property_name_of_the_form_0_must_be_of_type_symbol_2471",message:"A computed property name of the form '{0}' must be of type 'symbol'."},Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher:{code:2472,category:e.DiagnosticCategory.Error,key:"Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher_2472",message:"Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher."},Enum_declarations_must_all_be_const_or_non_const:{code:2473,category:e.DiagnosticCategory.Error,key:"Enum_declarations_must_all_be_const_or_non_const_2473",message:"Enum declarations must all be const or non-const."},In_const_enum_declarations_member_initializer_must_be_constant_expression:{code:2474,category:e.DiagnosticCategory.Error,key:"In_const_enum_declarations_member_initializer_must_be_constant_expression_2474",message:"In 'const' enum declarations member initializer must be constant expression."},const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment:{code:2475,category:e.DiagnosticCategory.Error,key:"const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_im_2475",message:"'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment."},A_const_enum_member_can_only_be_accessed_using_a_string_literal:{code:2476,category:e.DiagnosticCategory.Error,key:"A_const_enum_member_can_only_be_accessed_using_a_string_literal_2476",message:"A const enum member can only be accessed using a string literal."},const_enum_member_initializer_was_evaluated_to_a_non_finite_value:{code:2477,category:e.DiagnosticCategory.Error,key:"const_enum_member_initializer_was_evaluated_to_a_non_finite_value_2477",message:"'const' enum member initializer was evaluated to a non-finite value."},const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN:{code:2478,category:e.DiagnosticCategory.Error,key:"const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN_2478",message:"'const' enum member initializer was evaluated to disallowed value 'NaN'."},Property_0_does_not_exist_on_const_enum_1:{code:2479,category:e.DiagnosticCategory.Error,key:"Property_0_does_not_exist_on_const_enum_1_2479",message:"Property '{0}' does not exist on 'const' enum '{1}'."},let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations:{code:2480,category:e.DiagnosticCategory.Error,key:"let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations_2480",message:"'let' is not allowed to be used as a name in 'let' or 'const' declarations."},Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1:{code:2481,category:e.DiagnosticCategory.Error,key:"Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1_2481",message:"Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'."},The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation:{code:2483,category:e.DiagnosticCategory.Error,key:"The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation_2483",message:"The left-hand side of a 'for...of' statement cannot use a type annotation."},Export_declaration_conflicts_with_exported_declaration_of_0:{code:2484,category:e.DiagnosticCategory.Error,key:"Export_declaration_conflicts_with_exported_declaration_of_0_2484",message:"Export declaration conflicts with exported declaration of '{0}'"},The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant:{code:2485,category:e.DiagnosticCategory.Error,key:"The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant_2485",message:"The left-hand side of a 'for...of' statement cannot be a previously defined constant."},The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant:{code:2486,category:e.DiagnosticCategory.Error,key:"The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant_2486",message:"The left-hand side of a 'for...in' statement cannot be a previously defined constant."},Invalid_left_hand_side_in_for_of_statement:{code:2487,category:e.DiagnosticCategory.Error,key:"Invalid_left_hand_side_in_for_of_statement_2487",message:"Invalid left-hand side in 'for...of' statement."},Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator:{code:2488,category:e.DiagnosticCategory.Error,key:"Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488",message:"Type must have a '[Symbol.iterator]()' method that returns an iterator."},An_iterator_must_have_a_next_method:{code:2489,category:e.DiagnosticCategory.Error,key:"An_iterator_must_have_a_next_method_2489",message:"An iterator must have a 'next()' method."},The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property:{code:2490,category:e.DiagnosticCategory.Error,key:"The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property_2490",message:"The type returned by the 'next()' method of an iterator must have a 'value' property."},The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern:{code:2491,category:e.DiagnosticCategory.Error,key:"The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern_2491",message:"The left-hand side of a 'for...in' statement cannot be a destructuring pattern."},Cannot_redeclare_identifier_0_in_catch_clause:{code:2492,category:e.DiagnosticCategory.Error,key:"Cannot_redeclare_identifier_0_in_catch_clause_2492",message:"Cannot redeclare identifier '{0}' in catch clause"},Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2:{code:2493,category:e.DiagnosticCategory.Error,key:"Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2_2493",message:"Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'."},Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher:{code:2494,category:e.DiagnosticCategory.Error,key:"Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494",message:"Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher."},Type_0_is_not_an_array_type_or_a_string_type:{code:2495,category:e.DiagnosticCategory.Error,key:"Type_0_is_not_an_array_type_or_a_string_type_2495",message:"Type '{0}' is not an array type or a string type."},The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression:{code:2496,category:e.DiagnosticCategory.Error,key:"The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_stand_2496",message:"The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression."},Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct:{code:2497,category:e.DiagnosticCategory.Error,key:"Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct_2497",message:"Module '{0}' resolves to a non-module entity and cannot be imported using this construct."},Module_0_uses_export_and_cannot_be_used_with_export_Asterisk:{code:2498,category:e.DiagnosticCategory.Error,key:"Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498",message:"Module '{0}' uses 'export =' and cannot be used with 'export *'."},An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments:{code:2499,category:e.DiagnosticCategory.Error,key:"An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments_2499",message:"An interface can only extend an identifier/qualified-name with optional type arguments."},A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments:{code:2500,category:e.DiagnosticCategory.Error,key:"A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments_2500",message:"A class can only implement an identifier/qualified-name with optional type arguments."},A_rest_element_cannot_contain_a_binding_pattern:{code:2501,category:e.DiagnosticCategory.Error,key:"A_rest_element_cannot_contain_a_binding_pattern_2501",message:"A rest element cannot contain a binding pattern."},_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation:{code:2502,category:e.DiagnosticCategory.Error,key:"_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502",message:"'{0}' is referenced directly or indirectly in its own type annotation."},Cannot_find_namespace_0:{code:2503,category:e.DiagnosticCategory.Error,key:"Cannot_find_namespace_0_2503",message:"Cannot find namespace '{0}'."},No_best_common_type_exists_among_yield_expressions:{code:2504,category:e.DiagnosticCategory.Error,key:"No_best_common_type_exists_among_yield_expressions_2504",message:"No best common type exists among yield expressions."},A_generator_cannot_have_a_void_type_annotation:{code:2505,category:e.DiagnosticCategory.Error,key:"A_generator_cannot_have_a_void_type_annotation_2505",message:"A generator cannot have a 'void' type annotation."},_0_is_referenced_directly_or_indirectly_in_its_own_base_expression:{code:2506,category:e.DiagnosticCategory.Error,key:"_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506",message:"'{0}' is referenced directly or indirectly in its own base expression."},Type_0_is_not_a_constructor_function_type:{code:2507,category:e.DiagnosticCategory.Error,key:"Type_0_is_not_a_constructor_function_type_2507",message:"Type '{0}' is not a constructor function type."},No_base_constructor_has_the_specified_number_of_type_arguments:{code:2508,category:e.DiagnosticCategory.Error,key:"No_base_constructor_has_the_specified_number_of_type_arguments_2508",message:"No base constructor has the specified number of type arguments."},Base_constructor_return_type_0_is_not_a_class_or_interface_type:{code:2509,category:e.DiagnosticCategory.Error,key:"Base_constructor_return_type_0_is_not_a_class_or_interface_type_2509",message:"Base constructor return type '{0}' is not a class or interface type."},Base_constructors_must_all_have_the_same_return_type:{code:2510,category:e.DiagnosticCategory.Error,key:"Base_constructors_must_all_have_the_same_return_type_2510",message:"Base constructors must all have the same return type."},Cannot_create_an_instance_of_the_abstract_class_0:{code:2511,category:e.DiagnosticCategory.Error,key:"Cannot_create_an_instance_of_the_abstract_class_0_2511",message:"Cannot create an instance of the abstract class '{0}'."},Overload_signatures_must_all_be_abstract_or_not_abstract:{code:2512,category:e.DiagnosticCategory.Error,key:"Overload_signatures_must_all_be_abstract_or_not_abstract_2512",message:"Overload signatures must all be abstract or not abstract."},Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression:{code:2513,category:e.DiagnosticCategory.Error,key:"Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression_2513",message:"Abstract method '{0}' in class '{1}' cannot be accessed via super expression."},Classes_containing_abstract_methods_must_be_marked_abstract:{code:2514,category:e.DiagnosticCategory.Error,key:"Classes_containing_abstract_methods_must_be_marked_abstract_2514",message:"Classes containing abstract methods must be marked abstract."},Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2:{code:2515,category:e.DiagnosticCategory.Error,key:"Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515",message:"Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'."},All_declarations_of_an_abstract_method_must_be_consecutive:{code:2516,category:e.DiagnosticCategory.Error,key:"All_declarations_of_an_abstract_method_must_be_consecutive_2516",message:"All declarations of an abstract method must be consecutive."},Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type:{code:2517,category:e.DiagnosticCategory.Error,key:"Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type_2517",message:"Cannot assign an abstract constructor type to a non-abstract constructor type."},A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard:{code:2518,category:e.DiagnosticCategory.Error,key:"A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard_2518",message:"A 'this'-based type guard is not compatible with a parameter-based type guard."},Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions:{code:2520,category:e.DiagnosticCategory.Error,key:"Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions_2520",message:"Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions."},Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions:{code:2521,category:e.DiagnosticCategory.Error,key:"Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions_2521",message:"Expression resolves to variable declaration '{0}' that compiler uses to support async functions."},The_arguments_object_cannot_be_referenced_in_an_async_arrow_function_Consider_using_a_standard_async_function_expression:{code:2522,category:e.DiagnosticCategory.Error,key:"The_arguments_object_cannot_be_referenced_in_an_async_arrow_function_Consider_using_a_standard_async_2522",message:"The 'arguments' object cannot be referenced in an async arrow function. Consider using a standard async function expression."},yield_expressions_cannot_be_used_in_a_parameter_initializer:{code:2523,category:e.DiagnosticCategory.Error,key:"yield_expressions_cannot_be_used_in_a_parameter_initializer_2523",message:"'yield' expressions cannot be used in a parameter initializer."},await_expressions_cannot_be_used_in_a_parameter_initializer:{code:2524,category:e.DiagnosticCategory.Error,key:"await_expressions_cannot_be_used_in_a_parameter_initializer_2524",message:"'await' expressions cannot be used in a parameter initializer."},Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value:{code:2525,category:e.DiagnosticCategory.Error,key:"Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value_2525",message:"Initializer provides no value for this binding element and the binding element has no default value."},A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface:{code:2526,category:e.DiagnosticCategory.Error,key:"A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface_2526",message:"A 'this' type is available only in a non-static member of a class or interface."},The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary:{code:2527,category:e.DiagnosticCategory.Error,key:"The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary_2527",message:"The inferred type of '{0}' references an inaccessible 'this' type. A type annotation is necessary."},A_module_cannot_have_multiple_default_exports:{code:2528,category:e.DiagnosticCategory.Error,key:"A_module_cannot_have_multiple_default_exports_2528",message:"A module cannot have multiple default exports."},Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions:{code:2529,category:e.DiagnosticCategory.Error,key:"Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_func_2529",message:"Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module containing async functions."},JSX_element_attributes_type_0_may_not_be_a_union_type:{code:2600,category:e.DiagnosticCategory.Error,key:"JSX_element_attributes_type_0_may_not_be_a_union_type_2600",message:"JSX element attributes type '{0}' may not be a union type."},The_return_type_of_a_JSX_element_constructor_must_return_an_object_type:{code:2601,category:e.DiagnosticCategory.Error,key:"The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601",message:"The return type of a JSX element constructor must return an object type."},JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist:{code:2602,category:e.DiagnosticCategory.Error,key:"JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602",message:"JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist."},Property_0_in_type_1_is_not_assignable_to_type_2:{code:2603,category:e.DiagnosticCategory.Error,key:"Property_0_in_type_1_is_not_assignable_to_type_2_2603",message:"Property '{0}' in type '{1}' is not assignable to type '{2}'"},JSX_element_type_0_does_not_have_any_construct_or_call_signatures:{code:2604,category:e.DiagnosticCategory.Error,key:"JSX_element_type_0_does_not_have_any_construct_or_call_signatures_2604",message:"JSX element type '{0}' does not have any construct or call signatures."},JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements:{code:2605,category:e.DiagnosticCategory.Error,key:"JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements_2605",message:"JSX element type '{0}' is not a constructor function for JSX elements."},Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property:{code:2606,category:e.DiagnosticCategory.Error,key:"Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property_2606",message:"Property '{0}' of JSX spread attribute is not assignable to target property."},JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property:{code:2607,category:e.DiagnosticCategory.Error,key:"JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property_2607",message:"JSX element class does not support attributes because it does not have a '{0}' property"},The_global_type_JSX_0_may_not_have_more_than_one_property:{code:2608,category:e.DiagnosticCategory.Error,key:"The_global_type_JSX_0_may_not_have_more_than_one_property_2608",message:"The global type 'JSX.{0}' may not have more than one property"},Cannot_emit_namespaced_JSX_elements_in_React:{code:2650,category:e.DiagnosticCategory.Error,key:"Cannot_emit_namespaced_JSX_elements_in_React_2650",message:"Cannot emit namespaced JSX elements in React"},A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums:{code:2651,category:e.DiagnosticCategory.Error,key:"A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651",message:"A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."},Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead:{code:2652,category:e.DiagnosticCategory.Error,key:"Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652",message:"Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."},Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1:{code:2653,category:e.DiagnosticCategory.Error,key:"Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1_2653",message:"Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'."},Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition:{code:2654,category:e.DiagnosticCategory.Error,key:"Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_pack_2654",message:"Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition."},Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition:{code:2656,category:e.DiagnosticCategory.Error,key:"Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_2656",message:"Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition."},JSX_expressions_must_have_one_parent_element:{code:2657,category:e.DiagnosticCategory.Error,key:"JSX_expressions_must_have_one_parent_element_2657",message:"JSX expressions must have one parent element"},Type_0_provides_no_match_for_the_signature_1:{code:2658,category:e.DiagnosticCategory.Error,key:"Type_0_provides_no_match_for_the_signature_1_2658",message:"Type '{0}' provides no match for the signature '{1}'"},super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher:{code:2659,category:e.DiagnosticCategory.Error,key:"super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_highe_2659",message:"'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher."},super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions:{code:2660,category:e.DiagnosticCategory.Error,key:"super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions_2660",message:"'super' can only be referenced in members of derived classes or object literal expressions."},Cannot_re_export_name_that_is_not_defined_in_the_module:{code:2661,category:e.DiagnosticCategory.Error,key:"Cannot_re_export_name_that_is_not_defined_in_the_module_2661",message:"Cannot re-export name that is not defined in the module."},Cannot_find_name_0_Did_you_mean_the_static_member_1_0:{code:2662,category:e.DiagnosticCategory.Error,key:"Cannot_find_name_0_Did_you_mean_the_static_member_1_0_2662",message:"Cannot find name '{0}'. Did you mean the static member '{1}.{0}'?"},Cannot_find_name_0_Did_you_mean_the_instance_member_this_0:{code:2663,category:e.DiagnosticCategory.Error,key:"Cannot_find_name_0_Did_you_mean_the_instance_member_this_0_2663",message:"Cannot find name '{0}'. Did you mean the instance member 'this.{0}'?"},Invalid_module_name_in_augmentation_module_0_cannot_be_found:{code:2664,category:e.DiagnosticCategory.Error,key:"Invalid_module_name_in_augmentation_module_0_cannot_be_found_2664",message:"Invalid module name in augmentation, module '{0}' cannot be found."},Module_augmentation_cannot_introduce_new_names_in_the_top_level_scope:{code:2665,category:e.DiagnosticCategory.Error,key:"Module_augmentation_cannot_introduce_new_names_in_the_top_level_scope_2665",message:"Module augmentation cannot introduce new names in the top level scope."},Exports_and_export_assignments_are_not_permitted_in_module_augmentations:{code:2666,category:e.DiagnosticCategory.Error,key:"Exports_and_export_assignments_are_not_permitted_in_module_augmentations_2666",message:"Exports and export assignments are not permitted in module augmentations."},Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module:{code:2667,category:e.DiagnosticCategory.Error,key:"Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_mod_2667",message:"Imports are not permitted in module augmentations. Consider moving them to the enclosing external module."},export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible:{code:2668,category:e.DiagnosticCategory.Error,key:"export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always__2668",message:"'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible."},Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations:{code:2669,category:e.DiagnosticCategory.Error,key:"Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_2669",message:"Augmentations for the global scope can only be directly nested in external modules or ambient module declarations."},Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context:{code:2670,category:e.DiagnosticCategory.Error,key:"Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambien_2670",message:"Augmentations for the global scope should have 'declare' modifier unless they appear in already ambient context."},Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity:{code:2671,category:e.DiagnosticCategory.Error,key:"Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity_2671",message:"Cannot augment module '{0}' because it resolves to a non-module entity."},Import_declaration_0_is_using_private_name_1:{code:4e3,category:e.DiagnosticCategory.Error,key:"Import_declaration_0_is_using_private_name_1_4000",message:"Import declaration '{0}' is using private name '{1}'."},Type_parameter_0_of_exported_class_has_or_is_using_private_name_1:{code:4002,category:e.DiagnosticCategory.Error,key:"Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002",message:"Type parameter '{0}' of exported class has or is using private name '{1}'."},Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1:{code:4004,category:e.DiagnosticCategory.Error,key:"Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004",message:"Type parameter '{0}' of exported interface has or is using private name '{1}'."},Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1:{code:4006,category:e.DiagnosticCategory.Error,key:"Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1_4006",message:"Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'."},Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1:{code:4008,category:e.DiagnosticCategory.Error,key:"Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1_4008",message:"Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'."},Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1:{code:4010,category:e.DiagnosticCategory.Error,key:"Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1_4010",message:"Type parameter '{0}' of public static method from exported class has or is using private name '{1}'."},Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1:{code:4012,category:e.DiagnosticCategory.Error,key:"Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1_4012",message:"Type parameter '{0}' of public method from exported class has or is using private name '{1}'."},Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1:{code:4014,category:e.DiagnosticCategory.Error,key:"Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1_4014",message:"Type parameter '{0}' of method from exported interface has or is using private name '{1}'."},Type_parameter_0_of_exported_function_has_or_is_using_private_name_1:{code:4016,category:e.DiagnosticCategory.Error,key:"Type_parameter_0_of_exported_function_has_or_is_using_private_name_1_4016",message:"Type parameter '{0}' of exported function has or is using private name '{1}'."},Implements_clause_of_exported_class_0_has_or_is_using_private_name_1:{code:4019,category:e.DiagnosticCategory.Error,key:"Implements_clause_of_exported_class_0_has_or_is_using_private_name_1_4019",
message:"Implements clause of exported class '{0}' has or is using private name '{1}'."},Extends_clause_of_exported_class_0_has_or_is_using_private_name_1:{code:4020,category:e.DiagnosticCategory.Error,key:"Extends_clause_of_exported_class_0_has_or_is_using_private_name_1_4020",message:"Extends clause of exported class '{0}' has or is using private name '{1}'."},Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1:{code:4022,category:e.DiagnosticCategory.Error,key:"Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1_4022",message:"Extends clause of exported interface '{0}' has or is using private name '{1}'."},Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:{code:4023,category:e.DiagnosticCategory.Error,key:"Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4023",message:"Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named."},Exported_variable_0_has_or_is_using_name_1_from_private_module_2:{code:4024,category:e.DiagnosticCategory.Error,key:"Exported_variable_0_has_or_is_using_name_1_from_private_module_2_4024",message:"Exported variable '{0}' has or is using name '{1}' from private module '{2}'."},Exported_variable_0_has_or_is_using_private_name_1:{code:4025,category:e.DiagnosticCategory.Error,key:"Exported_variable_0_has_or_is_using_private_name_1_4025",message:"Exported variable '{0}' has or is using private name '{1}'."},Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:{code:4026,category:e.DiagnosticCategory.Error,key:"Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot__4026",message:"Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named."},Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2:{code:4027,category:e.DiagnosticCategory.Error,key:"Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4027",message:"Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'."},Public_static_property_0_of_exported_class_has_or_is_using_private_name_1:{code:4028,category:e.DiagnosticCategory.Error,key:"Public_static_property_0_of_exported_class_has_or_is_using_private_name_1_4028",message:"Public static property '{0}' of exported class has or is using private name '{1}'."},Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:{code:4029,category:e.DiagnosticCategory.Error,key:"Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_name_4029",message:"Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named."},Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2:{code:4030,category:e.DiagnosticCategory.Error,key:"Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4030",message:"Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'."},Public_property_0_of_exported_class_has_or_is_using_private_name_1:{code:4031,category:e.DiagnosticCategory.Error,key:"Public_property_0_of_exported_class_has_or_is_using_private_name_1_4031",message:"Public property '{0}' of exported class has or is using private name '{1}'."},Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2:{code:4032,category:e.DiagnosticCategory.Error,key:"Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4032",message:"Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'."},Property_0_of_exported_interface_has_or_is_using_private_name_1:{code:4033,category:e.DiagnosticCategory.Error,key:"Property_0_of_exported_interface_has_or_is_using_private_name_1_4033",message:"Property '{0}' of exported interface has or is using private name '{1}'."},Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2:{code:4034,category:e.DiagnosticCategory.Error,key:"Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_4034",message:"Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'."},Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1:{code:4035,category:e.DiagnosticCategory.Error,key:"Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1_4035",message:"Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'."},Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2:{code:4036,category:e.DiagnosticCategory.Error,key:"Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_4036",message:"Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'."},Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1:{code:4037,category:e.DiagnosticCategory.Error,key:"Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1_4037",message:"Parameter '{0}' of public property setter from exported class has or is using private name '{1}'."},Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named:{code:4038,category:e.DiagnosticCategory.Error,key:"Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_externa_4038",message:"Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named."},Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1:{code:4039,category:e.DiagnosticCategory.Error,key:"Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_4039",message:"Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'."},Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0:{code:4040,category:e.DiagnosticCategory.Error,key:"Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0_4040",message:"Return type of public static property getter from exported class has or is using private name '{0}'."},Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named:{code:4041,category:e.DiagnosticCategory.Error,key:"Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_modul_4041",message:"Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named."},Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1:{code:4042,category:e.DiagnosticCategory.Error,key:"Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_4042",message:"Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'."},Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0:{code:4043,category:e.DiagnosticCategory.Error,key:"Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0_4043",message:"Return type of public property getter from exported class has or is using private name '{0}'."},Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1:{code:4044,category:e.DiagnosticCategory.Error,key:"Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_mod_4044",message:"Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'."},Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0:{code:4045,category:e.DiagnosticCategory.Error,key:"Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0_4045",message:"Return type of constructor signature from exported interface has or is using private name '{0}'."},Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1:{code:4046,category:e.DiagnosticCategory.Error,key:"Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4046",message:"Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'."},Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0:{code:4047,category:e.DiagnosticCategory.Error,key:"Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0_4047",message:"Return type of call signature from exported interface has or is using private name '{0}'."},Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1:{code:4048,category:e.DiagnosticCategory.Error,key:"Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4048",message:"Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'."},Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0:{code:4049,category:e.DiagnosticCategory.Error,key:"Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0_4049",message:"Return type of index signature from exported interface has or is using private name '{0}'."},Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named:{code:4050,category:e.DiagnosticCategory.Error,key:"Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module__4050",message:"Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named."},Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1:{code:4051,category:e.DiagnosticCategory.Error,key:"Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1_4051",message:"Return type of public static method from exported class has or is using name '{0}' from private module '{1}'."},Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0:{code:4052,category:e.DiagnosticCategory.Error,key:"Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0_4052",message:"Return type of public static method from exported class has or is using private name '{0}'."},Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named:{code:4053,category:e.DiagnosticCategory.Error,key:"Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_c_4053",message:"Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named."},Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1:{code:4054,category:e.DiagnosticCategory.Error,key:"Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1_4054",message:"Return type of public method from exported class has or is using name '{0}' from private module '{1}'."},Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0:{code:4055,category:e.DiagnosticCategory.Error,key:"Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0_4055",message:"Return type of public method from exported class has or is using private name '{0}'."},Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1:{code:4056,category:e.DiagnosticCategory.Error,key:"Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4056",message:"Return type of method from exported interface has or is using name '{0}' from private module '{1}'."},Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0:{code:4057,category:e.DiagnosticCategory.Error,key:"Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0_4057",message:"Return type of method from exported interface has or is using private name '{0}'."},Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named:{code:4058,category:e.DiagnosticCategory.Error,key:"Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named_4058",message:"Return type of exported function has or is using name '{0}' from external module {1} but cannot be named."},Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1:{code:4059,category:e.DiagnosticCategory.Error,key:"Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1_4059",message:"Return type of exported function has or is using name '{0}' from private module '{1}'."},Return_type_of_exported_function_has_or_is_using_private_name_0:{code:4060,category:e.DiagnosticCategory.Error,key:"Return_type_of_exported_function_has_or_is_using_private_name_0_4060",message:"Return type of exported function has or is using private name '{0}'."},Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:{code:4061,category:e.DiagnosticCategory.Error,key:"Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_can_4061",message:"Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named."},Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2:{code:4062,category:e.DiagnosticCategory.Error,key:"Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2_4062",message:"Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'."},Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1:{code:4063,category:e.DiagnosticCategory.Error,key:"Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1_4063",message:"Parameter '{0}' of constructor from exported class has or is using private name '{1}'."},Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2:{code:4064,category:e.DiagnosticCategory.Error,key:"Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_mod_4064",message:"Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'."},Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1:{code:4065,category:e.DiagnosticCategory.Error,key:"Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1_4065",message:"Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'."},Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2:{code:4066,category:e.DiagnosticCategory.Error,key:"Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4066",message:"Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'."},Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1:{code:4067,category:e.DiagnosticCategory.Error,key:"Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1_4067",message:"Parameter '{0}' of call signature from exported interface has or is using private name '{1}'."},Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:{code:4068,category:e.DiagnosticCategory.Error,key:"Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module__4068",message:"Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named."},Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2:{code:4069,category:e.DiagnosticCategory.Error,key:"Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2_4069",message:"Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'."},Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1:{code:4070,category:e.DiagnosticCategory.Error,key:"Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1_4070",message:"Parameter '{0}' of public static method from exported class has or is using private name '{1}'."},Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:{code:4071,category:e.DiagnosticCategory.Error,key:"Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_c_4071",message:"Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named."},Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2:{code:4072,category:e.DiagnosticCategory.Error,key:"Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2_4072",message:"Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'."},Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1:{code:4073,category:e.DiagnosticCategory.Error,key:"Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1_4073",message:"Parameter '{0}' of public method from exported class has or is using private name '{1}'."},Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2:{code:4074,category:e.DiagnosticCategory.Error,key:"Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4074",message:"Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'."},Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1:{code:4075,category:e.DiagnosticCategory.Error,key:"Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1_4075",message:"Parameter '{0}' of method from exported interface has or is using private name '{1}'."},Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:{code:4076,category:e.DiagnosticCategory.Error,key:"Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4076",message:"Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named."},Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2:{code:4077,category:e.DiagnosticCategory.Error,key:"Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2_4077",message:"Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'."},Parameter_0_of_exported_function_has_or_is_using_private_name_1:{code:4078,category:e.DiagnosticCategory.Error,key:"Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078",message:"Parameter '{0}' of exported function has or is using private name '{1}'."},Exported_type_alias_0_has_or_is_using_private_name_1:{code:4081,category:e.DiagnosticCategory.Error,key:"Exported_type_alias_0_has_or_is_using_private_name_1_4081",message:"Exported type alias '{0}' has or is using private name '{1}'."},Default_export_of_the_module_has_or_is_using_private_name_0:{code:4082,category:e.DiagnosticCategory.Error,key:"Default_export_of_the_module_has_or_is_using_private_name_0_4082",message:"Default export of the module has or is using private name '{0}'."},The_current_host_does_not_support_the_0_option:{code:5001,category:e.DiagnosticCategory.Error,key:"The_current_host_does_not_support_the_0_option_5001",message:"The current host does not support the '{0}' option."},Cannot_find_the_common_subdirectory_path_for_the_input_files:{code:5009,category:e.DiagnosticCategory.Error,key:"Cannot_find_the_common_subdirectory_path_for_the_input_files_5009",message:"Cannot find the common subdirectory path for the input files."},Cannot_read_file_0_Colon_1:{code:5012,category:e.DiagnosticCategory.Error,key:"Cannot_read_file_0_Colon_1_5012",message:"Cannot read file '{0}': {1}"},Unsupported_file_encoding:{code:5013,category:e.DiagnosticCategory.Error,key:"Unsupported_file_encoding_5013",message:"Unsupported file encoding."},Failed_to_parse_file_0_Colon_1:{code:5014,category:e.DiagnosticCategory.Error,key:"Failed_to_parse_file_0_Colon_1_5014",message:"Failed to parse file '{0}': {1}."},Unknown_compiler_option_0:{code:5023,category:e.DiagnosticCategory.Error,key:"Unknown_compiler_option_0_5023",message:"Unknown compiler option '{0}'."},Compiler_option_0_requires_a_value_of_type_1:{code:5024,category:e.DiagnosticCategory.Error,key:"Compiler_option_0_requires_a_value_of_type_1_5024",message:"Compiler option '{0}' requires a value of type {1}."},Could_not_write_file_0_Colon_1:{code:5033,category:e.DiagnosticCategory.Error,key:"Could_not_write_file_0_Colon_1_5033",message:"Could not write file '{0}': {1}"},Option_project_cannot_be_mixed_with_source_files_on_a_command_line:{code:5042,category:e.DiagnosticCategory.Error,key:"Option_project_cannot_be_mixed_with_source_files_on_a_command_line_5042",message:"Option 'project' cannot be mixed with source files on a command line."},Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher:{code:5047,category:e.DiagnosticCategory.Error,key:"Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047",message:"Option 'isolatedModules' can only be used when either option '--module' is provided or option 'target' is 'ES2015' or higher."},Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided:{code:5051,category:e.DiagnosticCategory.Error,key:"Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_prov_5051",message:"Option 'inlineSources' can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided."},Option_0_cannot_be_specified_without_specifying_option_1:{code:5052,category:e.DiagnosticCategory.Error,key:"Option_0_cannot_be_specified_without_specifying_option_1_5052",message:"Option '{0}' cannot be specified without specifying option '{1}'."},Option_0_cannot_be_specified_with_option_1:{code:5053,category:e.DiagnosticCategory.Error,key:"Option_0_cannot_be_specified_with_option_1_5053",message:"Option '{0}' cannot be specified with option '{1}'."},A_tsconfig_json_file_is_already_defined_at_Colon_0:{code:5054,category:e.DiagnosticCategory.Error,key:"A_tsconfig_json_file_is_already_defined_at_Colon_0_5054",message:"A 'tsconfig.json' file is already defined at: '{0}'."},Cannot_write_file_0_because_it_would_overwrite_input_file:{code:5055,category:e.DiagnosticCategory.Error,key:"Cannot_write_file_0_because_it_would_overwrite_input_file_5055",message:"Cannot write file '{0}' because it would overwrite input file."},Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files:{code:5056,category:e.DiagnosticCategory.Error,key:"Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files_5056",message:"Cannot write file '{0}' because it would be overwritten by multiple input files."},Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0:{code:5057,category:e.DiagnosticCategory.Error,key:"Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0_5057",message:"Cannot find a tsconfig.json file at the specified directory: '{0}'"},The_specified_path_does_not_exist_Colon_0:{code:5058,category:e.DiagnosticCategory.Error,key:"The_specified_path_does_not_exist_Colon_0_5058",message:"The specified path does not exist: '{0}'"},Invalide_value_for_reactNamespace_0_is_not_a_valid_identifier:{code:5059,category:e.DiagnosticCategory.Error,key:"Invalide_value_for_reactNamespace_0_is_not_a_valid_identifier_5059",message:"Invalide value for '--reactNamespace'. '{0}' is not a valid identifier."},Concatenate_and_emit_output_to_single_file:{code:6001,category:e.DiagnosticCategory.Message,key:"Concatenate_and_emit_output_to_single_file_6001",message:"Concatenate and emit output to single file."},Generates_corresponding_d_ts_file:{code:6002,category:e.DiagnosticCategory.Message,key:"Generates_corresponding_d_ts_file_6002",message:"Generates corresponding '.d.ts' file."},Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations:{code:6003,category:e.DiagnosticCategory.Message,key:"Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations_6003",message:"Specifies the location where debugger should locate map files instead of generated locations."},Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations:{code:6004,category:e.DiagnosticCategory.Message,key:"Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations_6004",message:"Specifies the location where debugger should locate TypeScript files instead of source locations."},Watch_input_files:{code:6005,category:e.DiagnosticCategory.Message,key:"Watch_input_files_6005",message:"Watch input files."},Redirect_output_structure_to_the_directory:{code:6006,category:e.DiagnosticCategory.Message,key:"Redirect_output_structure_to_the_directory_6006",message:"Redirect output structure to the directory."},Do_not_erase_const_enum_declarations_in_generated_code:{code:6007,category:e.DiagnosticCategory.Message,key:"Do_not_erase_const_enum_declarations_in_generated_code_6007",message:"Do not erase const enum declarations in generated code."},Do_not_emit_outputs_if_any_errors_were_reported:{code:6008,category:e.DiagnosticCategory.Message,key:"Do_not_emit_outputs_if_any_errors_were_reported_6008",message:"Do not emit outputs if any errors were reported."},Do_not_emit_comments_to_output:{code:6009,category:e.DiagnosticCategory.Message,key:"Do_not_emit_comments_to_output_6009",message:"Do not emit comments to output."},Do_not_emit_outputs:{code:6010,category:e.DiagnosticCategory.Message,key:"Do_not_emit_outputs_6010",message:"Do not emit outputs."},Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking:{code:6011,category:e.DiagnosticCategory.Message,key:"Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011",message:"Allow default imports from modules with no default export. This does not affect code emit, just typechecking."},Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_experimental:{code:6015,category:e.DiagnosticCategory.Message,key:"Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_experimental_6015",message:"Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015' (experimental)"},Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015:{code:6016,category:e.DiagnosticCategory.Message,key:"Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015_6016",message:"Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'"},Print_this_message:{code:6017,category:e.DiagnosticCategory.Message,key:"Print_this_message_6017",message:"Print this message."},Print_the_compiler_s_version:{code:6019,category:e.DiagnosticCategory.Message,key:"Print_the_compiler_s_version_6019",message:"Print the compiler's version."},Compile_the_project_in_the_given_directory:{code:6020,category:e.DiagnosticCategory.Message,key:"Compile_the_project_in_the_given_directory_6020",message:"Compile the project in the given directory."},Syntax_Colon_0:{code:6023,category:e.DiagnosticCategory.Message,key:"Syntax_Colon_0_6023",message:"Syntax: {0}"},options:{code:6024,category:e.DiagnosticCategory.Message,key:"options_6024",message:"options"},file:{code:6025,category:e.DiagnosticCategory.Message,key:"file_6025",message:"file"},Examples_Colon_0:{code:6026,category:e.DiagnosticCategory.Message,key:"Examples_Colon_0_6026",message:"Examples: {0}"},Options_Colon:{code:6027,category:e.DiagnosticCategory.Message,key:"Options_Colon_6027",message:"Options:"},Version_0:{code:6029,category:e.DiagnosticCategory.Message,key:"Version_0_6029",message:"Version {0}"},Insert_command_line_options_and_files_from_a_file:{code:6030,category:e.DiagnosticCategory.Message,key:"Insert_command_line_options_and_files_from_a_file_6030",message:"Insert command line options and files from a file."},File_change_detected_Starting_incremental_compilation:{code:6032,category:e.DiagnosticCategory.Message,key:"File_change_detected_Starting_incremental_compilation_6032",message:"File change detected. Starting incremental compilation..."},KIND:{code:6034,category:e.DiagnosticCategory.Message,key:"KIND_6034",message:"KIND"},FILE:{code:6035,category:e.DiagnosticCategory.Message,key:"FILE_6035",message:"FILE"},VERSION:{code:6036,category:e.DiagnosticCategory.Message,key:"VERSION_6036",message:"VERSION"},LOCATION:{code:6037,category:e.DiagnosticCategory.Message,key:"LOCATION_6037",message:"LOCATION"},DIRECTORY:{code:6038,category:e.DiagnosticCategory.Message,key:"DIRECTORY_6038",message:"DIRECTORY"},Compilation_complete_Watching_for_file_changes:{code:6042,category:e.DiagnosticCategory.Message,key:"Compilation_complete_Watching_for_file_changes_6042",message:"Compilation complete. Watching for file changes."},Generates_corresponding_map_file:{code:6043,category:e.DiagnosticCategory.Message,key:"Generates_corresponding_map_file_6043",message:"Generates corresponding '.map' file."},Compiler_option_0_expects_an_argument:{code:6044,category:e.DiagnosticCategory.Error,key:"Compiler_option_0_expects_an_argument_6044",message:"Compiler option '{0}' expects an argument."},Unterminated_quoted_string_in_response_file_0:{code:6045,category:e.DiagnosticCategory.Error,key:"Unterminated_quoted_string_in_response_file_0_6045",message:"Unterminated quoted string in response file '{0}'."},Argument_for_module_option_must_be_commonjs_amd_system_umd_es2015_or_none:{code:6046,category:e.DiagnosticCategory.Error,key:"Argument_for_module_option_must_be_commonjs_amd_system_umd_es2015_or_none_6046",message:"Argument for '--module' option must be 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'none'."},Argument_for_target_option_must_be_ES3_ES5_or_ES2015:{code:6047,category:e.DiagnosticCategory.Error,key:"Argument_for_target_option_must_be_ES3_ES5_or_ES2015_6047",message:"Argument for '--target' option must be 'ES3', 'ES5', or 'ES2015'."},Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1:{code:6048,category:e.DiagnosticCategory.Error,
key:"Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048",message:"Locale must be of the form <language> or <language>-<territory>. For example '{0}' or '{1}'."},Unsupported_locale_0:{code:6049,category:e.DiagnosticCategory.Error,key:"Unsupported_locale_0_6049",message:"Unsupported locale '{0}'."},Unable_to_open_file_0:{code:6050,category:e.DiagnosticCategory.Error,key:"Unable_to_open_file_0_6050",message:"Unable to open file '{0}'."},Corrupted_locale_file_0:{code:6051,category:e.DiagnosticCategory.Error,key:"Corrupted_locale_file_0_6051",message:"Corrupted locale file {0}."},Raise_error_on_expressions_and_declarations_with_an_implied_any_type:{code:6052,category:e.DiagnosticCategory.Message,key:"Raise_error_on_expressions_and_declarations_with_an_implied_any_type_6052",message:"Raise error on expressions and declarations with an implied 'any' type."},File_0_not_found:{code:6053,category:e.DiagnosticCategory.Error,key:"File_0_not_found_6053",message:"File '{0}' not found."},File_0_has_unsupported_extension_The_only_supported_extensions_are_1:{code:6054,category:e.DiagnosticCategory.Error,key:"File_0_has_unsupported_extension_The_only_supported_extensions_are_1_6054",message:"File '{0}' has unsupported extension. The only supported extensions are {1}."},Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures:{code:6055,category:e.DiagnosticCategory.Message,key:"Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures_6055",message:"Suppress noImplicitAny errors for indexing objects lacking index signatures."},Do_not_emit_declarations_for_code_that_has_an_internal_annotation:{code:6056,category:e.DiagnosticCategory.Message,key:"Do_not_emit_declarations_for_code_that_has_an_internal_annotation_6056",message:"Do not emit declarations for code that has an '@internal' annotation."},Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir:{code:6058,category:e.DiagnosticCategory.Message,key:"Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDi_6058",message:"Specifies the root directory of input files. Use to control the output directory structure with --outDir."},File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files:{code:6059,category:e.DiagnosticCategory.Error,key:"File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files_6059",message:"File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files."},Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix:{code:6060,category:e.DiagnosticCategory.Message,key:"Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060",message:"Specifies the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)."},NEWLINE:{code:6061,category:e.DiagnosticCategory.Message,key:"NEWLINE_6061",message:"NEWLINE"},Argument_for_newLine_option_must_be_CRLF_or_LF:{code:6062,category:e.DiagnosticCategory.Error,key:"Argument_for_newLine_option_must_be_CRLF_or_LF_6062",message:"Argument for '--newLine' option must be 'CRLF' or 'LF'."},Argument_for_moduleResolution_option_must_be_node_or_classic:{code:6063,category:e.DiagnosticCategory.Error,key:"Argument_for_moduleResolution_option_must_be_node_or_classic_6063",message:"Argument for '--moduleResolution' option must be 'node' or 'classic'."},Enables_experimental_support_for_ES7_decorators:{code:6065,category:e.DiagnosticCategory.Message,key:"Enables_experimental_support_for_ES7_decorators_6065",message:"Enables experimental support for ES7 decorators."},Enables_experimental_support_for_emitting_type_metadata_for_decorators:{code:6066,category:e.DiagnosticCategory.Message,key:"Enables_experimental_support_for_emitting_type_metadata_for_decorators_6066",message:"Enables experimental support for emitting type metadata for decorators."},Enables_experimental_support_for_ES7_async_functions:{code:6068,category:e.DiagnosticCategory.Message,key:"Enables_experimental_support_for_ES7_async_functions_6068",message:"Enables experimental support for ES7 async functions."},Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6:{code:6069,category:e.DiagnosticCategory.Message,key:"Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069",message:"Specifies module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)."},Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file:{code:6070,category:e.DiagnosticCategory.Message,key:"Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070",message:"Initializes a TypeScript project and creates a tsconfig.json file."},Successfully_created_a_tsconfig_json_file:{code:6071,category:e.DiagnosticCategory.Message,key:"Successfully_created_a_tsconfig_json_file_6071",message:"Successfully created a tsconfig.json file."},Suppress_excess_property_checks_for_object_literals:{code:6072,category:e.DiagnosticCategory.Message,key:"Suppress_excess_property_checks_for_object_literals_6072",message:"Suppress excess property checks for object literals."},Stylize_errors_and_messages_using_color_and_context_experimental:{code:6073,category:e.DiagnosticCategory.Message,key:"Stylize_errors_and_messages_using_color_and_context_experimental_6073",message:"Stylize errors and messages using color and context. (experimental)"},Do_not_report_errors_on_unused_labels:{code:6074,category:e.DiagnosticCategory.Message,key:"Do_not_report_errors_on_unused_labels_6074",message:"Do not report errors on unused labels."},Report_error_when_not_all_code_paths_in_function_return_a_value:{code:6075,category:e.DiagnosticCategory.Message,key:"Report_error_when_not_all_code_paths_in_function_return_a_value_6075",message:"Report error when not all code paths in function return a value."},Report_errors_for_fallthrough_cases_in_switch_statement:{code:6076,category:e.DiagnosticCategory.Message,key:"Report_errors_for_fallthrough_cases_in_switch_statement_6076",message:"Report errors for fallthrough cases in switch statement."},Do_not_report_errors_on_unreachable_code:{code:6077,category:e.DiagnosticCategory.Message,key:"Do_not_report_errors_on_unreachable_code_6077",message:"Do not report errors on unreachable code."},Disallow_inconsistently_cased_references_to_the_same_file:{code:6078,category:e.DiagnosticCategory.Message,key:"Disallow_inconsistently_cased_references_to_the_same_file_6078",message:"Disallow inconsistently-cased references to the same file."},Specify_JSX_code_generation_Colon_preserve_or_react:{code:6080,category:e.DiagnosticCategory.Message,key:"Specify_JSX_code_generation_Colon_preserve_or_react_6080",message:"Specify JSX code generation: 'preserve' or 'react'"},Argument_for_jsx_must_be_preserve_or_react:{code:6081,category:e.DiagnosticCategory.Message,key:"Argument_for_jsx_must_be_preserve_or_react_6081",message:"Argument for '--jsx' must be 'preserve' or 'react'."},Only_amd_and_system_modules_are_supported_alongside_0:{code:6082,category:e.DiagnosticCategory.Error,key:"Only_amd_and_system_modules_are_supported_alongside_0_6082",message:"Only 'amd' and 'system' modules are supported alongside --{0}."},Allow_javascript_files_to_be_compiled:{code:6083,category:e.DiagnosticCategory.Message,key:"Allow_javascript_files_to_be_compiled_6083",message:"Allow javascript files to be compiled."},Specifies_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit:{code:6084,category:e.DiagnosticCategory.Message,key:"Specifies_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit_6084",message:"Specifies the object invoked for createElement and __spread when targeting 'react' JSX emit"},Option_0_should_have_array_of_strings_as_a_value:{code:6103,category:e.DiagnosticCategory.Error,key:"Option_0_should_have_array_of_strings_as_a_value_6103",message:"Option '{0}' should have array of strings as a value."},Do_not_emit_use_strict_directives_in_module_output:{code:6112,category:e.DiagnosticCategory.Message,key:"Do_not_emit_use_strict_directives_in_module_output_6112",message:"Do not emit 'use strict' directives in module output."},Variable_0_implicitly_has_an_1_type:{code:7005,category:e.DiagnosticCategory.Error,key:"Variable_0_implicitly_has_an_1_type_7005",message:"Variable '{0}' implicitly has an '{1}' type."},Parameter_0_implicitly_has_an_1_type:{code:7006,category:e.DiagnosticCategory.Error,key:"Parameter_0_implicitly_has_an_1_type_7006",message:"Parameter '{0}' implicitly has an '{1}' type."},Member_0_implicitly_has_an_1_type:{code:7008,category:e.DiagnosticCategory.Error,key:"Member_0_implicitly_has_an_1_type_7008",message:"Member '{0}' implicitly has an '{1}' type."},new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type:{code:7009,category:e.DiagnosticCategory.Error,key:"new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type_7009",message:"'new' expression, whose target lacks a construct signature, implicitly has an 'any' type."},_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type:{code:7010,category:e.DiagnosticCategory.Error,key:"_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010",message:"'{0}', which lacks return-type annotation, implicitly has an '{1}' return type."},Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type:{code:7011,category:e.DiagnosticCategory.Error,key:"Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7011",message:"Function expression, which lacks return-type annotation, implicitly has an '{0}' return type."},Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type:{code:7013,category:e.DiagnosticCategory.Error,key:"Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7013",message:"Construct signature, which lacks return-type annotation, implicitly has an 'any' return type."},Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number:{code:7015,category:e.DiagnosticCategory.Error,key:"Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015",message:"Element implicitly has an 'any' type because index expression is not of type 'number'."},Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation:{code:7016,category:e.DiagnosticCategory.Error,key:"Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation_7016",message:"Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation."},Index_signature_of_object_type_implicitly_has_an_any_type:{code:7017,category:e.DiagnosticCategory.Error,key:"Index_signature_of_object_type_implicitly_has_an_any_type_7017",message:"Index signature of object type implicitly has an 'any' type."},Object_literal_s_property_0_implicitly_has_an_1_type:{code:7018,category:e.DiagnosticCategory.Error,key:"Object_literal_s_property_0_implicitly_has_an_1_type_7018",message:"Object literal's property '{0}' implicitly has an '{1}' type."},Rest_parameter_0_implicitly_has_an_any_type:{code:7019,category:e.DiagnosticCategory.Error,key:"Rest_parameter_0_implicitly_has_an_any_type_7019",message:"Rest parameter '{0}' implicitly has an 'any[]' type."},Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type:{code:7020,category:e.DiagnosticCategory.Error,key:"Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7020",message:"Call signature, which lacks return-type annotation, implicitly has an 'any' return type."},_0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer:{code:7022,category:e.DiagnosticCategory.Error,key:"_0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or__7022",message:"'{0}' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer."},_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions:{code:7023,category:e.DiagnosticCategory.Error,key:"_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_reference_7023",message:"'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions."},Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions:{code:7024,category:e.DiagnosticCategory.Error,key:"Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_ref_7024",message:"Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions."},Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type:{code:7025,category:e.DiagnosticCategory.Error,key:"Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025",message:"Generator implicitly has type '{0}' because it does not yield any values. Consider supplying a return type."},JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists:{code:7026,category:e.DiagnosticCategory.Error,key:"JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists_7026",message:"JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists"},Unreachable_code_detected:{code:7027,category:e.DiagnosticCategory.Error,key:"Unreachable_code_detected_7027",message:"Unreachable code detected."},Unused_label:{code:7028,category:e.DiagnosticCategory.Error,key:"Unused_label_7028",message:"Unused label."},Fallthrough_case_in_switch:{code:7029,category:e.DiagnosticCategory.Error,key:"Fallthrough_case_in_switch_7029",message:"Fallthrough case in switch."},Not_all_code_paths_return_a_value:{code:7030,category:e.DiagnosticCategory.Error,key:"Not_all_code_paths_return_a_value_7030",message:"Not all code paths return a value."},You_cannot_rename_this_element:{code:8e3,category:e.DiagnosticCategory.Error,key:"You_cannot_rename_this_element_8000",message:"You cannot rename this element."},You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library:{code:8001,category:e.DiagnosticCategory.Error,key:"You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001",message:"You cannot rename elements that are defined in the standard TypeScript library."},import_can_only_be_used_in_a_ts_file:{code:8002,category:e.DiagnosticCategory.Error,key:"import_can_only_be_used_in_a_ts_file_8002",message:"'import ... =' can only be used in a .ts file."},export_can_only_be_used_in_a_ts_file:{code:8003,category:e.DiagnosticCategory.Error,key:"export_can_only_be_used_in_a_ts_file_8003",message:"'export=' can only be used in a .ts file."},type_parameter_declarations_can_only_be_used_in_a_ts_file:{code:8004,category:e.DiagnosticCategory.Error,key:"type_parameter_declarations_can_only_be_used_in_a_ts_file_8004",message:"'type parameter declarations' can only be used in a .ts file."},implements_clauses_can_only_be_used_in_a_ts_file:{code:8005,category:e.DiagnosticCategory.Error,key:"implements_clauses_can_only_be_used_in_a_ts_file_8005",message:"'implements clauses' can only be used in a .ts file."},interface_declarations_can_only_be_used_in_a_ts_file:{code:8006,category:e.DiagnosticCategory.Error,key:"interface_declarations_can_only_be_used_in_a_ts_file_8006",message:"'interface declarations' can only be used in a .ts file."},module_declarations_can_only_be_used_in_a_ts_file:{code:8007,category:e.DiagnosticCategory.Error,key:"module_declarations_can_only_be_used_in_a_ts_file_8007",message:"'module declarations' can only be used in a .ts file."},type_aliases_can_only_be_used_in_a_ts_file:{code:8008,category:e.DiagnosticCategory.Error,key:"type_aliases_can_only_be_used_in_a_ts_file_8008",message:"'type aliases' can only be used in a .ts file."},_0_can_only_be_used_in_a_ts_file:{code:8009,category:e.DiagnosticCategory.Error,key:"_0_can_only_be_used_in_a_ts_file_8009",message:"'{0}' can only be used in a .ts file."},types_can_only_be_used_in_a_ts_file:{code:8010,category:e.DiagnosticCategory.Error,key:"types_can_only_be_used_in_a_ts_file_8010",message:"'types' can only be used in a .ts file."},type_arguments_can_only_be_used_in_a_ts_file:{code:8011,category:e.DiagnosticCategory.Error,key:"type_arguments_can_only_be_used_in_a_ts_file_8011",message:"'type arguments' can only be used in a .ts file."},parameter_modifiers_can_only_be_used_in_a_ts_file:{code:8012,category:e.DiagnosticCategory.Error,key:"parameter_modifiers_can_only_be_used_in_a_ts_file_8012",message:"'parameter modifiers' can only be used in a .ts file."},property_declarations_can_only_be_used_in_a_ts_file:{code:8014,category:e.DiagnosticCategory.Error,key:"property_declarations_can_only_be_used_in_a_ts_file_8014",message:"'property declarations' can only be used in a .ts file."},enum_declarations_can_only_be_used_in_a_ts_file:{code:8015,category:e.DiagnosticCategory.Error,key:"enum_declarations_can_only_be_used_in_a_ts_file_8015",message:"'enum declarations' can only be used in a .ts file."},type_assertion_expressions_can_only_be_used_in_a_ts_file:{code:8016,category:e.DiagnosticCategory.Error,key:"type_assertion_expressions_can_only_be_used_in_a_ts_file_8016",message:"'type assertion expressions' can only be used in a .ts file."},Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses:{code:9002,category:e.DiagnosticCategory.Error,key:"Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002",message:"Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses."},class_expressions_are_not_currently_supported:{code:9003,category:e.DiagnosticCategory.Error,key:"class_expressions_are_not_currently_supported_9003",message:"'class' expressions are not currently supported."},JSX_attributes_must_only_be_assigned_a_non_empty_expression:{code:17e3,category:e.DiagnosticCategory.Error,key:"JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000",message:"JSX attributes must only be assigned a non-empty 'expression'."},JSX_elements_cannot_have_multiple_attributes_with_the_same_name:{code:17001,category:e.DiagnosticCategory.Error,key:"JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001",message:"JSX elements cannot have multiple attributes with the same name."},Expected_corresponding_JSX_closing_tag_for_0:{code:17002,category:e.DiagnosticCategory.Error,key:"Expected_corresponding_JSX_closing_tag_for_0_17002",message:"Expected corresponding JSX closing tag for '{0}'."},JSX_attribute_expected:{code:17003,category:e.DiagnosticCategory.Error,key:"JSX_attribute_expected_17003",message:"JSX attribute expected."},Cannot_use_JSX_unless_the_jsx_flag_is_provided:{code:17004,category:e.DiagnosticCategory.Error,key:"Cannot_use_JSX_unless_the_jsx_flag_is_provided_17004",message:"Cannot use JSX unless the '--jsx' flag is provided."},A_constructor_cannot_contain_a_super_call_when_its_class_extends_null:{code:17005,category:e.DiagnosticCategory.Error,key:"A_constructor_cannot_contain_a_super_call_when_its_class_extends_null_17005",message:"A constructor cannot contain a 'super' call when its class extends 'null'"},An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses:{code:17006,category:e.DiagnosticCategory.Error,key:"An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006",message:"An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses."},A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses:{code:17007,category:e.DiagnosticCategory.Error,key:"A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007",message:"A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses."},JSX_element_0_has_no_corresponding_closing_tag:{code:17008,category:e.DiagnosticCategory.Error,key:"JSX_element_0_has_no_corresponding_closing_tag_17008",message:"JSX element '{0}' has no corresponding closing tag."},super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class:{code:17009,category:e.DiagnosticCategory.Error,key:"super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009",message:"'super' must be called before accessing 'this' in the constructor of a derived class."},Unknown_typing_option_0:{code:17010,category:e.DiagnosticCategory.Error,key:"Unknown_typing_option_0_17010",message:"Unknown typing option '{0}'."},Too_many_JavaScript_files_in_the_project_Consider_specifying_the_exclude_setting_in_project_configuration_to_limit_included_source_folders_The_likely_folder_to_exclude_is_0_To_disable_the_project_size_limit_set_the_disableSizeLimit_compiler_option_to_true:{code:17012,category:e.DiagnosticCategory.Error,key:"Too_many_JavaScript_files_in_the_project_Consider_specifying_the_exclude_setting_in_project_configur_17012",message:"Too many JavaScript files in the project. Consider specifying the 'exclude' setting in project configuration to limit included source folders. The likely folder to exclude is '{0}'. To disable the project size limit, set the 'disableSizeLimit' compiler option to 'true'."}}}(ts||(ts={}));var ts;!function(e){function t(e){return e>=69}function n(e,t){if(e<t[0])return!1;for(var n,r=0,a=t.length;a>r+1;){if(n=r+(a-r)/2,n-=n%2,t[n]<=e&&e<=t[n+1])return!0;e<t[n]?a=n:r=n+2}return!1}function r(e,t){return t>=1?n(e,F):n(e,R)}function a(e,t){return t>=1?n(e,L):n(e,I)}function i(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&(t[e[n]]=n);return t}function o(e){return M[e]}function s(e){return O[e]}function c(e){for(var t=new Array,n=0,r=0;n<e.length;){var a=e.charCodeAt(n);switch(n++,a){case 13:10===e.charCodeAt(n)&&n++;case 10:t.push(r),r=n;break;default:a>127&&m(a)&&(t.push(r),r=n)}}return t.push(r),t}function _(e,t,n){return u(l(e),t,n)}function u(t,n,r){return e.Debug.assert(n>=0&&n<t.length),t[n]+r}function l(e){return e.lineMap||(e.lineMap=c(e.text))}function d(t,n){var r=e.binarySearch(t,n);return 0>r&&(r=~r-1,e.Debug.assert(-1!==r,"position cannot precede the beginning of the file")),{line:r,character:n-t[r]}}function p(e,t){return d(l(e),t)}function f(e){return 32===e||9===e||11===e||12===e||160===e||133===e||5760===e||e>=8192&&8203>=e||8239===e||8287===e||12288===e||65279===e}function m(e){return 10===e||13===e||8232===e||8233===e}function g(e){return e>=48&&57>=e}function y(e){return e>=48&&55>=e}function h(e,t){var n=e.charCodeAt(t);switch(n){case 13:case 10:case 9:case 11:case 12:case 32:case 47:case 60:case 61:case 62:return!0;case 35:return 0===t;default:return n>127}}function v(e,t,n){if(!(t>=0))return t;for(;;){var r=e.charCodeAt(t);switch(r){case 13:10===e.charCodeAt(t+1)&&t++;case 10:if(t++,n)return t;continue;case 9:case 11:case 12:case 32:t++;continue;case 47:if(47===e.charCodeAt(t+1)){for(t+=2;t<e.length&&!m(e.charCodeAt(t));)t++;continue}if(42===e.charCodeAt(t+1)){for(t+=2;t<e.length;){if(42===e.charCodeAt(t)&&47===e.charCodeAt(t+1)){t+=2;break}t++}continue}break;case 60:case 61:case 62:if(k(e,t)){t=b(e,t);continue}break;case 35:if(0===t&&x(e,t)){t=C(e,t);continue}break;default:if(r>127&&(f(r)||m(r))){t++;continue}}return t}}function k(t,n){if(e.Debug.assert(n>=0),0===n||m(t.charCodeAt(n-1))){var r=t.charCodeAt(n);if(n+z<t.length){for(var a=0,i=z;i>a;a++)if(t.charCodeAt(n+a)!==r)return!1;return 61===r||32===t.charCodeAt(n+z)}}return!1}function b(t,n,r){r&&r(e.Diagnostics.Merge_conflict_marker_encountered,z);var a=t.charCodeAt(n),i=t.length;if(60===a||62===a)for(;i>n&&!m(t.charCodeAt(n));)n++;else for(e.Debug.assert(61===a);i>n;){var o=t.charCodeAt(n);if(62===o&&k(t,n))break;n++}return n}function x(t,n){return e.Debug.assert(0===n),K.test(t)}function C(e,t){var n=K.exec(e)[0];return t+=n.length}function D(t,n,r){for(var a,i=r||0===n;n<t.length;){var o=t.charCodeAt(n);switch(o){case 13:10===t.charCodeAt(n+1)&&n++;case 10:if(n++,r)return a;i=!0,a&&a.length&&(e.lastOrUndefined(a).hasTrailingNewLine=!0);continue;case 9:case 11:case 12:case 32:n++;continue;case 47:var s=t.charCodeAt(n+1),c=!1;if(47===s||42===s){var _=47===s?2:3,u=n;if(n+=2,47===s)for(;n<t.length;){if(m(t.charCodeAt(n))){c=!0;break}n++}else for(;n<t.length;){if(42===t.charCodeAt(n)&&47===t.charCodeAt(n+1)){n+=2;break}n++}i&&(a||(a=[]),a.push({pos:u,end:n,hasTrailingNewLine:c,kind:_}));continue}break;default:if(o>127&&(f(o)||m(o))){a&&a.length&&m(o)&&(e.lastOrUndefined(a).hasTrailingNewLine=!0),n++;continue}}return a}return a}function S(e,t){return D(e,t,!1)}function T(e,t){return D(e,t,!0)}function E(e){return K.test(e)?K.exec(e)[0]:void 0}function w(e,t){return e>=65&&90>=e||e>=97&&122>=e||36===e||95===e||e>127&&r(e,t)}function A(e,t){return e>=65&&90>=e||e>=97&&122>=e||e>=48&&57>=e||36===e||95===e||e>127&&a(e,t)}function P(e,t){if(!w(e.charCodeAt(0),t))return!1;for(var n=1,r=e.length;r>n;n++)if(!A(e.charCodeAt(n),t))return!1;return!0}function N(n,r,a,i,o,s,c){function _(e,t){o&&o(e,t||0)}function u(){for(var t=ee;g(i.charCodeAt(ee));)ee++;if(46===i.charCodeAt(ee))for(ee++;g(i.charCodeAt(ee));)ee++;var n=ee;if(69===i.charCodeAt(ee)||101===i.charCodeAt(ee))if(ee++,43!==i.charCodeAt(ee)&&45!==i.charCodeAt(ee)||ee++,g(i.charCodeAt(ee))){for(ee++;g(i.charCodeAt(ee));)ee++;n=ee}else _(e.Diagnostics.Digit_expected);return""+ +i.substring(t,n)}function l(){for(var e=ee;y(i.charCodeAt(ee));)ee++;return+i.substring(e,ee)}function d(e){return h(e,!1)}function p(e){return h(e,!0)}function h(e,t){for(var n=0,r=0;e>n||t;){var a=i.charCodeAt(ee);if(a>=48&&57>=a)r=16*r+a-48;else if(a>=65&&70>=a)r=16*r+a-65+10;else{if(!(a>=97&&102>=a))break;r=16*r+a-97+10}ee++,n++}return e>n&&(r=-1),r}function v(){var t=i.charCodeAt(ee);ee++;for(var n="",r=ee;;){if(ee>=te){n+=i.substring(r,ee),ce=!0,_(e.Diagnostics.Unterminated_string_literal);break}var a=i.charCodeAt(ee);if(a===t){n+=i.substring(r,ee),ee++;break}if(92!==a){if(m(a)){n+=i.substring(r,ee),ce=!0,_(e.Diagnostics.Unterminated_string_literal);break}ee++}else n+=i.substring(r,ee),n+=S(),r=ee}return n}function D(){var t=96===i.charCodeAt(ee);ee++;for(var n,r=ee,a="";;){if(ee>=te){a+=i.substring(r,ee),ce=!0,_(e.Diagnostics.Unterminated_template_literal),n=t?11:14;break}var o=i.charCodeAt(ee);if(96===o){a+=i.substring(r,ee),ee++,n=t?11:14;break}if(36===o&&te>ee+1&&123===i.charCodeAt(ee+1)){a+=i.substring(r,ee),ee+=2,n=t?12:13;break}92!==o?13!==o?ee++:(a+=i.substring(r,ee),ee++,te>ee&&10===i.charCodeAt(ee)&&ee++,a+="\n",r=ee):(a+=i.substring(r,ee),a+=S(),r=ee)}return e.Debug.assert(void 0!==n),ie=a,n}function S(){if(ee++,ee>=te)return _(e.Diagnostics.Unexpected_end_of_text),"";var t=i.charCodeAt(ee);switch(ee++,t){case 48:return"\x00";case 98:return"\b";case 116:return" ";case 110:return"\n";case 118:return"\x0B";case 102:return"\f";case 114:return"\r";case 39:return"'";case 34:return'"';case 117:return te>ee&&123===i.charCodeAt(ee)?(se=!0,ee++,E()):T(4);case 120:return T(2);case 13:te>ee&&10===i.charCodeAt(ee)&&ee++;case 10:case 8232:case 8233:return"";default:return String.fromCharCode(t)}}function T(t){var n=d(t);return n>=0?String.fromCharCode(n):(_(e.Diagnostics.Hexadecimal_digit_expected),"")}function E(){var t=p(1),n=!1;return 0>t?(_(e.Diagnostics.Hexadecimal_digit_expected),n=!0):t>1114111&&(_(e.Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive),n=!0),ee>=te?(_(e.Diagnostics.Unexpected_end_of_text),n=!0):125===i.charCodeAt(ee)?ee++:(_(e.Diagnostics.Unterminated_Unicode_escape_sequence),n=!0),n?"":P(t)}function P(t){if(e.Debug.assert(t>=0&&1114111>=t),65535>=t)return String.fromCharCode(t);var n=Math.floor((t-65536)/1024)+55296,r=(t-65536)%1024+56320;return String.fromCharCode(n,r)}function N(){if(te>ee+5&&117===i.charCodeAt(ee+1)){var e=ee;ee+=2;var t=d(4);return ee=e,t}return-1}function R(){for(var e="",t=ee;te>ee;){var r=i.charCodeAt(ee);if(A(r,n))ee++;else{if(92!==r)break;if(r=N(),!(r>=0&&A(r,n)))break;e+=i.substring(t,ee),e+=String.fromCharCode(r),ee+=6,t=ee}}return e+=i.substring(t,ee)}function I(){var e=ie.length;if(e>=2&&11>=e){var t=ie.charCodeAt(0);if(t>=97&&122>=t&&B.call(O,ie))return ae=O[ie]}return ae=69}function F(t){e.Debug.assert(2!==t||8!==t,"Expected either base 2 or base 8");for(var n=0,r=0;;){var a=i.charCodeAt(ee),o=a-48;if(!g(a)||o>=t)break;n=n*t+o,ee++,r++}return 0===r?-1:n}function L(){for(ne=ee,se=!1,oe=!1,ce=!1;;){if(re=ee,ee>=te)return ae=1;var t=i.charCodeAt(ee);if(35===t&&0===ee&&x(i,ee)){if(ee=C(i,ee),r)continue;return ae=6}switch(t){case 10:case 13:if(oe=!0,r){ee++;continue}return 13===t&&te>ee+1&&10===i.charCodeAt(ee+1)?ee+=2:ee++,ae=4;case 9:case 11:case 12:case 32:if(r){ee++;continue}for(;te>ee&&f(i.charCodeAt(ee));)ee++;return ae=5;case 33:return 61===i.charCodeAt(ee+1)?61===i.charCodeAt(ee+2)?(ee+=3,ae=33):(ee+=2,ae=31):(ee++,ae=49);case 34:case 39:return ie=v(),ae=9;case 96:return ae=D();case 37:return 61===i.charCodeAt(ee+1)?(ee+=2,ae=62):(ee++,ae=40);case 38:return 38===i.charCodeAt(ee+1)?(ee+=2,ae=51):61===i.charCodeAt(ee+1)?(ee+=2,ae=66):(ee++,ae=46);case 40:return ee++,ae=17;case 41:return ee++,ae=18;case 42:return 61===i.charCodeAt(ee+1)?(ee+=2,ae=59):42===i.charCodeAt(ee+1)?61===i.charCodeAt(ee+2)?(ee+=3,ae=60):(ee+=2,ae=38):(ee++,ae=37);case 43:return 43===i.charCodeAt(ee+1)?(ee+=2,ae=41):61===i.charCodeAt(ee+1)?(ee+=2,ae=57):(ee++,ae=35);case 44:return ee++,ae=24;case 45:return 45===i.charCodeAt(ee+1)?(ee+=2,ae=42):61===i.charCodeAt(ee+1)?(ee+=2,ae=58):(ee++,ae=36);case 46:return g(i.charCodeAt(ee+1))?(ie=u(),ae=8):46===i.charCodeAt(ee+1)&&46===i.charCodeAt(ee+2)?(ee+=3,ae=22):(ee++,ae=21);case 47:if(47===i.charCodeAt(ee+1)){for(ee+=2;te>ee&&!m(i.charCodeAt(ee));)ee++;if(r)continue;return ae=2}if(42===i.charCodeAt(ee+1)){ee+=2;for(var o=!1;te>ee;){var s=i.charCodeAt(ee);if(42===s&&47===i.charCodeAt(ee+1)){ee+=2,o=!0;break}m(s)&&(oe=!0),ee++}if(o||_(e.Diagnostics.Asterisk_Slash_expected),r)continue;return ce=!o,ae=3}return 61===i.charCodeAt(ee+1)?(ee+=2,ae=61):(ee++,ae=39);case 48:if(te>ee+2&&(88===i.charCodeAt(ee+1)||120===i.charCodeAt(ee+1))){ee+=2;var c=p(1);return 0>c&&(_(e.Diagnostics.Hexadecimal_digit_expected),c=0),ie=""+c,ae=8}if(te>ee+2&&(66===i.charCodeAt(ee+1)||98===i.charCodeAt(ee+1))){ee+=2;var c=F(2);return 0>c&&(_(e.Diagnostics.Binary_digit_expected),c=0),ie=""+c,ae=8}if(te>ee+2&&(79===i.charCodeAt(ee+1)||111===i.charCodeAt(ee+1))){ee+=2;var c=F(8);return 0>c&&(_(e.Diagnostics.Octal_digit_expected),c=0),ie=""+c,ae=8}if(te>ee+1&&y(i.charCodeAt(ee+1)))return ie=""+l(),ae=8;case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return ie=u(),ae=8;case 58:return ee++,ae=54;case 59:return ee++,ae=23;case 60:if(k(i,ee)){if(ee=b(i,ee,_),r)continue;return ae=7}return 60===i.charCodeAt(ee+1)?61===i.charCodeAt(ee+2)?(ee+=3,ae=63):(ee+=2,ae=43):61===i.charCodeAt(ee+1)?(ee+=2,ae=28):1===a&&47===i.charCodeAt(ee+1)&&42!==i.charCodeAt(ee+2)?(ee+=2,ae=26):(ee++,ae=25);case 61:if(k(i,ee)){if(ee=b(i,ee,_),r)continue;
return ae=7}return 61===i.charCodeAt(ee+1)?61===i.charCodeAt(ee+2)?(ee+=3,ae=32):(ee+=2,ae=30):62===i.charCodeAt(ee+1)?(ee+=2,ae=34):(ee++,ae=56);case 62:if(k(i,ee)){if(ee=b(i,ee,_),r)continue;return ae=7}return ee++,ae=27;case 63:return ee++,ae=53;case 91:return ee++,ae=19;case 93:return ee++,ae=20;case 94:return 61===i.charCodeAt(ee+1)?(ee+=2,ae=68):(ee++,ae=48);case 123:return ee++,ae=15;case 124:return 124===i.charCodeAt(ee+1)?(ee+=2,ae=52):61===i.charCodeAt(ee+1)?(ee+=2,ae=67):(ee++,ae=47);case 125:return ee++,ae=16;case 126:return ee++,ae=50;case 64:return ee++,ae=55;case 92:var d=N();return d>=0&&w(d,n)?(ee+=6,ie=String.fromCharCode(d)+R(),ae=I()):(_(e.Diagnostics.Invalid_character),ee++,ae=0);default:if(w(t,n)){for(ee++;te>ee&&A(t=i.charCodeAt(ee),n);)ee++;return ie=i.substring(re,ee),92===t&&(ie+=R()),ae=I()}if(f(t)){ee++;continue}if(m(t)){oe=!0,ee++;continue}return _(e.Diagnostics.Invalid_character),ee++,ae=0}}}function M(){if(27===ae){if(62===i.charCodeAt(ee))return 62===i.charCodeAt(ee+1)?61===i.charCodeAt(ee+2)?(ee+=3,ae=65):(ee+=2,ae=45):61===i.charCodeAt(ee+1)?(ee+=2,ae=64):(ee++,ae=44);if(61===i.charCodeAt(ee))return ee++,ae=29}return ae}function z(){if(39===ae||61===ae){for(var t=re+1,r=!1,a=!1;;){if(t>=te){ce=!0,_(e.Diagnostics.Unterminated_regular_expression_literal);break}var o=i.charCodeAt(t);if(m(o)){ce=!0,_(e.Diagnostics.Unterminated_regular_expression_literal);break}if(r)r=!1;else{if(47===o&&!a){t++;break}91===o?a=!0:92===o?r=!0:93===o&&(a=!1)}t++}for(;te>t&&A(i.charCodeAt(t),n);)t++;ee=t,ie=i.substring(re,ee),ae=10}return ae}function K(){return e.Debug.assert(16===ae,"'reScanTemplateToken' should only be called on a '}'"),ee=re,ae=D()}function j(){return ee=re=ne,ae=J()}function J(){if(ne=re=ee,ee>=te)return ae=1;var e=i.charCodeAt(ee);if(60===e)return 47===i.charCodeAt(ee+1)?(ee+=2,ae=26):(ee++,ae=25);if(123===e)return ee++,ae=15;for(;te>ee&&(ee++,e=i.charCodeAt(ee),123!==e&&60!==e););return ae=239}function U(){if(t(ae)){for(var e=ee;te>ee;){var r=i.charCodeAt(ee);if(45!==r&&(e===ee?!w(r,n):!A(r,n)))break;ee++}ie+=i.substr(e,ee-e)}return ae}function q(){if(ee>=te)return ae=1;ne=ee;for(var e=i.charCodeAt(ee);te>ee&&(e=i.charCodeAt(ee),f(e));)ee++;switch(re=ee,e){case 64:return ee+=1,ae=55;case 10:case 13:return ee+=1,ae=4;case 42:return ee+=1,ae=37;case 123:return ee+=1,ae=15;case 125:return ee+=1,ae=16;case 91:return ee+=1,ae=19;case 93:return ee+=1,ae=20;case 61:return ee+=1,ae=56;case 44:return ee+=1,ae=24}if(w(e,2)){for(ee++;A(i.charCodeAt(ee),2)&&te>ee;)ee++;return ae=69}return ee+=1,ae=0}function W(e,t){var n=ee,r=ne,a=re,i=ae,o=ie,s=oe,c=e();return c&&!t||(ee=n,ne=r,re=a,ae=i,ie=o,oe=s),c}function V(e,t,n){var r=te,a=ee,o=ne,s=re,c=ae,_=oe,u=ie,l=se,d=ce;X(i,e,t);var p=n();return te=r,ee=a,ne=o,re=s,ae=c,oe=_,ie=u,se=l,ce=d,p}function H(e){return W(e,!0)}function G(e){return W(e,!1)}function X(e,t,n){i=e||"",te=void 0===n?i.length:t+n,Z(t||0)}function Q(e){o=e}function Y(e){n=e}function $(e){a=e}function Z(t){e.Debug.assert(t>=0),ee=t,ne=t,re=t,ae=0,oe=!1,ie=void 0,se=!1,ce=!1}void 0===a&&(a=0);var ee,te,ne,re,ae,ie,oe,se,ce;return X(i,s,c),{getStartPos:function(){return ne},getTextPos:function(){return ee},getToken:function(){return ae},getTokenPos:function(){return re},getTokenText:function(){return i.substring(re,ee)},getTokenValue:function(){return ie},hasExtendedUnicodeEscape:function(){return se},hasPrecedingLineBreak:function(){return oe},isIdentifier:function(){return 69===ae||ae>105},isReservedWord:function(){return ae>=70&&105>=ae},isUnterminated:function(){return ce},reScanGreaterToken:M,reScanSlashToken:z,reScanTemplateToken:K,scanJsxIdentifier:U,reScanJsxToken:j,scanJsxToken:J,scanJSDocToken:q,scan:L,setText:X,setScriptTarget:Y,setLanguageVariant:$,setOnError:Q,setTextPos:Z,tryScan:G,lookAhead:H,scanRange:V}}e.tokenIsIdentifierOrKeyword=t;var O={"abstract":115,any:117,as:116,"boolean":120,"break":70,"case":71,"catch":72,"class":73,"continue":75,"const":74,constructor:121,"debugger":76,declare:122,"default":77,"delete":78,"do":79,"else":80,"enum":81,"export":82,"extends":83,"false":84,"finally":85,"for":86,from:133,"function":87,get:123,"if":88,"implements":106,"import":89,"in":90,"instanceof":91,"interface":107,is:124,let:108,module:125,namespace:126,"new":92,"null":93,number:128,"package":109,"private":110,"protected":111,"public":112,require:127,global:134,"return":94,set:129,"static":113,string:130,"super":95,"switch":96,symbol:131,"this":97,"throw":98,"true":99,"try":100,type:132,"typeof":101,"var":102,"void":103,"while":104,"with":105,"yield":114,async:118,await:119,of:135,"{":15,"}":16,"(":17,")":18,"[":19,"]":20,".":21,"...":22,";":23,",":24,"<":25,">":27,"<=":28,">=":29,"==":30,"!=":31,"===":32,"!==":33,"=>":34,"+":35,"-":36,"**":38,"*":37,"/":39,"%":40,"++":41,"--":42,"<<":43,"</":26,">>":44,">>>":45,"&":46,"|":47,"^":48,"!":49,"~":50,"&&":51,"||":52,"?":53,":":54,"=":56,"+=":57,"-=":58,"*=":59,"**=":60,"/=":61,"%=":62,"<<=":63,">>=":64,">>>=":65,"&=":66,"|=":67,"^=":68,"@":55},R=[170,170,181,181,186,186,192,214,216,246,248,543,546,563,592,685,688,696,699,705,720,721,736,740,750,750,890,890,902,902,904,906,908,908,910,929,931,974,976,983,986,1011,1024,1153,1164,1220,1223,1224,1227,1228,1232,1269,1272,1273,1329,1366,1369,1369,1377,1415,1488,1514,1520,1522,1569,1594,1600,1610,1649,1747,1749,1749,1765,1766,1786,1788,1808,1808,1810,1836,1920,1957,2309,2361,2365,2365,2384,2384,2392,2401,2437,2444,2447,2448,2451,2472,2474,2480,2482,2482,2486,2489,2524,2525,2527,2529,2544,2545,2565,2570,2575,2576,2579,2600,2602,2608,2610,2611,2613,2614,2616,2617,2649,2652,2654,2654,2674,2676,2693,2699,2701,2701,2703,2705,2707,2728,2730,2736,2738,2739,2741,2745,2749,2749,2768,2768,2784,2784,2821,2828,2831,2832,2835,2856,2858,2864,2866,2867,2870,2873,2877,2877,2908,2909,2911,2913,2949,2954,2958,2960,2962,2965,2969,2970,2972,2972,2974,2975,2979,2980,2984,2986,2990,2997,2999,3001,3077,3084,3086,3088,3090,3112,3114,3123,3125,3129,3168,3169,3205,3212,3214,3216,3218,3240,3242,3251,3253,3257,3294,3294,3296,3297,3333,3340,3342,3344,3346,3368,3370,3385,3424,3425,3461,3478,3482,3505,3507,3515,3517,3517,3520,3526,3585,3632,3634,3635,3648,3654,3713,3714,3716,3716,3719,3720,3722,3722,3725,3725,3732,3735,3737,3743,3745,3747,3749,3749,3751,3751,3754,3755,3757,3760,3762,3763,3773,3773,3776,3780,3782,3782,3804,3805,3840,3840,3904,3911,3913,3946,3976,3979,4096,4129,4131,4135,4137,4138,4176,4181,4256,4293,4304,4342,4352,4441,4447,4514,4520,4601,4608,4614,4616,4678,4680,4680,4682,4685,4688,4694,4696,4696,4698,4701,4704,4742,4744,4744,4746,4749,4752,4782,4784,4784,4786,4789,4792,4798,4800,4800,4802,4805,4808,4814,4816,4822,4824,4846,4848,4878,4880,4880,4882,4885,4888,4894,4896,4934,4936,4954,5024,5108,5121,5740,5743,5750,5761,5786,5792,5866,6016,6067,6176,6263,6272,6312,7680,7835,7840,7929,7936,7957,7960,7965,7968,8005,8008,8013,8016,8023,8025,8025,8027,8027,8029,8029,8031,8061,8064,8116,8118,8124,8126,8126,8130,8132,8134,8140,8144,8147,8150,8155,8160,8172,8178,8180,8182,8188,8319,8319,8450,8450,8455,8455,8458,8467,8469,8469,8473,8477,8484,8484,8486,8486,8488,8488,8490,8493,8495,8497,8499,8505,8544,8579,12293,12295,12321,12329,12337,12341,12344,12346,12353,12436,12445,12446,12449,12538,12540,12542,12549,12588,12593,12686,12704,12727,13312,19893,19968,40869,40960,42124,44032,55203,63744,64045,64256,64262,64275,64279,64285,64285,64287,64296,64298,64310,64312,64316,64318,64318,64320,64321,64323,64324,64326,64433,64467,64829,64848,64911,64914,64967,65008,65019,65136,65138,65140,65140,65142,65276,65313,65338,65345,65370,65382,65470,65474,65479,65482,65487,65490,65495,65498,65500],I=[170,170,181,181,186,186,192,214,216,246,248,543,546,563,592,685,688,696,699,705,720,721,736,740,750,750,768,846,864,866,890,890,902,902,904,906,908,908,910,929,931,974,976,983,986,1011,1024,1153,1155,1158,1164,1220,1223,1224,1227,1228,1232,1269,1272,1273,1329,1366,1369,1369,1377,1415,1425,1441,1443,1465,1467,1469,1471,1471,1473,1474,1476,1476,1488,1514,1520,1522,1569,1594,1600,1621,1632,1641,1648,1747,1749,1756,1759,1768,1770,1773,1776,1788,1808,1836,1840,1866,1920,1968,2305,2307,2309,2361,2364,2381,2384,2388,2392,2403,2406,2415,2433,2435,2437,2444,2447,2448,2451,2472,2474,2480,2482,2482,2486,2489,2492,2492,2494,2500,2503,2504,2507,2509,2519,2519,2524,2525,2527,2531,2534,2545,2562,2562,2565,2570,2575,2576,2579,2600,2602,2608,2610,2611,2613,2614,2616,2617,2620,2620,2622,2626,2631,2632,2635,2637,2649,2652,2654,2654,2662,2676,2689,2691,2693,2699,2701,2701,2703,2705,2707,2728,2730,2736,2738,2739,2741,2745,2748,2757,2759,2761,2763,2765,2768,2768,2784,2784,2790,2799,2817,2819,2821,2828,2831,2832,2835,2856,2858,2864,2866,2867,2870,2873,2876,2883,2887,2888,2891,2893,2902,2903,2908,2909,2911,2913,2918,2927,2946,2947,2949,2954,2958,2960,2962,2965,2969,2970,2972,2972,2974,2975,2979,2980,2984,2986,2990,2997,2999,3001,3006,3010,3014,3016,3018,3021,3031,3031,3047,3055,3073,3075,3077,3084,3086,3088,3090,3112,3114,3123,3125,3129,3134,3140,3142,3144,3146,3149,3157,3158,3168,3169,3174,3183,3202,3203,3205,3212,3214,3216,3218,3240,3242,3251,3253,3257,3262,3268,3270,3272,3274,3277,3285,3286,3294,3294,3296,3297,3302,3311,3330,3331,3333,3340,3342,3344,3346,3368,3370,3385,3390,3395,3398,3400,3402,3405,3415,3415,3424,3425,3430,3439,3458,3459,3461,3478,3482,3505,3507,3515,3517,3517,3520,3526,3530,3530,3535,3540,3542,3542,3544,3551,3570,3571,3585,3642,3648,3662,3664,3673,3713,3714,3716,3716,3719,3720,3722,3722,3725,3725,3732,3735,3737,3743,3745,3747,3749,3749,3751,3751,3754,3755,3757,3769,3771,3773,3776,3780,3782,3782,3784,3789,3792,3801,3804,3805,3840,3840,3864,3865,3872,3881,3893,3893,3895,3895,3897,3897,3902,3911,3913,3946,3953,3972,3974,3979,3984,3991,3993,4028,4038,4038,4096,4129,4131,4135,4137,4138,4140,4146,4150,4153,4160,4169,4176,4185,4256,4293,4304,4342,4352,4441,4447,4514,4520,4601,4608,4614,4616,4678,4680,4680,4682,4685,4688,4694,4696,4696,4698,4701,4704,4742,4744,4744,4746,4749,4752,4782,4784,4784,4786,4789,4792,4798,4800,4800,4802,4805,4808,4814,4816,4822,4824,4846,4848,4878,4880,4880,4882,4885,4888,4894,4896,4934,4936,4954,4969,4977,5024,5108,5121,5740,5743,5750,5761,5786,5792,5866,6016,6099,6112,6121,6160,6169,6176,6263,6272,6313,7680,7835,7840,7929,7936,7957,7960,7965,7968,8005,8008,8013,8016,8023,8025,8025,8027,8027,8029,8029,8031,8061,8064,8116,8118,8124,8126,8126,8130,8132,8134,8140,8144,8147,8150,8155,8160,8172,8178,8180,8182,8188,8255,8256,8319,8319,8400,8412,8417,8417,8450,8450,8455,8455,8458,8467,8469,8469,8473,8477,8484,8484,8486,8486,8488,8488,8490,8493,8495,8497,8499,8505,8544,8579,12293,12295,12321,12335,12337,12341,12344,12346,12353,12436,12441,12442,12445,12446,12449,12542,12549,12588,12593,12686,12704,12727,13312,19893,19968,40869,40960,42124,44032,55203,63744,64045,64256,64262,64275,64279,64285,64296,64298,64310,64312,64316,64318,64318,64320,64321,64323,64324,64326,64433,64467,64829,64848,64911,64914,64967,65008,65019,65056,65059,65075,65076,65101,65103,65136,65138,65140,65140,65142,65276,65296,65305,65313,65338,65343,65343,65345,65370,65381,65470,65474,65479,65482,65487,65490,65495,65498,65500],F=[170,170,181,181,186,186,192,214,216,246,248,705,710,721,736,740,748,748,750,750,880,884,886,887,890,893,902,902,904,906,908,908,910,929,931,1013,1015,1153,1162,1319,1329,1366,1369,1369,1377,1415,1488,1514,1520,1522,1568,1610,1646,1647,1649,1747,1749,1749,1765,1766,1774,1775,1786,1788,1791,1791,1808,1808,1810,1839,1869,1957,1969,1969,1994,2026,2036,2037,2042,2042,2048,2069,2074,2074,2084,2084,2088,2088,2112,2136,2208,2208,2210,2220,2308,2361,2365,2365,2384,2384,2392,2401,2417,2423,2425,2431,2437,2444,2447,2448,2451,2472,2474,2480,2482,2482,2486,2489,2493,2493,2510,2510,2524,2525,2527,2529,2544,2545,2565,2570,2575,2576,2579,2600,2602,2608,2610,2611,2613,2614,2616,2617,2649,2652,2654,2654,2674,2676,2693,2701,2703,2705,2707,2728,2730,2736,2738,2739,2741,2745,2749,2749,2768,2768,2784,2785,2821,2828,2831,2832,2835,2856,2858,2864,2866,2867,2869,2873,2877,2877,2908,2909,2911,2913,2929,2929,2947,2947,2949,2954,2958,2960,2962,2965,2969,2970,2972,2972,2974,2975,2979,2980,2984,2986,2990,3001,3024,3024,3077,3084,3086,3088,3090,3112,3114,3123,3125,3129,3133,3133,3160,3161,3168,3169,3205,3212,3214,3216,3218,3240,3242,3251,3253,3257,3261,3261,3294,3294,3296,3297,3313,3314,3333,3340,3342,3344,3346,3386,3389,3389,3406,3406,3424,3425,3450,3455,3461,3478,3482,3505,3507,3515,3517,3517,3520,3526,3585,3632,3634,3635,3648,3654,3713,3714,3716,3716,3719,3720,3722,3722,3725,3725,3732,3735,3737,3743,3745,3747,3749,3749,3751,3751,3754,3755,3757,3760,3762,3763,3773,3773,3776,3780,3782,3782,3804,3807,3840,3840,3904,3911,3913,3948,3976,3980,4096,4138,4159,4159,4176,4181,4186,4189,4193,4193,4197,4198,4206,4208,4213,4225,4238,4238,4256,4293,4295,4295,4301,4301,4304,4346,4348,4680,4682,4685,4688,4694,4696,4696,4698,4701,4704,4744,4746,4749,4752,4784,4786,4789,4792,4798,4800,4800,4802,4805,4808,4822,4824,4880,4882,4885,4888,4954,4992,5007,5024,5108,5121,5740,5743,5759,5761,5786,5792,5866,5870,5872,5888,5900,5902,5905,5920,5937,5952,5969,5984,5996,5998,6e3,6016,6067,6103,6103,6108,6108,6176,6263,6272,6312,6314,6314,6320,6389,6400,6428,6480,6509,6512,6516,6528,6571,6593,6599,6656,6678,6688,6740,6823,6823,6917,6963,6981,6987,7043,7072,7086,7087,7098,7141,7168,7203,7245,7247,7258,7293,7401,7404,7406,7409,7413,7414,7424,7615,7680,7957,7960,7965,7968,8005,8008,8013,8016,8023,8025,8025,8027,8027,8029,8029,8031,8061,8064,8116,8118,8124,8126,8126,8130,8132,8134,8140,8144,8147,8150,8155,8160,8172,8178,8180,8182,8188,8305,8305,8319,8319,8336,8348,8450,8450,8455,8455,8458,8467,8469,8469,8473,8477,8484,8484,8486,8486,8488,8488,8490,8493,8495,8505,8508,8511,8517,8521,8526,8526,8544,8584,11264,11310,11312,11358,11360,11492,11499,11502,11506,11507,11520,11557,11559,11559,11565,11565,11568,11623,11631,11631,11648,11670,11680,11686,11688,11694,11696,11702,11704,11710,11712,11718,11720,11726,11728,11734,11736,11742,11823,11823,12293,12295,12321,12329,12337,12341,12344,12348,12353,12438,12445,12447,12449,12538,12540,12543,12549,12589,12593,12686,12704,12730,12784,12799,13312,19893,19968,40908,40960,42124,42192,42237,42240,42508,42512,42527,42538,42539,42560,42606,42623,42647,42656,42735,42775,42783,42786,42888,42891,42894,42896,42899,42912,42922,43e3,43009,43011,43013,43015,43018,43020,43042,43072,43123,43138,43187,43250,43255,43259,43259,43274,43301,43312,43334,43360,43388,43396,43442,43471,43471,43520,43560,43584,43586,43588,43595,43616,43638,43642,43642,43648,43695,43697,43697,43701,43702,43705,43709,43712,43712,43714,43714,43739,43741,43744,43754,43762,43764,43777,43782,43785,43790,43793,43798,43808,43814,43816,43822,43968,44002,44032,55203,55216,55238,55243,55291,63744,64109,64112,64217,64256,64262,64275,64279,64285,64285,64287,64296,64298,64310,64312,64316,64318,64318,64320,64321,64323,64324,64326,64433,64467,64829,64848,64911,64914,64967,65008,65019,65136,65140,65142,65276,65313,65338,65345,65370,65382,65470,65474,65479,65482,65487,65490,65495,65498,65500],L=[170,170,181,181,186,186,192,214,216,246,248,705,710,721,736,740,748,748,750,750,768,884,886,887,890,893,902,902,904,906,908,908,910,929,931,1013,1015,1153,1155,1159,1162,1319,1329,1366,1369,1369,1377,1415,1425,1469,1471,1471,1473,1474,1476,1477,1479,1479,1488,1514,1520,1522,1552,1562,1568,1641,1646,1747,1749,1756,1759,1768,1770,1788,1791,1791,1808,1866,1869,1969,1984,2037,2042,2042,2048,2093,2112,2139,2208,2208,2210,2220,2276,2302,2304,2403,2406,2415,2417,2423,2425,2431,2433,2435,2437,2444,2447,2448,2451,2472,2474,2480,2482,2482,2486,2489,2492,2500,2503,2504,2507,2510,2519,2519,2524,2525,2527,2531,2534,2545,2561,2563,2565,2570,2575,2576,2579,2600,2602,2608,2610,2611,2613,2614,2616,2617,2620,2620,2622,2626,2631,2632,2635,2637,2641,2641,2649,2652,2654,2654,2662,2677,2689,2691,2693,2701,2703,2705,2707,2728,2730,2736,2738,2739,2741,2745,2748,2757,2759,2761,2763,2765,2768,2768,2784,2787,2790,2799,2817,2819,2821,2828,2831,2832,2835,2856,2858,2864,2866,2867,2869,2873,2876,2884,2887,2888,2891,2893,2902,2903,2908,2909,2911,2915,2918,2927,2929,2929,2946,2947,2949,2954,2958,2960,2962,2965,2969,2970,2972,2972,2974,2975,2979,2980,2984,2986,2990,3001,3006,3010,3014,3016,3018,3021,3024,3024,3031,3031,3046,3055,3073,3075,3077,3084,3086,3088,3090,3112,3114,3123,3125,3129,3133,3140,3142,3144,3146,3149,3157,3158,3160,3161,3168,3171,3174,3183,3202,3203,3205,3212,3214,3216,3218,3240,3242,3251,3253,3257,3260,3268,3270,3272,3274,3277,3285,3286,3294,3294,3296,3299,3302,3311,3313,3314,3330,3331,3333,3340,3342,3344,3346,3386,3389,3396,3398,3400,3402,3406,3415,3415,3424,3427,3430,3439,3450,3455,3458,3459,3461,3478,3482,3505,3507,3515,3517,3517,3520,3526,3530,3530,3535,3540,3542,3542,3544,3551,3570,3571,3585,3642,3648,3662,3664,3673,3713,3714,3716,3716,3719,3720,3722,3722,3725,3725,3732,3735,3737,3743,3745,3747,3749,3749,3751,3751,3754,3755,3757,3769,3771,3773,3776,3780,3782,3782,3784,3789,3792,3801,3804,3807,3840,3840,3864,3865,3872,3881,3893,3893,3895,3895,3897,3897,3902,3911,3913,3948,3953,3972,3974,3991,3993,4028,4038,4038,4096,4169,4176,4253,4256,4293,4295,4295,4301,4301,4304,4346,4348,4680,4682,4685,4688,4694,4696,4696,4698,4701,4704,4744,4746,4749,4752,4784,4786,4789,4792,4798,4800,4800,4802,4805,4808,4822,4824,4880,4882,4885,4888,4954,4957,4959,4992,5007,5024,5108,5121,5740,5743,5759,5761,5786,5792,5866,5870,5872,5888,5900,5902,5908,5920,5940,5952,5971,5984,5996,5998,6e3,6002,6003,6016,6099,6103,6103,6108,6109,6112,6121,6155,6157,6160,6169,6176,6263,6272,6314,6320,6389,6400,6428,6432,6443,6448,6459,6470,6509,6512,6516,6528,6571,6576,6601,6608,6617,6656,6683,6688,6750,6752,6780,6783,6793,6800,6809,6823,6823,6912,6987,6992,7001,7019,7027,7040,7155,7168,7223,7232,7241,7245,7293,7376,7378,7380,7414,7424,7654,7676,7957,7960,7965,7968,8005,8008,8013,8016,8023,8025,8025,8027,8027,8029,8029,8031,8061,8064,8116,8118,8124,8126,8126,8130,8132,8134,8140,8144,8147,8150,8155,8160,8172,8178,8180,8182,8188,8204,8205,8255,8256,8276,8276,8305,8305,8319,8319,8336,8348,8400,8412,8417,8417,8421,8432,8450,8450,8455,8455,8458,8467,8469,8469,8473,8477,8484,8484,8486,8486,8488,8488,8490,8493,8495,8505,8508,8511,8517,8521,8526,8526,8544,8584,11264,11310,11312,11358,11360,11492,11499,11507,11520,11557,11559,11559,11565,11565,11568,11623,11631,11631,11647,11670,11680,11686,11688,11694,11696,11702,11704,11710,11712,11718,11720,11726,11728,11734,11736,11742,11744,11775,11823,11823,12293,12295,12321,12335,12337,12341,12344,12348,12353,12438,12441,12442,12445,12447,12449,12538,12540,12543,12549,12589,12593,12686,12704,12730,12784,12799,13312,19893,19968,40908,40960,42124,42192,42237,42240,42508,42512,42539,42560,42607,42612,42621,42623,42647,42655,42737,42775,42783,42786,42888,42891,42894,42896,42899,42912,42922,43e3,43047,43072,43123,43136,43204,43216,43225,43232,43255,43259,43259,43264,43309,43312,43347,43360,43388,43392,43456,43471,43481,43520,43574,43584,43597,43600,43609,43616,43638,43642,43643,43648,43714,43739,43741,43744,43759,43762,43766,43777,43782,43785,43790,43793,43798,43808,43814,43816,43822,43968,44010,44012,44013,44016,44025,44032,55203,55216,55238,55243,55291,63744,64109,64112,64217,64256,64262,64275,64279,64285,64296,64298,64310,64312,64316,64318,64318,64320,64321,64323,64324,64326,64433,64467,64829,64848,64911,64914,64967,65008,65019,65024,65039,65056,65062,65075,65076,65101,65103,65136,65140,65142,65276,65296,65305,65313,65338,65343,65343,65345,65370,65382,65470,65474,65479,65482,65487,65490,65495,65498,65500];e.isUnicodeIdentifierStart=r;var M=i(O);e.tokenToString=o,e.stringToToken=s,e.computeLineStarts=c,e.getPositionOfLineAndCharacter=_,e.computePositionOfLineAndCharacter=u,e.getLineStarts=l,e.computeLineAndCharacterOfPosition=d,e.getLineAndCharacterOfPosition=p;var B=Object.prototype.hasOwnProperty;e.isWhiteSpace=f,e.isLineBreak=m,e.isOctalDigit=y,e.couldStartTrivia=h,e.skipTrivia=v;var z="<<<<<<<".length,K=/^#!.*/;e.getLeadingCommentRanges=S,e.getTrailingCommentRanges=T,e.getShebang=E,e.isIdentifierStart=w,e.isIdentifierPart=A,e.isIdentifier=P,e.createScanner=N}(ts||(ts={}));var ts;!function(e){function t(e,t){var n=e.declarations;if(n)for(var r=0,a=n;r<a.length;r++){var i=a[r];if(i.kind===t)return i}}function n(){if(0===Dn.length){var e="",t=function(t){return e+=t};return{string:function(){return e},writeKeyword:t,writeOperator:t,writePunctuation:t,writeSpace:t,writeStringLiteral:t,writeParameter:t,writeSymbol:t,writeLine:function(){return e+=" "},increaseIndent:function(){},decreaseIndent:function(){},clear:function(){return e=""},trackSymbol:function(){},reportInaccessibleThisError:function(){}}}return Dn.pop()}function r(e){e.clear(),Dn.push(e)}function a(e){return e.end-e.pos}function i(e,t,n){if(!e||!t)return e===t;if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++){var a=n?n(e[r],t[r]):e[r]===t[r];if(!a)return!1}return!0}function o(t,n){return t.resolvedModules&&e.hasProperty(t.resolvedModules,n)}function s(e,t){return o(e,t)?e.resolvedModules[t]:void 0}function c(e,t,n){e.resolvedModules||(e.resolvedModules={}),e.resolvedModules[t]=n}function _(e){return u(e),0!==(64&e.parserContextFlags)}function u(t){if(!(128&t.parserContextFlags)){var n=0!==(16&t.parserContextFlags)||e.forEachChild(t,_);n&&(t.parserContextFlags|=64),t.parserContextFlags|=128}}function l(e){for(;e&&251!==e.kind;)e=e.parent;return e}function d(e){switch(e.kind){case 195:case 223:case 202:case 203:case 204:return!0}return!1}function p(t,n){return e.Debug.assert(t>=0),e.getLineStarts(n)[t]}function f(t){var n=l(t),r=e.getLineAndCharacterOfPosition(n,t.pos);return n.fileName+"("+(r.line+1)+","+(r.character+1)+")"}function m(e){return e.pos}function g(e){return e?e.pos===e.end&&e.pos>=0&&1!==e.kind:!0}function y(e){return!g(e)}function h(t,n){return g(t)?t.pos:e.skipTrivia((n||l(t)).text,t.pos)}function v(t,n){return g(t)||!t.decorators?h(t,n):e.skipTrivia((n||l(t)).text,t.decorators.end)}function k(t,n,r){if(void 0===r&&(r=!1),g(n))return"";var a=t.text;return a.substring(r?n.pos:e.skipTrivia(a,n.pos),n.end)}function b(t,n){return g(n)?"":t.substring(e.skipTrivia(t,n.pos),n.end)}function x(e,t){return void 0===t&&(t=!1),k(l(e),e,t)}function C(e){return e.length>=2&&95===e.charCodeAt(0)&&95===e.charCodeAt(1)?"_"+e:e}function D(e){return e.length>=3&&95===e.charCodeAt(0)&&95===e.charCodeAt(1)&&95===e.charCodeAt(2)?e.substr(1):e}function S(t){return e.getBaseFileName(t).replace(/^(\d)/,"_$1").replace(/\W/g,"_")}function T(e){return 0!==(24576&U(e))||O(e)}function E(e){return e&&221===e.kind&&(9===e.name.kind||A(e))}function w(e){return 251===e.kind||221===e.kind||ae(e)||ce(e)}function A(e){return!!(2097152&e.flags)}function P(e){if(!e||!E(e))return!1;switch(e.parent.kind){case 251:return B(e.parent);case 222:return E(e.parent.parent)&&!B(e.parent.parent.parent)}return!1}function N(e){for(var t=e.parent;t;){if(ae(t))return t;switch(t.kind){case 251:case 223:case 247:case 221:case 202:case 203:case 204:return t;case 195:if(!ae(t.parent))return t}t=t.parent}}function O(e){return e&&214===e.kind&&e.parent&&247===e.parent.kind}function R(e){return 0===a(e)?"(Missing)":x(e)}function I(t,n,r,a,i){var o=l(t),s=M(o,t);return e.createFileDiagnostic(o,s.start,s.length,n,r,a,i)}function F(e,t){var n=l(e),r=M(n,e);return{file:n,start:r.start,length:r.length,code:t.code,category:t.category,messageText:t.next?t:t.messageText}}function L(t,n){var r=e.createScanner(t.languageVersion,!0,t.languageVariant,t.text,void 0,n);r.scan();var a=r.getTokenPos();return e.createTextSpanFromBounds(a,r.getTextPos())}function M(t,n){var r=n;switch(n.kind){case 251:var a=e.skipTrivia(t.text,0,!1);return a===t.text.length?e.createTextSpan(0,0):L(t,a);case 214:case 166:case 217:case 189:case 218:case 221:case 220:case 250:case 216:case 176:case 144:case 219:r=n.name}if(void 0===r)return L(t,n.pos);var i=g(r)?r.pos:e.skipTrivia(t.text,r.pos);return e.createTextSpanFromBounds(i,r.end)}function B(e){return void 0!==e.externalModuleIndicator}function z(e){return void 0!==(e.externalModuleIndicator||e.commonJsModuleIndicator)}function K(e){return 0!==(4096&e.flags)}function j(e){return 220===e.kind&&q(e)}function J(e){for(;e&&(166===e.kind||He(e));)e=e.parent;return e}function U(e){e=J(e);var t=e.flags;return 214===e.kind&&(e=e.parent),e&&215===e.kind&&(t|=e.flags,e=e.parent),e&&196===e.kind&&(t|=e.flags),t}function q(e){return!!(16384&U(e))}function W(e){return!!(8192&U(e))}function V(e){return 171===e.kind&&95===e.expression.kind}function H(e){return 198===e.kind&&9===e.expression.kind}function G(t,n){return e.getLeadingCommentRanges(n.text,t.pos)}function X(t,n){return e.getLeadingCommentRanges(n,t.pos)}function Q(e,t){return Y(e,t.text)}function Y(t,n){function r(e){return 42===n.charCodeAt(e.pos+1)&&42===n.charCodeAt(e.pos+2)&&47!==n.charCodeAt(e.pos+3)}var a=139===t.kind||138===t.kind?e.concatenate(e.getTrailingCommentRanges(n,t.pos),e.getLeadingCommentRanges(n,t.pos)):X(t,n);return e.filter(a,r)}function $(t){if(151<=t.kind&&t.kind<=163)return!0;switch(t.kind){case 117:case 128:case 130:case 120:case 131:return!0;case 103:return 180!==t.parent.kind;case 191:return!an(t);case 69:136===t.parent.kind&&t.parent.right===t?t=t.parent:169===t.parent.kind&&t.parent.name===t&&(t=t.parent),e.Debug.assert(69===t.kind||136===t.kind||169===t.kind,"'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'.");case 136:case 169:case 97:var n=t.parent;if(155===n.kind)return!1;if(151<=n.kind&&n.kind<=163)return!0;switch(n.kind){case 191:return!an(n);case 138:return t===n.constraint;case 142:case 141:case 139:case 214:return t===n.type;case 216:case 176:case 177:case 145:case 144:case 143:case 146:case 147:return t===n.type;case 148:case 149:case 150:return t===n.type;case 174:return t===n.type;case 171:case 172:return n.typeArguments&&e.indexOf(n.typeArguments,t)>=0;case 173:return!1}}return!1}function Z(t,n){function r(t){switch(t.kind){case 207:return n(t);case 223:case 195:case 199:case 200:case 201:case 202:case 203:case 204:case 208:case 209:case 244:case 245:case 210:case 212:case 247:return e.forEachChild(t,r)}}return r(t)}function ee(t,n){function r(t){switch(t.kind){case 187:n(t);var a=t.expression;a&&r(a);case 220:case 218:case 221:case 219:case 217:case 189:return;default:if(ae(t)){var i=t.name;if(i&&137===i.kind)return void r(i.expression)}else $(t)||e.forEachChild(t,r)}}return r(t)}function te(e){if(e)switch(e.kind){case 166:case 250:case 139:case 248:case 142:case 141:case 249:case 214:return!0}return!1}function ne(e){return e&&(146===e.kind||147===e.kind)}function re(e){return e&&(217===e.kind||189===e.kind)}function ae(e){return e&&ie(e.kind)}function ie(e){switch(e){case 145:case 176:case 216:case 177:case 144:case 143:case 146:case 147:case 148:case 149:case 150:case 153:case 154:return!0}}function oe(e){switch(e.kind){case 144:case 143:case 145:case 146:case 147:case 216:case 176:return!0}return!1}function se(e,t){switch(e.kind){case 202:case 203:case 204:case 200:case 201:return!0;case 210:return t&&se(e.statement,t)}return!1}function ce(e){return e&&195===e.kind&&ae(e.parent)}function _e(e){return e&&144===e.kind&&168===e.parent.kind}function ue(e){return e&&1===e.kind}function le(e){return e&&0===e.kind}function de(e){for(;;)if(e=e.parent,!e||ae(e))return e}function pe(e){for(;;)if(e=e.parent,!e||re(e))return e}function fe(e,t){for(;;){if(e=e.parent,!e)return;switch(e.kind){case 137:if(re(e.parent.parent))return e;e=e.parent;break;case 140:139===e.parent.kind&&$e(e.parent.parent)?e=e.parent.parent:$e(e.parent)&&(e=e.parent);break;case 177:if(!t)continue;case 216:case 176:case 221:case 142:case 141:case 144:case 143:case 145:case 146:case 147:case 148:case 149:case 150:case 220:case 251:return e}}}function me(e,t){for(;;){if(e=e.parent,!e)return e;switch(e.kind){case 137:e=e.parent;break;case 216:case 176:case 177:if(!t)continue;case 142:case 141:case 144:case 143:case 145:case 146:case 147:return e;case 140:139===e.parent.kind&&$e(e.parent.parent)?e=e.parent.parent:$e(e.parent)&&(e=e.parent)}}}function ge(e){return(169===e.kind||170===e.kind)&&95===e.expression.kind}function ye(e){if(e)switch(e.kind){case 152:return e.typeName;case 191:return e.expression;case 69:case 136:return e}}function he(e){return 173===e.kind?e.tag:e.expression}function ve(e){switch(e.kind){case 217:return!0;case 142:return 217===e.parent.kind;case 146:case 147:case 144:return void 0!==e.body&&217===e.parent.kind;case 139:return void 0!==e.parent.body&&(145===e.parent.kind||144===e.parent.kind||147===e.parent.kind)&&217===e.parent.parent.kind}return!1}function ke(e){return void 0!==e.decorators&&ve(e)}function be(e){return 169===e.kind}function xe(e){return 170===e.kind}function Ce(e){switch(e.kind){case 95:case 93:case 99:case 84:case 10:case 167:case 168:case 169:case 170:case 171:case 172:case 173:case 192:case 174:case 175:case 176:case 189:case 177:case 180:case 178:case 179:case 182:case 183:case 184:case 185:case 188:case 186:case 11:case 190:case 236:case 237:case 187:case 181:return!0;case 136:for(;136===e.parent.kind;)e=e.parent;return 155===e.parent.kind;case 69:if(155===e.parent.kind)return!0;case 8:case 9:case 97:var t=e.parent;switch(t.kind){case 214:case 139:case 142:case 141:case 250:case 248:case 166:return t.initializer===e;case 198:case 199:case 200:case 201:case 207:case 208:case 209:case 244:case 211:case 209:return t.expression===e;case 202:var n=t;return n.initializer===e&&215!==n.initializer.kind||n.condition===e||n.incrementor===e;case 203:case 204:var r=t;return r.initializer===e&&215!==r.initializer.kind||r.expression===e;case 174:case 192:return e===t.expression;case 193:return e===t.expression;case 137:return e===t.expression;case 140:case 243:case 242:return!0;case 191:return t.expression===e&&an(t);default:if(Ce(t))return!0}}return!1}function De(e){return"./"===e.substr(0,2)||"../"===e.substr(0,3)||".\\"===e.substr(0,2)||"..\\"===e.substr(0,3)}function Se(t,n){var r=e.getModuleInstanceState(t);return 1===r||n&&2===r}function Te(e){return 224===e.kind&&235===e.moduleReference.kind}function Ee(t){return e.Debug.assert(Te(t)),t.moduleReference.expression}function we(e){return 224===e.kind&&235!==e.moduleReference.kind}function Ae(e){return Pe(e)}function Pe(e){return e&&!!(32&e.parserContextFlags)}function Ne(e,t){var n=171===e.kind&&69===e.expression.kind&&"require"===e.expression.text&&1===e.arguments.length;return n&&(!t||9===e.arguments[0].kind)}function Oe(e){if(!Pe(e))return 0;if(184!==e.kind)return 0;var t=e;if(56!==t.operatorToken.kind||169!==t.left.kind)return 0;var n=t.left;if(69===n.expression.kind){var r=n.expression;if("exports"===r.text)return 1;if("module"===r.text&&"exports"===n.name.text)return 2}else{if(97===n.expression.kind)return 4;if(169===n.expression.kind){var a=n.expression;if(69===a.expression.kind&&"prototype"===a.name.text)return 3}}return 0}function Re(e){if(225===e.kind)return e.moduleSpecifier;if(224===e.kind){var t=e.moduleReference;if(235===t.kind)return t.expression}return 231===e.kind?e.moduleSpecifier:221===e.kind&&9===e.name.kind?e.name:void 0}function Ie(e){if(e)switch(e.kind){case 139:case 144:case 143:case 249:case 248:case 142:case 141:return void 0!==e.questionToken}return!1}function Fe(e){return 264===e.kind&&e.parameters.length>0&&266===e.parameters[0].type.kind}function Le(e,t,n){if(e){var r=Me(e,n);if(r)for(var a=0,i=r.tags;a<i.length;a++){var o=i[a];if(o.kind===t)return o}}}function Me(e,t){if(e.jsDocComment)return e.jsDocComment;if(t){var n=214===e.parent.kind&&e.parent.initializer===e&&196===e.parent.parent.parent.kind,r=n?e.parent.parent.parent:void 0;if(r)return r.jsDocComment;var a=e.parent,i=a&&a.parent&&184===a.kind&&56===a.operatorToken.kind&&198===a.parent.kind;if(i)return a.parent.jsDocComment;var o=a&&248===a.kind;if(o)return a.jsDocComment}}function Be(e){return Le(e,272,!1)}function ze(e){return Le(e,271,!0)}function Ke(e){return Le(e,273,!1)}function je(e){if(e.name&&69===e.name.kind){var t=e.name.text,n=Me(e.parent,!0);if(n)for(var r=0,a=n.tags;r<a.length;r++){var i=a[r];if(270===i.kind){
var o=i,s=o.preParameterName||o.postParameterName;if(s.text===t)return o}}}}function Je(t){return Ue(e.lastOrUndefined(t.parameters))}function Ue(e){if(e){if(32&e.parserContextFlags){if(e.type&&265===e.type.kind)return!0;var t=je(e);if(t&&t.typeExpression)return 265===t.typeExpression.type.kind}return void 0!==e.dotDotDotToken}return!1}function qe(e){return e>=8&&11>=e}function We(e){return 9===e||11===e}function Ve(e){return e>=11&&14>=e}function He(e){return!!e&&(165===e.kind||164===e.kind)}function Ge(e,t){for(;e;){if(e===t)return!0;e=e.parent}return!1}function Xe(e){for(;e;){if(4100&e.flags)return!0;e=e.parent}return!1}function Qe(e){switch(e.kind){case 177:case 166:case 217:case 189:case 145:case 220:case 250:case 233:case 216:case 176:case 146:case 226:case 224:case 229:case 218:case 144:case 143:case 221:case 227:case 139:case 248:case 142:case 141:case 147:case 249:case 219:case 138:case 214:return!0}return!1}function Ye(e){switch(e.kind){case 206:case 205:case 213:case 200:case 198:case 197:case 203:case 204:case 202:case 199:case 210:case 207:case 209:case 211:case 212:case 196:case 201:case 208:case 230:return!0;default:return!1}}function $e(e){switch(e.kind){case 145:case 142:case 144:case 146:case 147:case 143:case 150:return!0;default:return!1}}function Ze(e){if(69!==e.kind&&9!==e.kind&&8!==e.kind)return!1;var t=e.parent;return 229!==t.kind&&233!==t.kind||!t.propertyName?Qe(t)?t.name===e:!1:!0}function et(e){var t=e.parent;switch(t.kind){case 142:case 141:case 144:case 143:case 146:case 147:case 250:case 248:case 169:return t.name===e;case 136:if(t.right===e){for(;136===t.kind;)t=t.parent;return 155===t.kind}return!1;case 166:case 229:return t.propertyName===e;case 233:return!0}return!1}function tt(e){return 224===e.kind||226===e.kind&&!!e.name||227===e.kind||229===e.kind||233===e.kind||230===e.kind&&69===e.expression.kind}function nt(e){var t=it(e.heritageClauses,83);return t&&t.types.length>0?t.types[0]:void 0}function rt(e){var t=it(e.heritageClauses,106);return t?t.types:void 0}function at(e){var t=it(e.heritageClauses,83);return t?t.types:void 0}function it(e,t){if(e)for(var n=0,r=e;n<r.length;n++){var a=r[n];if(a.token===t)return a}}function ot(t,n,r){if(!t.getCompilerOptions().noResolve){var a=e.isRootedDiskPath(r.fileName)?r.fileName:e.combinePaths(e.getDirectoryPath(n.fileName),r.fileName);return t.getSourceFile(a)}}function st(e,t){for(;e;){if(e.kind===t)return e;e=e.parent}}function ct(t,n){var r=/^\/\/\/\s*<reference\s+/gim,a=/^(\/\/\/\s*<reference\s+no-default-lib\s*=\s*)('|")(.+?)\2\s*\/>/gim;if(r.test(t)){if(a.test(t))return{isNoDefaultLib:!0};var i=e.fullTripleSlashReferencePathRegEx.exec(t);if(i){var o=n.pos,s=n.end;return{fileReference:{pos:o,end:s,fileName:i[3]},isNoDefaultLib:!1}}return{diagnosticMessage:e.Diagnostics.Invalid_reference_directive_syntax,isNoDefaultLib:!1}}}function _t(e){return e>=70&&135>=e}function ut(e){return e>=2&&7>=e}function lt(e){return ae(e)&&0!==(256&e.flags)&&!ne(e)}function dt(e){return 9===e||8===e}function pt(e){return e.name&&ft(e.name)}function ft(e){return 137===e.kind&&!dt(e.expression.kind)&&!mt(e.expression)}function mt(e){return be(e)&&ht(e.expression)}function gt(e){if(69===e.kind||9===e.kind||8===e.kind)return e.text;if(137===e.kind){var t=e.expression;if(mt(t)){var n=t.name.text;return yt(n)}}}function yt(e){return"__@"+e}function ht(e){return 69===e.kind&&"Symbol"===e.text}function vt(e){switch(e){case 115:case 118:case 74:case 122:case 77:case 82:case 112:case 110:case 111:case 113:return!0}return!1}function kt(e){var t=bt(e);return 139===t.kind}function bt(e){for(;166===e.kind;)e=e.parent.parent;return e}function xt(e){return ae(e)||221===e.kind||251===e.kind}function Ct(t,n,r,a){var i=void 0!==n?e.createNode(t.kind,n.pos,n.end):Et(t.kind);for(var o in t)!i.hasOwnProperty(o)&&t.hasOwnProperty(o)&&(i[o]=t[o]);return void 0!==r&&(i.flags=r),void 0!==a&&(i.parent=a),i}function Dt(e,t){var n=Ct(e,e,e.flags,t);if(St(n)){var r=n.left,a=n.right;n.left=Dt(r,n),n.right=Ct(a,a,a.flags,t)}return n}function St(e){return 136===e.kind}function Tt(e){return-1===e.pos}function Et(t,n){var r=e.createNode(t,-1,-1);return r.startsOnNewLine=n,r}function wt(){var e=[];return e.pos=-1,e.end=-1,e}function At(){function t(){return u}function n(t){if(e.hasProperty(c,t.fileName))for(var n=0,r=c[t.fileName];n<r.length;n++){var a=r[n];a.file=t}}function r(e){var t;e.file?(t=c[e.file.fileName],t||(t=[],c[e.file.fileName]=t)):t=s,t.push(e),_=!0,u++}function a(){return o(),s}function i(t){function n(e){r.push(e)}if(o(),t)return c[t]||[];var r=[];e.forEach(s,n);for(var a in c)e.hasProperty(c,a)&&e.forEach(c[a],n);return e.sortAndDeduplicateDiagnostics(r)}function o(){if(_){_=!1,s=e.sortAndDeduplicateDiagnostics(s);for(var t in c)e.hasProperty(c,t)&&(c[t]=e.sortAndDeduplicateDiagnostics(c[t]))}}var s=[],c={},_=!1,u=0;return{add:r,getGlobalDiagnostics:a,getDiagnostics:i,getModificationCount:t,reattachFileDiagnostics:n}}function Pt(e){function t(e){return Tn[e]||Ot(e.charCodeAt(0))}return e=Sn.test(e)?e.replace(Sn,t):e}function Nt(e){var t=e.substr(0,1);return t.toLowerCase()===t}function Ot(e){var t=e.toString(16).toUpperCase(),n=("0000"+t).slice(-4);return"\\u"+n}function Rt(e){return En.test(e)?e.replace(En,function(e){return Ot(e.charCodeAt(0))}):e}function It(e){return void 0===wn[e]&&(wn[e]=It(e-1)+wn[1]),wn[e]}function Ft(){return wn[1].length}function Lt(t){function n(e){e&&e.length&&(u&&(c+=It(_),u=!1),c+=e)}function r(){c="",_=0,u=!0,l=0,d=0}function a(e){void 0!==e&&(u&&(u=!1),c+=e)}function i(t){if(t&&t.length){n(t);var r=e.computeLineStarts(t);r.length>1&&(l=l+r.length-1,d=c.length-t.length+e.lastOrUndefined(r))}}function o(){u||(c+=t,l++,d=c.length,u=!0)}function s(e,t){n(b(e,t))}var c,_,u,l,d;return r(),{write:n,rawWrite:a,writeTextOfNode:s,writeLiteral:i,writeLine:o,increaseIndent:function(){_++},decreaseIndent:function(){_--},getIndent:function(){return _},getTextPos:function(){return c.length},getLine:function(){return l+1},getColumn:function(){return u?_*Ft()+1:c.length-d+1},getText:function(){return c},reset:r}}function Mt(t,n){var r=function(e){return t.getCanonicalFileName(e)},a=e.toPath(t.getCommonSourceDirectory(),t.getCurrentDirectory(),r),i=e.getNormalizedAbsolutePath(n,t.getCurrentDirectory()),o=e.getRelativePathToDirectoryOrUrl(a,i,a,r,!1);return e.removeFileExtension(o)}function Bt(t,n,r){var a,i=n.getCompilerOptions();return a=i.outDir?e.removeFileExtension(Jt(t,n,i.outDir)):e.removeFileExtension(t.fileName),a+r}function zt(e){return e.target||0}function Kt(e){return"number"==typeof e.module?e.module:2===zt(e)?5:1}function jt(t,n,r){function a(t,r){var a=".js";1===c.jsx&&(Ae(r)?e.fileExtensionIs(r.fileName,".jsx")&&(a=".jsx"):1===r.languageVariant&&(a=".jsx"));var i=Bt(r,t,a),_={jsFilePath:i,sourceMapFilePath:o(i,c),declarationFilePath:Ae(r)?void 0:s(i,c)};n(_,[r],!1)}function i(t){var r=e.filter(t.getSourceFiles(),function(e){return!K(e)&&(!B(e)||Kt(c)&&B(e))});if(r.length){var a=c.outFile||c.out,i={jsFilePath:a,sourceMapFilePath:o(a,c),declarationFilePath:s(a,c)};n(i,r,!0)}}function o(e,t){return t.sourceMap?e+".map":void 0}function s(t,n){return n.declaration?e.removeFileExtension(t)+".d.ts":void 0}var c=t.getCompilerOptions();if(c.outFile||c.out)i(t);else for(var _=void 0===r?t.getSourceFiles():[r],u=0,l=_;u<l.length;u++){var d=l[u];K(d)||a(t,d)}}function Jt(t,n,r){var a=e.getNormalizedAbsolutePath(t.fileName,n.getCurrentDirectory());return a=a.replace(n.getCommonSourceDirectory(),""),e.combinePaths(r,a)}function Ut(t,n,r,a,i){t.writeFile(r,a,i,function(t){n.add(e.createCompilerDiagnostic(e.Diagnostics.Could_not_write_file_0_Colon_1,r,t))})}function qt(t,n){return e.getLineAndCharacterOfPosition(t,n).line}function Wt(t,n){return e.computeLineAndCharacterOfPosition(t,n).line}function Vt(t){return e.forEach(t.members,function(e){return 145===e.kind&&y(e.body)?e:void 0})}function Ht(e){return e&&e.parameters.length>0&&e.parameters[0].type}function Gt(t,n){var r,a,i,o;return pt(n)?(r=n,146===n.kind?i=n:147===n.kind?o=n:e.Debug.fail("Accessor has wrong kind")):e.forEach(t,function(e){if((146===e.kind||147===e.kind)&&(64&e.flags)===(64&n.flags)){var t=gt(e.name),s=gt(n.name);t===s&&(r?a||(a=e):r=e,146!==e.kind||i||(i=e),147!==e.kind||o||(o=e))}}),{firstAccessor:r,secondAccessor:a,getAccessor:i,setAccessor:o}}function Xt(e,t,n,r){r&&r.length&&n.pos!==r[0].pos&&Wt(e,n.pos)!==Wt(e,r[0].pos)&&t.writeLine()}function Qt(t,n,r,a,i,o,s){var c=!i;e.forEach(a,function(e){c&&(r.write(" "),c=!1),s(t,n,r,e,o),e.hasTrailingNewLine?r.writeLine():i?r.write(" "):c=!0})}function Yt(t,n,r,a,i,o,s){function c(e){return 42===t.charCodeAt(e.pos+1)&&33===t.charCodeAt(e.pos+2)}var _,u;if(s?0===i.pos&&(_=e.filter(e.getLeadingCommentRanges(t,i.pos),c)):_=e.getLeadingCommentRanges(t,i.pos),_){for(var l=[],d=void 0,p=0,f=_;p<f.length;p++){var m=f[p];if(d){var g=Wt(n,d.end),y=Wt(n,m.pos);if(y>=g+2)break}l.push(m),d=m}if(l.length){var g=Wt(n,e.lastOrUndefined(l).end),h=Wt(n,e.skipTrivia(t,i.pos));h>=g+2&&(Xt(n,r,i,_),Qt(t,n,r,l,!0,o,a),u={nodePos:i.pos,detachedCommentEndPos:e.lastOrUndefined(l).end})}}return u}function $t(t,n,r,a,i){if(42===t.charCodeAt(a.pos+1))for(var o=e.computeLineAndCharacterOfPosition(n,a.pos),s=n.length,c=void 0,_=a.pos,u=o.line;_<a.end;u++){var l=u+1===s?t.length+1:n[u+1];if(_!==a.pos){void 0===c&&(c=en(t,n[o.line],a.pos));var d=r.getIndent()*Ft(),p=d-c+en(t,_,l);if(p>0){var f=p%Ft(),m=It((p-f)/Ft());for(r.rawWrite(m);f;)r.rawWrite(" "),f--}else r.rawWrite("")}Zt(t,a,r,i,_,l),_=l}else r.write(t.substring(a.pos,a.end))}function Zt(e,t,n,r,a,i){var o=Math.min(t.end,i-1),s=e.substring(a,o).replace(/^\s+|\s+$/g,"");s?(n.write(s),o!==t.end&&n.writeLine()):n.writeLiteral(r)}function en(t,n,r){for(var a=0;r>n&&e.isWhiteSpace(t.charCodeAt(n));n++)9===t.charCodeAt(n)?a+=Ft()-a%Ft():a++;return a}function tn(e){switch(e){case 113:return 64;case 112:return 8;case 111:return 32;case 110:return 16;case 115:return 128;case 82:return 2;case 122:return 4;case 74:return 16384;case 77:return 512;case 118:return 256}return 0}function nn(e){if(e)switch(e.kind){case 169:case 170:case 172:case 171:case 236:case 237:case 173:case 167:case 175:case 168:case 189:case 176:case 69:case 10:case 8:case 9:case 11:case 186:case 84:case 93:case 97:case 99:case 95:return!0}return!1}function rn(e){return e>=56&&68>=e}function an(e){return 191===e.kind&&83===e.parent.token&&re(e.parent.parent)}function on(e){return sn(e.expression)}function sn(e){return 69===e.kind?!0:be(e)?sn(e.expression):!1}function cn(e){return 136===e.parent.kind&&e.parent.right===e||169===e.parent.kind&&e.parent.name===e}function _n(e){var t=e.kind;return 168===t?0===e.properties.length:167===t?0===e.elements.length:!1}function un(e){return e&&e.valueDeclaration&&512&e.valueDeclaration.flags?e.valueDeclaration.localSymbol:void 0}function ln(t){return e.forEach(e.supportedJavascriptExtensions,function(n){return e.fileExtensionIs(t,n)})}function dn(t){return e.forEach(e.supportedTypeScriptExtensions,function(n){return e.fileExtensionIs(t,n)})}function pn(t){for(var n=[],r=t.length,a=0;r>a;a++){var i=t.charCodeAt(a);128>i?n.push(i):2048>i?(n.push(i>>6|192),n.push(63&i|128)):65536>i?(n.push(i>>12|224),n.push(i>>6&63|128),n.push(63&i|128)):131072>i?(n.push(i>>18|240),n.push(i>>12&63|128),n.push(i>>6&63|128),n.push(63&i|128)):e.Debug.assert(!1,"Unexpected code point")}return n}function fn(e){return void 0===e?void 0:mn(e)}function mn(t){return"string"==typeof t?'"'+Pt(t)+'"':"number"==typeof t?isFinite(t)?String(t):"null":"boolean"==typeof t?t?"true":"false":"object"==typeof t&&t?e.isArray(t)?gn(yn,t):gn(vn,t):"null"}function gn(t,n){e.Debug.assert(!n.hasOwnProperty("__cycle"),"Converting circular structure to JSON"),n.__cycle=!0;var r=t(n);return delete n.__cycle,r}function yn(t){return"["+e.reduceLeft(t,hn,"")+"]"}function hn(e,t){return(e?e+",":e)+mn(t)}function vn(t){return"{"+e.reduceProperties(t,kn,"")+"}"}function kn(e,t,n){return void 0===t||"function"==typeof t||"__cycle"===n?e:(e?e+",":e)+('"'+Pt(n)+'":'+mn(t))}function bn(e){for(var t,n,r,a,i="",o=pn(e),s=0,c=o.length;c>s;)t=o[s]>>2,n=(3&o[s])<<4|o[s+1]>>4,r=(15&o[s+1])<<2|o[s+2]>>6,a=63&o[s+2],s+1>=c?r=a=64:s+2>=c&&(a=64),i+=An.charAt(t)+An.charAt(n)+An.charAt(r)+An.charAt(a),s+=3;return i}function xn(t,n,r){return e.isRootedDiskPath(t)?e.getRelativePathToDirectoryOrUrl(n,t,n,r,!1):t}function Cn(t){return 0===t.newLine?Pn:1===t.newLine?Nn:e.sys?e.sys.newLine:Pn}e.getDeclarationOfKind=t;var Dn=[];e.getSingleLineStringWriter=n,e.releaseStringWriter=r,e.getFullWidth=a,e.arrayIsEqualTo=i,e.hasResolvedModule=o,e.getResolvedModule=s,e.setResolvedModule=c,e.containsParseError=_,e.getSourceFileOfNode=l,e.isStatementWithLocals=d,e.getStartPositionOfLine=p,e.nodePosToString=f,e.getStartPosOfNode=m,e.nodeIsMissing=g,e.nodeIsPresent=y,e.getTokenPosOfNode=h,e.getNonDecoratorTokenPosOfNode=v,e.getSourceTextOfNodeFromSourceFile=k,e.getTextOfNodeFromSourceText=b,e.getTextOfNode=x,e.escapeIdentifier=C,e.unescapeIdentifier=D,e.makeIdentifierFromModuleName=S,e.isBlockOrCatchScoped=T,e.isAmbientModule=E,e.isBlockScopedContainerTopLevel=w,e.isGlobalScopeAugmentation=A,e.isExternalModuleAugmentation=P,e.getEnclosingBlockScopeContainer=N,e.isCatchClauseVariableDeclaration=O,e.declarationNameToString=R,e.createDiagnosticForNode=I,e.createDiagnosticForNodeFromMessageChain=F,e.getSpanOfTokenAtPosition=L,e.getErrorSpanForNode=M,e.isExternalModule=B,e.isExternalOrCommonJsModule=z,e.isDeclarationFile=K,e.isConstEnumDeclaration=j,e.getCombinedNodeFlags=U,e.isConst=q,e.isLet=W,e.isSuperCallExpression=V,e.isPrologueDirective=H,e.getLeadingCommentRangesOfNode=G,e.getLeadingCommentRangesOfNodeFromText=X,e.getJsDocComments=Q,e.getJsDocCommentsFromText=Y,e.fullTripleSlashReferencePathRegEx=/^(\/\/\/\s*<reference\s+path\s*=\s*)('|")(.+?)\2.*?\/>/,e.fullTripleSlashAMDReferencePathRegEx=/^(\/\/\/\s*<amd-dependency\s+path\s*=\s*)('|")(.+?)\2.*?\/>/,e.isTypeNode=$,e.forEachReturnStatement=Z,e.forEachYieldExpression=ee,e.isVariableLike=te,e.isAccessor=ne,e.isClassLike=re,e.isFunctionLike=ae,e.isFunctionLikeKind=ie,e.introducesArgumentsExoticObject=oe,e.isIterationStatement=se,e.isFunctionBlock=ce,e.isObjectLiteralMethod=_e,e.isIdentifierTypePredicate=ue,e.isThisTypePredicate=le,e.getContainingFunction=de,e.getContainingClass=pe,e.getThisContainer=fe,e.getSuperContainer=me,e.isSuperPropertyOrElementAccess=ge,e.getEntityNameFromTypeNode=ye,e.getInvokedExpression=he,e.nodeCanBeDecorated=ve,e.nodeIsDecorated=ke,e.isPropertyAccessExpression=be,e.isElementAccessExpression=xe,e.isExpression=Ce,e.isExternalModuleNameRelative=De,e.isInstantiatedModule=Se,e.isExternalModuleImportEqualsDeclaration=Te,e.getExternalModuleImportEqualsDeclarationExpression=Ee,e.isInternalModuleImportEqualsDeclaration=we,e.isSourceFileJavaScript=Ae,e.isInJavaScriptFile=Pe,e.isRequireCall=Ne,e.getSpecialPropertyAssignmentKind=Oe,e.getExternalModuleName=Re,e.hasQuestionToken=Ie,e.isJSDocConstructSignature=Fe,e.getJSDocTypeTag=Be,e.getJSDocReturnTag=ze,e.getJSDocTemplateTag=Ke,e.getCorrespondingJSDocParameterTag=je,e.hasRestParameter=Je,e.isRestParameter=Ue,e.isLiteralKind=qe,e.isTextualLiteralKind=We,e.isTemplateLiteralKind=Ve,e.isBindingPattern=He,e.isNodeDescendentOf=Ge,e.isInAmbientContext=Xe,e.isDeclaration=Qe,e.isStatement=Ye,e.isClassElement=$e,e.isDeclarationName=Ze,e.isIdentifierName=et,e.isAliasSymbolDeclaration=tt,e.getClassExtendsHeritageClauseElement=nt,e.getClassImplementsHeritageClauseElements=rt,e.getInterfaceBaseTypeNodes=at,e.getHeritageClause=it,e.tryResolveScriptReference=ot,e.getAncestor=st,e.getFileReferenceFromReferencePath=ct,e.isKeyword=_t,e.isTrivia=ut,e.isAsyncFunctionLike=lt,e.isStringOrNumericLiteral=dt,e.hasDynamicName=pt,e.isDynamicName=ft,e.isWellKnownSymbolSyntactically=mt,e.getPropertyNameForPropertyNameNode=gt,e.getPropertyNameForKnownSymbolName=yt,e.isESSymbolIdentifier=ht,e.isModifierKind=vt,e.isParameterDeclaration=kt,e.getRootDeclaration=bt,e.nodeStartsNewLexicalEnvironment=xt,e.cloneNode=Ct,e.cloneEntityName=Dt,e.isQualifiedName=St,e.nodeIsSynthesized=Tt,e.createSynthesizedNode=Et,e.createSynthesizedNodeArray=wt,e.createDiagnosticCollection=At;var Sn=/[\\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g,Tn={"\x00":"\\0"," ":"\\t","\x0B":"\\v","\f":"\\f","\b":"\\b","\r":"\\r","\n":"\\n","\\":"\\\\",'"':'\\"',"\u2028":"\\u2028","\u2029":"\\u2029","
":"\\u0085"};e.escapeString=Pt,e.isIntrinsicJsxName=Nt;var En=/[^\u0000-\u007F]/g;e.escapeNonAsciiCharacters=Rt;var wn=[""," "];e.getIndentString=It,e.getIndentSize=Ft,e.createTextWriter=Lt,e.getExternalModuleNameFromPath=Mt,e.getOwnEmitOutputFilePath=Bt,e.getEmitScriptTarget=zt,e.getEmitModuleKind=Kt,e.forEachExpectedEmitFile=jt,e.getSourceFilePathInNewDir=Jt,e.writeFile=Ut,e.getLineOfLocalPosition=qt,e.getLineOfLocalPositionFromLineMap=Wt,e.getFirstConstructorWithBody=Vt,e.getSetAccessorTypeAnnotationNode=Ht,e.getAllAccessorDeclarations=Gt,e.emitNewLineBeforeLeadingComments=Xt,e.emitComments=Qt,e.emitDetachedComments=Yt,e.writeCommentRange=$t,e.modifierToFlag=tn,e.isLeftHandSideExpression=nn,e.isAssignmentOperator=rn,e.isExpressionWithTypeArgumentsInClassExtendsClause=an,e.isSupportedExpressionWithTypeArguments=on,e.isRightSideOfQualifiedNameOrPropertyAccess=cn,e.isEmptyObjectLiteralOrArrayLiteral=_n,e.getLocalSymbolForExportDefault=un,e.hasJavaScriptFileExtension=ln,e.hasTypeScriptFileExtension=dn,e.stringify="undefined"!=typeof JSON&&JSON.stringify?JSON.stringify:fn;var An="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e.convertToBase64=bn,e.convertToRelativePath=xn;var Pn="\r\n",Nn="\n";e.getNewLineCharacter=Cn}(ts||(ts={}));var ts;!function(e){function t(e){return 2===e.target?"lib.es6.d.ts":"lib.d.ts"}function n(e){return e.start+e.length}function r(e){return 0===e.length}function a(e,t){return t>=e.start&&t<n(e)}function i(e,t){return t.start>=e.start&&n(t)<=n(e)}function o(e,t){var r=Math.max(e.start,t.start),a=Math.min(n(e),n(t));return a>r}function s(e,t){var r=Math.max(e.start,t.start),a=Math.min(n(e),n(t));return a>r?f(r,a):void 0}function c(e,t){return t.start<=n(e)&&n(t)>=e.start}function _(e,t,r){var a=t+r;return t<=n(e)&&a>=e.start}function u(e,t,n,r){var a=e+t,i=n+r;return a>=n&&i>=e}function l(e,t){return t<=n(e)&&t>=e.start}function d(e,t){var r=Math.max(e.start,t.start),a=Math.min(n(e),n(t));return a>=r?f(r,a):void 0}function p(e,t){if(0>e)throw new Error("start < 0");if(0>t)throw new Error("length < 0");return{start:e,length:t}}function f(e,t){return p(e,t-e)}function m(e){return p(e.span.start,e.newLength)}function g(e){return r(e.span)&&0===e.newLength}function y(e,t){if(0>t)throw new Error("newLength < 0");return{span:e,newLength:t}}function h(t){if(0===t.length)return e.unchangedTextChangeRange;if(1===t.length)return t[0];for(var r=t[0],a=r.span.start,i=n(r.span),o=a+r.newLength,s=1;s<t.length;s++){var c=t[s],_=a,u=i,l=o,d=c.span.start,p=n(c.span),m=d+c.newLength;a=Math.min(_,d),i=Math.max(u,u+(p-l)),o=Math.max(m,m+(l-p))}return y(f(a,i),o-a)}function v(t){if(t&&138===t.kind)for(var n=t;n;n=n.parent)if(e.isFunctionLike(n)||e.isClassLike(n)||218===n.kind)return n}function k(t){return 56&t.flags&&145===t.parent.kind&&e.isClassLike(t.parent.parent)}e.getDefaultLibFileName=t,e.textSpanEnd=n,e.textSpanIsEmpty=r,e.textSpanContainsPosition=a,e.textSpanContainsTextSpan=i,e.textSpanOverlapsWith=o,e.textSpanOverlap=s,e.textSpanIntersectsWithTextSpan=c,e.textSpanIntersectsWith=_,e.decodedTextSpanIntersectsWith=u,e.textSpanIntersectsWithPosition=l,e.textSpanIntersection=d,e.createTextSpan=p,e.createTextSpanFromBounds=f,e.textChangeRangeNewSpan=m,e.textChangeRangeIsUnchanged=g,e.createTextChangeRange=y,e.unchangedTextChangeRange=y(p(0,0),0),e.collapseTextChangeRangesAcrossMultipleVersions=h,e.getTypeParameterOwner=v,e.isParameterPropertyDeclaration=k}(ts||(ts={}));var ts;!function(e){function t(t,n,r){return 251===t?new(l||(l=e.objectAllocator.getSourceFileConstructor()))(t,n,r):new(u||(u=e.objectAllocator.getNodeConstructor()))(t,n,r)}function n(e,t){return t?e(t):void 0}function r(e,t){return t?e(t):void 0}function a(e,t){if(t)for(var n=0,r=t;n<r.length;n++){var a=r[n],i=e(a);if(i)return i}}function i(e,t,i){if(e){var o=i?r:a,s=i||t;switch(e.kind){case 136:return n(t,e.left)||n(t,e.right);case 138:return n(t,e.name)||n(t,e.constraint)||n(t,e.expression);case 249:return o(s,e.decorators)||o(s,e.modifiers)||n(t,e.name)||n(t,e.questionToken)||n(t,e.equalsToken)||n(t,e.objectAssignmentInitializer);case 139:case 142:case 141:case 248:case 214:case 166:return o(s,e.decorators)||o(s,e.modifiers)||n(t,e.propertyName)||n(t,e.dotDotDotToken)||n(t,e.name)||n(t,e.questionToken)||n(t,e.type)||n(t,e.initializer);case 153:case 154:case 148:case 149:case 150:return o(s,e.decorators)||o(s,e.modifiers)||o(s,e.typeParameters)||o(s,e.parameters)||n(t,e.type);case 144:case 143:case 145:case 146:case 147:case 176:case 216:case 177:return o(s,e.decorators)||o(s,e.modifiers)||n(t,e.asteriskToken)||n(t,e.name)||n(t,e.questionToken)||o(s,e.typeParameters)||o(s,e.parameters)||n(t,e.type)||n(t,e.equalsGreaterThanToken)||n(t,e.body);case 152:return n(t,e.typeName)||o(s,e.typeArguments);case 151:return n(t,e.parameterName)||n(t,e.type);case 155:return n(t,e.exprName);case 156:return o(s,e.members);case 157:return n(t,e.elementType);case 158:return o(s,e.elementTypes);case 159:case 160:return o(s,e.types);case 161:return n(t,e.type);case 164:case 165:return o(s,e.elements);case 167:return o(s,e.elements);case 168:return o(s,e.properties);case 169:return n(t,e.expression)||n(t,e.dotToken)||n(t,e.name);case 170:return n(t,e.expression)||n(t,e.argumentExpression);case 171:case 172:return n(t,e.expression)||o(s,e.typeArguments)||o(s,e.arguments);case 173:return n(t,e.tag)||n(t,e.template);case 174:return n(t,e.type)||n(t,e.expression);case 175:return n(t,e.expression);case 178:return n(t,e.expression);case 179:return n(t,e.expression);case 180:return n(t,e.expression);case 182:return n(t,e.operand);case 187:return n(t,e.asteriskToken)||n(t,e.expression);case 181:return n(t,e.expression);case 183:return n(t,e.operand);case 184:return n(t,e.left)||n(t,e.operatorToken)||n(t,e.right);case 192:return n(t,e.expression)||n(t,e.type);case 185:return n(t,e.condition)||n(t,e.questionToken)||n(t,e.whenTrue)||n(t,e.colonToken)||n(t,e.whenFalse);case 188:return n(t,e.expression);case 195:case 222:return o(s,e.statements);case 251:return o(s,e.statements)||n(t,e.endOfFileToken);case 196:return o(s,e.decorators)||o(s,e.modifiers)||n(t,e.declarationList);case 215:return o(s,e.declarations);case 198:return n(t,e.expression);case 199:return n(t,e.expression)||n(t,e.thenStatement)||n(t,e.elseStatement);case 200:return n(t,e.statement)||n(t,e.expression);case 201:return n(t,e.expression)||n(t,e.statement);case 202:return n(t,e.initializer)||n(t,e.condition)||n(t,e.incrementor)||n(t,e.statement);case 203:return n(t,e.initializer)||n(t,e.expression)||n(t,e.statement);case 204:return n(t,e.initializer)||n(t,e.expression)||n(t,e.statement);case 205:case 206:return n(t,e.label);case 207:return n(t,e.expression);case 208:return n(t,e.expression)||n(t,e.statement);case 209:return n(t,e.expression)||n(t,e.caseBlock);case 223:return o(s,e.clauses);case 244:return n(t,e.expression)||o(s,e.statements);case 245:return o(s,e.statements);case 210:return n(t,e.label)||n(t,e.statement);case 211:return n(t,e.expression);case 212:return n(t,e.tryBlock)||n(t,e.catchClause)||n(t,e.finallyBlock);case 247:return n(t,e.variableDeclaration)||n(t,e.block);case 140:return n(t,e.expression);case 217:case 189:return o(s,e.decorators)||o(s,e.modifiers)||n(t,e.name)||o(s,e.typeParameters)||o(s,e.heritageClauses)||o(s,e.members);case 218:return o(s,e.decorators)||o(s,e.modifiers)||n(t,e.name)||o(s,e.typeParameters)||o(s,e.heritageClauses)||o(s,e.members);case 219:return o(s,e.decorators)||o(s,e.modifiers)||n(t,e.name)||o(s,e.typeParameters)||n(t,e.type);case 220:return o(s,e.decorators)||o(s,e.modifiers)||n(t,e.name)||o(s,e.members);case 250:return n(t,e.name)||n(t,e.initializer);case 221:return o(s,e.decorators)||o(s,e.modifiers)||n(t,e.name)||n(t,e.body);case 224:return o(s,e.decorators)||o(s,e.modifiers)||n(t,e.name)||n(t,e.moduleReference);case 225:return o(s,e.decorators)||o(s,e.modifiers)||n(t,e.importClause)||n(t,e.moduleSpecifier);case 226:return n(t,e.name)||n(t,e.namedBindings);case 227:return n(t,e.name);case 228:case 232:return o(s,e.elements);case 231:return o(s,e.decorators)||o(s,e.modifiers)||n(t,e.exportClause)||n(t,e.moduleSpecifier);case 229:case 233:return n(t,e.propertyName)||n(t,e.name);case 230:return o(s,e.decorators)||o(s,e.modifiers)||n(t,e.expression);case 186:return n(t,e.head)||o(s,e.templateSpans);case 193:return n(t,e.expression)||n(t,e.literal);case 137:return n(t,e.expression);case 246:return o(s,e.types);case 191:return n(t,e.expression)||o(s,e.typeArguments);case 235:return n(t,e.expression);case 234:return o(s,e.decorators);case 236:return n(t,e.openingElement)||o(s,e.children)||n(t,e.closingElement);case 237:case 238:return n(t,e.tagName)||o(s,e.attributes);case 241:return n(t,e.name)||n(t,e.initializer);case 242:return n(t,e.expression);case 243:return n(t,e.expression);case 240:return n(t,e.tagName);case 252:return n(t,e.type);case 256:return o(s,e.types);case 257:return o(s,e.types);case 255:return n(t,e.elementType);case 259:return n(t,e.type);case 258:return n(t,e.type);case 260:return o(s,e.members);case 262:return n(t,e.name)||o(s,e.typeArguments);case 263:return n(t,e.type);case 264:return o(s,e.parameters)||n(t,e.type);case 265:return n(t,e.type);case 266:return n(t,e.type);case 267:return n(t,e.type);case 261:return n(t,e.name)||n(t,e.type);case 268:return o(s,e.tags);case 270:return n(t,e.preParameterName)||n(t,e.typeExpression)||n(t,e.postParameterName);case 271:return n(t,e.typeExpression);case 272:return n(t,e.typeExpression);case 273:return o(s,e.typeParameters)}}}function o(t,n,r,a,i){void 0===a&&(a=!1);var o=(new Date).getTime(),s=d.parseSourceFile(t,n,r,void 0,a,i);return e.parseTime+=(new Date).getTime()-o,s}function s(e,t,n,r){return p.updateSourceFile(e,t,n,r)}function c(e,t,n){return d.JSDocParser.parseIsolatedJSDocComment(e,t,n)}function _(e,t,n){return d.JSDocParser.parseJSDocTypeExpressionForTests(e,t,n)}e.parseTime=0;var u,l;e.createNode=t,e.forEachChild=i,e.createSourceFile=o,e.updateSourceFile=s,e.parseIsolatedJSDocComment=c,e.parseJSDocTypeExpressionForTests=_;var d;!function(t){function n(t,n,r,i,c,_){_=e.ensureScriptKind(t,_),a(t,n,r,i,_);var u=s(t,r,c,_);return o(),u}function r(e){return 4===e||2===e||1===e?1:0}function a(t,n,a,i,o){Ma=e.objectAllocator.getNodeConstructor(),Ba=e.objectAllocator.getSourceFileConstructor(),Ua=n,ja=i,Ka=[],Ha=0,Wa={},Va=0,qa=0,Ga=1===o||2===o?32:0,Ya=!1,Xa.setText(Ua),Xa.setOnError(O),Xa.setScriptTarget(a),Xa.setLanguageVariant(r(o))}function o(){Xa.setText(""),Xa.setOnError(void 0),Ka=void 0,za=void 0,Wa=void 0,ja=void 0,Ua=void 0}function s(t,n,r,a){return za=u(t,n,a),32&Ga&&(za.parserContextFlags=32),Ja=F(),Fa(za),za.statements=Te(0,Ar),e.Debug.assert(1===Ja),za.endOfFileToken=X(),La(za),za.nodeCount=qa,za.identifierCount=Va,za.identifiers=Wa,za.parseDiagnostics=Ka,r&&_(za),za}function c(t){if(32&Ga){var n=e.getLeadingCommentRangesOfNode(t,za);if(n)for(var r=0,a=n;r<a.length;r++){var i=a[r],o=ei.parseJSDocComment(t,i.pos,i.end-i.pos);o&&(t.jsDocComment=o)}}return t}function _(e){function t(e){if(e.parent!==n){e.parent=n;var r=n;n=e,i(e,t),n=r}}var n=e;i(e,t)}function u(t,n,a){var i=new Ba(251,0,Ua.length);return qa++,i.text=Ua,i.bindDiagnostics=[],i.languageVersion=n,i.fileName=e.normalizePath(t),i.flags=e.fileExtensionIs(i.fileName,".d.ts")?4096:0,i.languageVariant=r(a),i.scriptKind=a,i}function l(e,t){e?Ga|=t:Ga&=~t}function d(e){l(e,1)}function p(e){l(e,2)}function f(e){l(e,4)}function m(e){l(e,8)}function g(e,t){var n=e&Ga;if(n){l(!1,n);var r=t();return l(!0,n),r}return t()}function y(e,t){var n=e&~Ga;if(n){l(!0,n);var r=t();return l(!1,n),r}return t()}function h(e){return g(1,e)}function v(e){return y(1,e)}function k(e){return y(2,e)}function b(e){return y(4,e)}function x(e){return y(8,e)}function C(e){return g(8,e)}function D(e){return y(10,e)}function S(e){return 0!==(Ga&e)}function T(){return S(2)}function E(){return S(1)}function w(){return S(4)}function A(){return S(8)}function P(e,t){var n=Xa.getTokenPos(),r=Xa.getTextPos()-n;N(n,r,e,t)}function N(t,n,r,a){var i=e.lastOrUndefined(Ka);i&&t===i.start||Ka.push(e.createFileDiagnostic(za,t,n,r,a)),Ya=!0}function O(e,t){var n=Xa.getTextPos();N(n,t||0,e)}function R(){return Xa.getStartPos()}function I(){return Xa.getStartPos()}function F(){return Ja=Xa.scan()}function L(){return Ja=Xa.reScanGreaterToken()}function M(){return Ja=Xa.reScanSlashToken()}function B(){return Ja=Xa.reScanTemplateToken()}function z(){return Ja=Xa.scanJsxIdentifier()}function K(){return Ja=Xa.scanJsxToken()}function j(t,n){var r=Ja,a=Ka.length,i=Ya,o=Ga,s=n?Xa.lookAhead(t):Xa.tryScan(t);return e.Debug.assert(o===Ga),s&&!n||(Ja=r,Ka.length=a,Ya=i),s}function J(e){return j(e,!0)}function U(e){return j(e,!1)}function q(){return 69===Ja?!0:114===Ja&&T()?!1:119===Ja&&A()?!1:Ja>105}function W(t,n,r){return void 0===r&&(r=!0),Ja===t?(r&&F(),!0):(n?P(n):P(e.Diagnostics._0_expected,e.tokenToString(t)),!1)}function V(e){return Ja===e?(F(),!0):!1}function H(e){return Ja===e?X():void 0}function G(e,t,n,r){return H(e)||ee(e,t,n,r)}function X(){var e=$(Ja);return F(),Z(e)}function Q(){return 23===Ja?!0:16===Ja||1===Ja||Xa.hasPrecedingLineBreak()}function Y(){return Q()?(23===Ja&&F(),!0):W(23)}function $(e,t){return qa++,t>=0||(t=Xa.getStartPos()),new Ma(e,t,t)}function Z(e,t){return e.end=void 0===t?Xa.getStartPos():t,Ga&&(e.parserContextFlags=Ga),Ya&&(Ya=!1,e.parserContextFlags|=16),e}function ee(e,t,n,r){t?N(Xa.getStartPos(),0,n,r):P(n,r);var a=$(e,Xa.getStartPos());return a.text="",Z(a)}function te(t){return t=e.escapeIdentifier(t),e.hasProperty(Wa,t)?Wa[t]:Wa[t]=t}function ne(t,n){if(Va++,t){var r=$(69);return 69!==Ja&&(r.originalKeywordKind=Ja),r.text=te(Xa.getTokenValue()),F(),Z(r)}return ee(69,!1,n||e.Diagnostics.Identifier_expected)}function re(e){return ne(q(),e)}function ae(){return ne(e.tokenIsIdentifierOrKeyword(Ja))}function ie(){return e.tokenIsIdentifierOrKeyword(Ja)||9===Ja||8===Ja}function oe(e){return 9===Ja||8===Ja?Ge(!0):e&&19===Ja?ue():ae()}function se(){return oe(!0)}function ce(){return oe(!1)}function _e(){return 9===Ja||8===Ja||e.tokenIsIdentifierOrKeyword(Ja)}function ue(){var e=$(137);return W(19),e.expression=h(Vt),W(20),Z(e)}function le(e){return Ja===e&&U(pe)}function de(){return F(),Xa.hasPrecedingLineBreak()?!1:me()}function pe(){return 74===Ja?81===F():82===Ja?(F(),77===Ja?J(ge):37!==Ja&&15!==Ja&&me()):77===Ja?ge():113===Ja?(F(),me()):de()}function fe(){return e.isModifierKind(Ja)&&U(pe)}function me(){return 19===Ja||15===Ja||37===Ja||ie()}function ge(){return F(),73===Ja||87===Ja}function ye(t,n){var r=we(t);if(r)return!0;switch(t){case 0:case 1:case 3:return!(23===Ja&&n)&&Tr();case 2:return 71===Ja||77===Ja;case 4:return yt();case 5:return J(Yr)||23===Ja&&!n;case 6:return 19===Ja||ie();case 12:return 19===Ja||37===Ja||ie();case 9:return 19===Ja||ie();case 7:return 15===Ja?J(he):n?q()&&!be():Ut()&&!be();case 8:return Mr();case 10:return 24===Ja||22===Ja||Mr();case 17:return q();case 11:case 15:return 24===Ja||22===Ja||qt();case 16:return at();case 18:case 19:return 24===Ja||Pt();case 20:return ua();case 21:return e.tokenIsIdentifierOrKeyword(Ja);case 13:return e.tokenIsIdentifierOrKeyword(Ja)||15===Ja;case 14:return!0;case 22:case 23:case 25:return ei.isJSDocType();case 24:return _e()}e.Debug.fail("Non-exhaustive case in 'isListElement'.")}function he(){if(e.Debug.assert(15===Ja),16===F()){var t=F();return 24===t||15===t||83===t||106===t}return!0}function ve(){return F(),q()}function ke(){return F(),e.tokenIsIdentifierOrKeyword(Ja)}function be(){return 106===Ja||83===Ja?J(xe):!1}function xe(){return F(),qt()}function Ce(e){
if(1===Ja)return!0;switch(e){case 1:case 2:case 4:case 5:case 6:case 12:case 9:case 21:return 16===Ja;case 3:return 16===Ja||71===Ja||77===Ja;case 7:return 15===Ja||83===Ja||106===Ja;case 8:return De();case 17:return 27===Ja||17===Ja||15===Ja||83===Ja||106===Ja;case 11:return 18===Ja||23===Ja;case 15:case 19:case 10:return 20===Ja;case 16:return 18===Ja||20===Ja;case 18:return 27===Ja||17===Ja;case 20:return 15===Ja||16===Ja;case 13:return 27===Ja||39===Ja;case 14:return 25===Ja&&J(xa);case 22:return 18===Ja||54===Ja||16===Ja;case 23:return 27===Ja||16===Ja;case 25:return 20===Ja||16===Ja;case 24:return 16===Ja}}function De(){return Q()?!0:cn(Ja)?!0:34===Ja}function Se(){for(var e=0;26>e;e++)if(Ha&1<<e&&(ye(e,!0)||Ce(e)))return!0;return!1}function Te(e,t){var n=Ha;Ha|=1<<e;var r=[];for(r.pos=R();!Ce(e);)if(ye(e,!1)){var a=Ee(e,t);r.push(a)}else if(Be(e))break;return r.end=I(),Ha=n,r}function Ee(e,t){var n=we(e);return n?Ae(n):t()}function we(t){if(!Ya&&ja){var n=ja.currentNode(Xa.getStartPos());if(!e.nodeIsMissing(n)&&!n.intersectsChange&&!e.containsParseError(n)){var r=63&n.parserContextFlags;if(r===Ga&&Pe(n,t))return n}}}function Ae(e){return Xa.setTextPos(e.end),F(),e}function Pe(e,t){switch(t){case 5:return Ne(e);case 2:return Oe(e);case 0:case 1:case 3:return Re(e);case 6:return Ie(e);case 4:return Fe(e);case 8:return Le(e);case 16:return Me(e);case 20:case 17:case 19:case 18:case 11:case 12:case 7:case 13:case 14:}return!1}function Ne(e){if(e)switch(e.kind){case 145:case 150:case 146:case 147:case 142:case 194:return!0;case 144:var t=e,n=69===t.name.kind&&121===t.name.originalKeywordKind;return!n}return!1}function Oe(e){if(e)switch(e.kind){case 244:case 245:return!0}return!1}function Re(e){if(e)switch(e.kind){case 216:case 196:case 195:case 199:case 198:case 211:case 207:case 209:case 206:case 205:case 203:case 204:case 202:case 201:case 208:case 197:case 212:case 210:case 200:case 213:case 225:case 224:case 231:case 230:case 221:case 217:case 218:case 220:case 219:return!0}return!1}function Ie(e){return 250===e.kind}function Fe(e){if(e)switch(e.kind){case 149:case 143:case 150:case 141:case 148:return!0}return!1}function Le(e){if(214!==e.kind)return!1;var t=e;return void 0===t.initializer}function Me(e){if(139!==e.kind)return!1;var t=e;return void 0===t.initializer}function Be(e){return P(ze(e)),Se()?!0:(F(),!1)}function ze(t){switch(t){case 0:return e.Diagnostics.Declaration_or_statement_expected;case 1:return e.Diagnostics.Declaration_or_statement_expected;case 2:return e.Diagnostics.case_or_default_expected;case 3:return e.Diagnostics.Statement_expected;case 4:return e.Diagnostics.Property_or_signature_expected;case 5:return e.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected;case 6:return e.Diagnostics.Enum_member_expected;case 7:return e.Diagnostics.Expression_expected;case 8:return e.Diagnostics.Variable_declaration_expected;case 9:return e.Diagnostics.Property_destructuring_pattern_expected;case 10:return e.Diagnostics.Array_element_destructuring_pattern_expected;case 11:return e.Diagnostics.Argument_expression_expected;case 12:return e.Diagnostics.Property_assignment_expected;case 15:return e.Diagnostics.Expression_or_comma_expected;case 16:return e.Diagnostics.Parameter_declaration_expected;case 17:return e.Diagnostics.Type_parameter_declaration_expected;case 18:return e.Diagnostics.Type_argument_expected;case 19:return e.Diagnostics.Type_expected;case 20:return e.Diagnostics.Unexpected_token_expected;case 21:return e.Diagnostics.Identifier_expected;case 13:return e.Diagnostics.Identifier_expected;case 14:return e.Diagnostics.Identifier_expected;case 22:return e.Diagnostics.Parameter_declaration_expected;case 23:return e.Diagnostics.Type_argument_expected;case 25:return e.Diagnostics.Type_expected;case 24:return e.Diagnostics.Property_assignment_expected}}function Ke(e,t,n){var r=Ha;Ha|=1<<e;var a=[];a.pos=R();for(var i=-1;;)if(ye(e,!1)){if(a.push(Ee(e,t)),i=Xa.getTokenPos(),V(24))continue;if(i=-1,Ce(e))break;W(24),n&&23===Ja&&!Xa.hasPrecedingLineBreak()&&F()}else{if(Ce(e))break;if(Be(e))break}return i>=0&&(a.hasTrailingComma=!0),a.end=I(),Ha=r,a}function je(){var e=R(),t=[];return t.pos=e,t.end=e,t}function Je(e,t,n,r){if(W(n)){var a=Ke(e,t);return W(r),a}return je()}function Ue(e,t){for(var n=re(t);V(21);){var r=$(136,n.pos);r.left=n,r.right=qe(e),n=Z(r)}return n}function qe(t){if(Xa.hasPrecedingLineBreak()&&e.tokenIsIdentifierOrKeyword(Ja)){var n=J(br);if(n)return ee(69,!0,e.Diagnostics.Identifier_expected)}return t?ae():re()}function We(){var t=$(186);t.head=Xe(),e.Debug.assert(12===t.head.kind,"Template head has wrong token kind");var n=[];n.pos=R();do n.push(Ve());while(13===e.lastOrUndefined(n).literal.kind);return n.end=I(),t.templateSpans=n,Z(t)}function Ve(){var t=$(193);t.expression=h(Vt);var n;return 16===Ja?(B(),n=Xe()):n=G(14,!1,e.Diagnostics._0_expected,e.tokenToString(16)),t.literal=n,Z(t)}function He(){return Qe(163,!0)}function Ge(e){return Qe(Ja,e)}function Xe(){return Qe(Ja,!1)}function Qe(t,n){var r=$(t),a=Xa.getTokenValue();r.text=n?te(a):a,Xa.hasExtendedUnicodeEscape()&&(r.hasExtendedUnicodeEscape=!0),Xa.isUnterminated()&&(r.isUnterminated=!0);var i=Xa.getTokenPos();return F(),Z(r),8===r.kind&&48===Ua.charCodeAt(i)&&e.isOctalDigit(Ua.charCodeAt(i+1))&&(r.flags|=32768),r}function Ye(){var t=Ue(!1,e.Diagnostics.Type_expected),n=$(152,t.pos);return n.typeName=t,Xa.hasPrecedingLineBreak()||25!==Ja||(n.typeArguments=Je(18,Kt,25,27)),Z(n)}function $e(e){F();var t=$(151,e.pos);return t.parameterName=e,t.type=Kt(),Z(t)}function Ze(){var e=$(162);return F(),Z(e)}function et(){var e=$(155);return W(101),e.exprName=Ue(!0),Z(e)}function tt(){var e=$(138);return e.name=re(),V(83)&&(Pt()||!qt()?e.constraint=Kt():e.expression=kn()),Z(e)}function nt(){return 25===Ja?Je(17,tt,25,27):void 0}function rt(){return V(54)?Kt():void 0}function at(){return 22===Ja||Mr()||e.isModifierKind(Ja)||55===Ja}function it(e,t){t&&(e.flags|=t.flags,e.modifiers=t)}function ot(){var t=$(139);return t.decorators=$r(),it(t,Zr()),t.dotDotDotToken=H(22),t.name=Br(),0===e.getFullWidth(t.name)&&0===t.flags&&e.isModifierKind(Ja)&&F(),t.questionToken=H(53),t.type=rt(),t.initializer=st(!0),c(Z(t))}function st(e){return e?ct():Gr()}function ct(){return Ht(!0)}function _t(e,t,n,r,a){var i=34===e;a.typeParameters=nt(),a.parameters=ut(t,n,r),i?(W(e),a.type=Bt()):V(e)&&(a.type=Bt())}function ut(e,t,n){if(W(17)){var r=T(),a=A();p(e),m(t);var i=Ke(16,ot);if(p(r),m(a),!W(18)&&n)return;return i}return n?void 0:je()}function lt(){V(24)||Y()}function dt(e){var t=$(e);return 149===e&&W(92),_t(54,!1,!1,!1,t),lt(),Z(t)}function pt(){return 19!==Ja?!1:J(ft)}function ft(){if(F(),22===Ja||20===Ja)return!0;if(e.isModifierKind(Ja)){if(F(),q())return!0}else{if(!q())return!1;F()}return 54===Ja||24===Ja?!0:53!==Ja?!1:(F(),54===Ja||24===Ja||20===Ja)}function mt(e,t,n){var r=$(150,e);return r.decorators=t,it(r,n),r.parameters=Je(16,ot,19,20),r.type=Jt(),lt(),Z(r)}function gt(){var e=Xa.getStartPos(),t=se(),n=H(53);if(17===Ja||25===Ja){var r=$(143,e);return r.name=t,r.questionToken=n,_t(54,!1,!1,!1,r),lt(),Z(r)}var a=$(141,e);return a.name=t,a.questionToken=n,a.type=Jt(),56===Ja&&(a.initializer=Gr()),lt(),Z(a)}function yt(){switch(Ja){case 17:case 25:case 19:return!0;default:if(e.isModifierKind(Ja)){var t=J(ht);if(t)return t}return ie()&&J(vt)}}function ht(){for(;e.isModifierKind(Ja);)F();return pt()}function vt(){return F(),17===Ja||25===Ja||53===Ja||54===Ja||Q()}function kt(){switch(Ja){case 17:case 25:return dt(148);case 19:return pt()?mt(Xa.getStartPos(),void 0,void 0):gt();case 92:if(J(xt))return dt(149);case 9:case 8:return gt();default:if(e.isModifierKind(Ja)){var t=U(bt);if(t)return t}if(e.tokenIsIdentifierOrKeyword(Ja))return gt()}}function bt(){var e=Xa.getStartPos(),t=$r(),n=Zr();return pt()?mt(e,t,n):void 0}function xt(){return F(),17===Ja||25===Ja}function Ct(){var e=$(156);return e.members=Dt(),Z(e)}function Dt(){var e;return W(15)?(e=Te(4,kt),W(16)):e=je(),e}function St(){var e=$(158);return e.elementTypes=Je(19,Kt,19,20),Z(e)}function Tt(){var e=$(161);return W(17),e.type=Kt(),W(18),Z(e)}function Et(e){var t=$(e);return 154===e&&W(92),_t(34,!1,!1,!1,t),Z(t)}function wt(){var e=X();return 21===Ja?void 0:e}function At(){switch(Ja){case 117:case 130:case 128:case 120:case 131:var e=U(wt);return e||Ye();case 9:return He();case 103:return X();case 97:var t=Ze();return 124!==Ja||Xa.hasPrecedingLineBreak()?t:$e(t);case 101:return et();case 15:return Ct();case 19:return St();case 17:return Tt();default:return Ye()}}function Pt(){switch(Ja){case 117:case 130:case 128:case 120:case 131:case 103:case 97:case 101:case 15:case 19:case 25:case 92:case 9:return!0;case 17:return J(Nt);default:return q()}}function Nt(){return F(),18===Ja||at()||Pt()}function Ot(){for(var e=At();!Xa.hasPrecedingLineBreak()&&V(19);){W(20);var t=$(157,e.pos);t.elementType=e,e=Z(t)}return e}function Rt(e,t,n){var r=t();if(Ja===n){var a=[r];for(a.pos=r.pos;V(n);)a.push(t());a.end=I();var i=$(e,r.pos);i.types=a,r=Z(i)}return r}function It(){return Rt(160,Ot,46)}function Ft(){return Rt(159,It,47)}function Lt(){return 25===Ja?!0:17===Ja&&J(Mt)}function Mt(){if(F(),18===Ja||22===Ja)return!0;if(q()||e.isModifierKind(Ja)){if(F(),54===Ja||24===Ja||53===Ja||56===Ja||q()||e.isModifierKind(Ja))return!0;if(18===Ja&&(F(),34===Ja))return!0}return!1}function Bt(){var e=q()&&U(zt),t=Kt();if(e){var n=$(151,e.pos);return n.parameterName=e,n.type=t,Z(n)}return t}function zt(){var e=re();return 124!==Ja||Xa.hasPrecedingLineBreak()?void 0:(F(),e)}function Kt(){return g(10,jt)}function jt(){return Lt()?Et(153):92===Ja?Et(154):Ft()}function Jt(){return V(54)?Kt():void 0}function Ut(){switch(Ja){case 97:case 95:case 93:case 99:case 84:case 8:case 9:case 11:case 12:case 17:case 19:case 15:case 87:case 73:case 92:case 39:case 61:case 69:return!0;default:return q()}}function qt(){if(Ut())return!0;switch(Ja){case 35:case 36:case 50:case 49:case 78:case 101:case 103:case 41:case 42:case 25:case 119:case 114:return!0;default:return un()?!0:q()}}function Wt(){return 15!==Ja&&87!==Ja&&73!==Ja&&55!==Ja&&qt()}function Vt(){var e=w();e&&f(!1);for(var t,n=Gt();t=H(24);)n=dn(n,t,Gt());return e&&f(!0),n}function Ht(e){return 56===Ja||!(Xa.hasPrecedingLineBreak()||e&&15===Ja)&&qt()?(W(56),Gt()):void 0}function Gt(){if(Xt())return Yt();var t=Zt();if(t)return t;var n=sn(0);return 69===n.kind&&34===Ja?$t(n):e.isLeftHandSideExpression(n)&&e.isAssignmentOperator(L())?dn(n,X(),Gt()):on(n)}function Xt(){return 114===Ja?T()?!0:J(Cr):!1}function Qt(){return F(),!Xa.hasPrecedingLineBreak()&&q()}function Yt(){var e=$(187);return F(),Xa.hasPrecedingLineBreak()||37!==Ja&&!qt()?Z(e):(e.asteriskToken=H(37),e.expression=Gt(),Z(e))}function $t(t){e.Debug.assert(34===Ja,"parseSimpleArrowFunctionExpression should only have been called if we had a =>");var n=$(177,t.pos),r=$(139,t.pos);return r.name=t,Z(r),n.parameters=[r],n.parameters.pos=r.pos,n.parameters.end=r.end,n.equalsGreaterThanToken=G(34,!1,e.Diagnostics._0_expected,"=>"),n.body=an(!1),Z(n)}function Zt(){var t=en();if(0!==t){var n=1===t?rn(!0):U(nn);if(n){var r=!!(256&n.flags),a=Ja;return n.equalsGreaterThanToken=G(34,!1,e.Diagnostics._0_expected,"=>"),n.body=34===a||15===a?an(r):re(),Z(n)}}}function en(){return 17===Ja||25===Ja||118===Ja?J(tn):34===Ja?1:0}function tn(){if(118===Ja){if(F(),Xa.hasPrecedingLineBreak())return 0;if(17!==Ja&&25!==Ja)return 0}var t=Ja,n=F();if(17===t){if(18===n){var r=F();switch(r){case 34:case 54:case 15:return 1;default:return 0}}return 19===n||15===n?2:22===n?1:q()?54===F()?1:2:0}if(e.Debug.assert(25===t),!q())return 0;if(1===za.languageVariant){var a=J(function(){var e=F();if(83===e){var t=F();switch(t){case 56:case 27:return!1;default:return!0}}else if(24===e)return!0;return!1});return a?1:0}return 2}function nn(){return rn(!1)}function rn(e){var t=$(177);it(t,ea());var n=!!(256&t.flags);return _t(54,!1,n,!e,t),t.parameters&&(e||34===Ja||15===Ja)?t:void 0}function an(e){return 15===Ja?rr(!1,e,!1):23!==Ja&&87!==Ja&&73!==Ja&&Tr()&&!Wt()?rr(!1,e,!0):e?x(Gt):C(Gt)}function on(t){var n=H(53);if(!n)return t;var r=$(185,t.pos);return r.condition=t,r.questionToken=n,r.whenTrue=g(Qa,Gt),r.colonToken=G(54,!1,e.Diagnostics._0_expected,e.tokenToString(54)),r.whenFalse=Gt(),Z(r)}function sn(e){var t=kn();return _n(e,t)}function cn(e){return 90===e||135===e}function _n(e,t){for(;;){L();var n=ln(),r=38===Ja?n>=e:n>e;if(!r)break;if(90===Ja&&E())break;if(116===Ja){if(Xa.hasPrecedingLineBreak())break;F(),t=pn(t,Kt())}else t=dn(t,X(),sn(n))}return t}function un(){return E()&&90===Ja?!1:ln()>0}function ln(){switch(Ja){case 52:return 1;case 51:return 2;case 47:return 3;case 48:return 4;case 46:return 5;case 30:case 31:case 32:case 33:return 6;case 25:case 27:case 28:case 29:case 91:case 90:case 116:return 7;case 43:case 44:case 45:return 8;case 35:case 36:return 9;case 37:case 39:case 40:return 10;case 38:return 11}return-1}function dn(e,t,n){var r=$(184,e.pos);return r.left=e,r.operatorToken=t,r.right=n,Z(r)}function pn(e,t){var n=$(192,e.pos);return n.expression=e,n.type=t,Z(n)}function fn(){var e=$(182);return e.operator=Ja,F(),e.operand=bn(),Z(e)}function mn(){var e=$(178);return F(),e.expression=bn(),Z(e)}function gn(){var e=$(179);return F(),e.expression=bn(),Z(e)}function yn(){var e=$(180);return F(),e.expression=bn(),Z(e)}function hn(){return 119===Ja?A()?!0:J(Qt):!1}function vn(){var e=$(181);return F(),e.expression=bn(),Z(e)}function kn(){if(hn())return vn();if(xn()){var t=Cn();return 38===Ja?_n(ln(),t):t}var n=Ja,r=bn();if(38===Ja){var a=e.skipTrivia(Ua,r.pos);174===r.kind?N(a,r.end-a,e.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses):N(a,r.end-a,e.Diagnostics.An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses,e.tokenToString(n))}return r}function bn(){switch(Ja){case 35:case 36:case 50:case 49:return fn();case 78:return mn();case 101:return gn();case 103:return yn();case 25:return Bn();default:return Cn()}}function xn(){switch(Ja){case 35:case 36:case 50:case 49:case 78:case 101:case 103:return!1;case 25:if(1!==za.languageVariant)return!1;default:return!0}}function Cn(){if(41===Ja||42===Ja){var t=$(182);return t.operator=Ja,F(),t.operand=Dn(),Z(t)}if(1===za.languageVariant&&25===Ja&&J(ke))return wn(!0);var n=Dn();if(e.Debug.assert(e.isLeftHandSideExpression(n)),(41===Ja||42===Ja)&&!Xa.hasPrecedingLineBreak()){var t=$(183,n.pos);return t.operand=n,t.operator=Ja,F(),Z(t)}return n}function Dn(){var e=95===Ja?Tn():Sn();return Kn(e)}function Sn(){var e=qn();return zn(e)}function Tn(){var t=X();if(17===Ja||21===Ja||19===Ja)return t;var n=$(169,t.pos);return n.expression=t,n.dotToken=G(21,!1,e.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access),n.name=qe(!0),Z(n)}function En(e,t){return e.kind!==t.kind?!1:69===e.kind?e.text===t.text:e.right.text===t.right.text&&En(e.left,t.left)}function wn(t){var n,r=On(t);if(238===r.kind){var a=$(236,r.pos);a.openingElement=r,a.children=Nn(a.openingElement.tagName),a.closingElement=Mn(t),En(a.openingElement.tagName,a.closingElement.tagName)||N(a.closingElement.pos,a.closingElement.end-a.closingElement.pos,e.Diagnostics.Expected_corresponding_JSX_closing_tag_for_0,e.getTextOfNodeFromSourceText(Ua,a.openingElement.tagName)),n=Z(a)}else e.Debug.assert(237===r.kind),n=r;if(t&&25===Ja){var i=U(function(){return wn(!0)});if(i){P(e.Diagnostics.JSX_expressions_must_have_one_parent_element);var o=$(184,n.pos);return o.end=i.end,o.left=n,o.right=i,o.operatorToken=ee(24,!1,void 0),o.operatorToken.pos=o.operatorToken.end=o.right.pos,o}}return n}function An(){var e=$(239,Xa.getStartPos());return Ja=Xa.scanJsxToken(),Z(e)}function Pn(){switch(Ja){case 239:return An();case 15:return In(!1);case 25:return wn(!1)}e.Debug.fail("Unknown JSX child kind "+Ja)}function Nn(t){var n=[];n.pos=Xa.getStartPos();var r=Ha;for(Ha|=16384;;){if(Ja=Xa.reScanJsxToken(),26===Ja)break;if(1===Ja){N(t.pos,t.end-t.pos,e.Diagnostics.JSX_element_0_has_no_corresponding_closing_tag,e.getTextOfNodeFromSourceText(Ua,t));break}n.push(Pn())}return n.end=Xa.getTokenPos(),Ha=r,n}function On(e){var t=Xa.getStartPos();W(25);var n,r=Rn(),a=Te(13,Fn);return 27===Ja?(n=$(238,t),K()):(W(39),e?W(27):(W(27,void 0,!1),K()),n=$(237,t)),n.tagName=r,n.attributes=a,Z(n)}function Rn(){z();for(var e=ae();V(21);){z();var t=$(136,e.pos);t.left=e,t.right=ae(),e=Z(t)}return e}function In(e){var t=$(243);return W(15),16!==Ja&&(t.expression=Gt()),e?W(16):(W(16,void 0,!1),K()),Z(t)}function Fn(){if(15===Ja)return Ln();z();var e=$(241);if(e.name=ae(),V(56))switch(Ja){case 9:e.initializer=Ge();break;default:e.initializer=In(!0)}return Z(e)}function Ln(){var e=$(242);return W(15),W(22),e.expression=Vt(),W(16),Z(e)}function Mn(e){var t=$(240);return W(26),t.tagName=Rn(),e?W(27):(W(27,void 0,!1),K()),Z(t)}function Bn(){var e=$(174);return W(25),e.type=Kt(),W(27),e.expression=bn(),Z(e)}function zn(e){for(;;){var t=H(21);if(t){var n=$(169,e.pos);n.expression=e,n.dotToken=t,n.name=qe(!0),e=Z(n)}else if(w()||!V(19)){if(11!==Ja&&12!==Ja)return e;var r=$(173,e.pos);r.tag=e,r.template=11===Ja?Ge():We(),e=Z(r)}else{var a=$(170,e.pos);if(a.expression=e,20!==Ja&&(a.argumentExpression=h(Vt),9===a.argumentExpression.kind||8===a.argumentExpression.kind)){var i=a.argumentExpression;i.text=te(i.text)}W(20),e=Z(a)}}}function Kn(e){for(;;)if(e=zn(e),25!==Ja){if(17!==Ja)return e;var t=$(171,e.pos);t.expression=e,t.arguments=jn(),e=Z(t)}else{var n=U(Jn);if(!n)return e;var t=$(171,e.pos);t.expression=e,t.typeArguments=n,t.arguments=jn(),e=Z(t)}}function jn(){W(17);var e=Ke(11,Gn);return W(18),e}function Jn(){if(V(25)){var e=Ke(18,Kt);if(W(27))return e&&Un()?e:void 0}}function Un(){switch(Ja){case 17:case 21:case 18:case 20:case 54:case 23:case 53:case 30:case 32:case 31:case 33:case 51:case 52:case 48:case 46:case 47:case 16:case 1:return!0;case 24:case 15:default:return!1}}function qn(){switch(Ja){case 8:case 9:case 11:return Ge();case 97:case 95:case 93:case 99:case 84:return X();case 17:return Wn();case 19:return Xn();case 15:return $n();case 118:if(!J(xr))break;return Zn();case 73:return na();case 87:return Zn();case 92:return tr();case 39:case 61:if(10===M())return Ge();break;case 12:return We()}return re(e.Diagnostics.Expression_expected)}function Wn(){var e=$(175);return W(17),e.expression=h(Vt),W(18),Z(e)}function Vn(){var e=$(188);return W(22),e.expression=Gt(),Z(e)}function Hn(){return 22===Ja?Vn():24===Ja?$(190):Gt()}function Gn(){return g(Qa,Hn)}function Xn(){var e=$(167);return W(19),Xa.hasPrecedingLineBreak()&&(e.flags|=1024),e.elements=Ke(15,Hn),W(20),Z(e)}function Qn(e,t,n){return le(123)?Xr(146,e,t,n):le(129)?Xr(147,e,t,n):void 0}function Yn(){var e=Xa.getStartPos(),t=$r(),n=Zr(),r=Qn(e,t,n);if(r)return r;var a=H(37),i=q(),o=se(),s=H(53);if(a||17===Ja||25===Ja)return Wr(e,t,n,a,o,s);var _=i&&(24===Ja||16===Ja||56===Ja);if(_){var u=$(249,e);u.name=o,u.questionToken=s;var l=H(56);return l&&(u.equalsToken=l,u.objectAssignmentInitializer=h(Gt)),c(Z(u))}var d=$(248,e);return d.modifiers=n,d.name=o,d.questionToken=s,W(54),d.initializer=h(Gt),c(Z(d))}function $n(){var e=$(168);return W(15),Xa.hasPrecedingLineBreak()&&(e.flags|=1024),e.properties=Ke(12,Yn,!0),W(16),Z(e)}function Zn(){var e=w();e&&f(!1);var t=$(176);it(t,Zr()),W(87),t.asteriskToken=H(37);var n=!!t.asteriskToken,r=!!(256&t.flags);return t.name=n&&r?D(er):n?k(er):r?x(er):er(),_t(54,n,r,!1,t),t.body=rr(n,r,!1),e&&f(!0),c(Z(t))}function er(){return q()?re():void 0}function tr(){var e=$(172);return W(92),e.expression=Sn(),e.typeArguments=U(Jn),(e.typeArguments||17===Ja)&&(e.arguments=jn()),Z(e)}function nr(e,t){var n=$(195);return W(15,t)||e?(n.statements=Te(1,Ar),W(16)):n.statements=je(),Z(n)}function rr(e,t,n,r){var a=T();p(e);var i=A();m(t);var o=w();o&&f(!1);var s=nr(n,r);return o&&f(!0),p(a),m(i),s}function ar(){var e=$(197);return W(23),Z(e)}function ir(){var e=$(199);return W(88),W(17),e.expression=h(Vt),W(18),e.thenStatement=Ar(),e.elseStatement=V(80)?Ar():void 0,Z(e)}function or(){var e=$(200);return W(79),e.statement=Ar(),W(104),W(17),e.expression=h(Vt),W(18),V(23),Z(e)}function sr(){var e=$(201);return W(104),W(17),e.expression=h(Vt),W(18),e.statement=Ar(),Z(e)}function cr(){var e=R();W(86),W(17);var t=void 0;23!==Ja&&(t=102===Ja||108===Ja||74===Ja?Kr(!0):v(Vt));var n;if(V(90)){var r=$(203,e);r.initializer=t,r.expression=h(Vt),W(18),n=r}else if(V(135)){var a=$(204,e);a.initializer=t,a.expression=h(Gt),W(18),n=a}else{var i=$(202,e);i.initializer=t,W(23),23!==Ja&&18!==Ja&&(i.condition=h(Vt)),W(23),18!==Ja&&(i.incrementor=h(Vt)),W(18),n=i}return n.statement=Ar(),Z(n)}function _r(e){var t=$(e);return W(206===e?70:75),Q()||(t.label=re()),Y(),Z(t)}function ur(){var e=$(207);return W(94),Q()||(e.expression=h(Vt)),Y(),Z(e)}function lr(){var e=$(208);return W(105),W(17),e.expression=h(Vt),W(18),e.statement=Ar(),Z(e)}function dr(){var e=$(244);return W(71),e.expression=h(Vt),W(54),e.statements=Te(3,Ar),Z(e)}function pr(){var e=$(245);return W(77),W(54),e.statements=Te(3,Ar),Z(e)}function fr(){return 71===Ja?dr():pr()}function mr(){var e=$(209);W(96),W(17),e.expression=h(Vt),W(18);var t=$(223,Xa.getStartPos());return W(15),t.clauses=Te(2,fr),W(16),e.caseBlock=Z(t),Z(e)}function gr(){var e=$(211);return W(98),e.expression=Xa.hasPrecedingLineBreak()?void 0:h(Vt),Y(),Z(e)}function yr(){var e=$(212);return W(100),e.tryBlock=nr(!1),e.catchClause=72===Ja?hr():void 0,e.catchClause&&85!==Ja||(W(85),e.finallyBlock=nr(!1)),Z(e)}function hr(){var e=$(247);return W(72),W(17)&&(e.variableDeclaration=zr()),W(18),e.block=nr(!1),Z(e)}function vr(){var e=$(213);return W(76),Y(),Z(e)}function kr(){var e=Xa.getStartPos(),t=h(Vt);if(69===t.kind&&V(54)){var n=$(210,e);return n.label=t,n.statement=Ar(),c(Z(n))}var r=$(198,e);return r.expression=t,Y(),c(Z(r))}function br(){return F(),e.tokenIsIdentifierOrKeyword(Ja)&&!Xa.hasPrecedingLineBreak()}function xr(){return F(),87===Ja&&!Xa.hasPrecedingLineBreak()}function Cr(){return F(),(e.tokenIsIdentifierOrKeyword(Ja)||8===Ja)&&!Xa.hasPrecedingLineBreak()}function Dr(){for(;;)switch(Ja){case 102:case 108:case 74:case 87:case 73:case 81:return!0;case 107:case 132:return Qt();case 125:case 126:return Nr();case 115:case 118:case 122:case 110:case 111:case 112:if(F(),Xa.hasPrecedingLineBreak())return!1;continue;case 134:return 15===F();case 89:return F(),9===Ja||37===Ja||15===Ja||e.tokenIsIdentifierOrKeyword(Ja);case 82:if(F(),56===Ja||37===Ja||15===Ja||77===Ja)return!0;continue;case 113:F();continue;default:return!1}}function Sr(){return J(Dr)}function Tr(){switch(Ja){case 55:case 23:case 15:case 102:case 108:case 87:case 73:case 81:case 88:case 79:case 104:case 86:case 75:case 70:case 94:case 105:case 96:case 98:case 100:case 76:case 72:case 85:return!0;case 74:case 82:case 89:return Sr();case 118:case 122:case 107:case 125:case 126:case 132:case 134:return!0;case 112:case 110:case 111:case 113:return Sr()||!J(br);default:return qt()}}function Er(){return F(),q()||15===Ja||19===Ja}function wr(){return J(Er)}function Ar(){switch(Ja){case 23:return ar();case 15:return nr(!1);case 102:return Jr(Xa.getStartPos(),void 0,void 0);case 108:if(wr())return Jr(Xa.getStartPos(),void 0,void 0);break;case 87:return Ur(Xa.getStartPos(),void 0,void 0);case 73:return ra(Xa.getStartPos(),void 0,void 0);case 88:return ir();case 79:return or();case 104:return sr();case 86:return cr();case 75:return _r(205);case 70:return _r(206);case 94:return ur();case 105:return lr();case 96:return mr();case 98:return gr();case 100:case 72:case 85:return yr();case 76:return vr();case 55:return Pr();case 118:case 107:case 132:case 125:case 126:case 122:case 74:case 81:case 82:case 89:case 110:case 111:case 112:case 115:case 113:case 134:if(Sr())return Pr()}return kr()}function Pr(){var t=R(),n=$r(),r=Zr();switch(Ja){case 102:case 108:case 74:return Jr(t,n,r);case 87:return Ur(t,n,r);case 73:return ra(t,n,r);case 107:return da(t,n,r);case 132:return pa(t,n,r);case 81:return ma(t,n,r);case 134:case 125:case 126:return va(t,n,r);case 89:return Ca(t,n,r);case 82:return F(),77===Ja||56===Ja?Ia(t,n,r):Ra(t,n,r);default:if(n||r){var a=ee(234,!0,e.Diagnostics.Declaration_expected);return a.pos=t,a.decorators=n,it(a,r),Z(a)}}}function Nr(){return F(),!Xa.hasPrecedingLineBreak()&&(q()||9===Ja)}function Or(e,t,n){return 15!==Ja&&Q()?void Y():rr(e,t,!1,n)}function Rr(){if(24===Ja)return $(190);var e=$(166);return e.dotDotDotToken=H(22),e.name=Br(),e.initializer=st(!1),Z(e)}function Ir(){var e=$(166),t=q(),n=se();return t&&54!==Ja?e.name=n:(W(54),e.propertyName=n,e.name=Br()),e.initializer=st(!1),Z(e)}function Fr(){var e=$(164);return W(15),e.elements=Ke(9,Ir),W(16),Z(e)}function Lr(){var e=$(165);return W(19),e.elements=Ke(10,Rr),W(20),Z(e)}function Mr(){return 15===Ja||19===Ja||q()}function Br(){return 19===Ja?Lr():15===Ja?Fr():re()}function zr(){var e=$(214);return e.name=Br(),e.type=Jt(),cn(Ja)||(e.initializer=Ht(!1)),Z(e)}function Kr(t){var n=$(215);switch(Ja){case 102:break;case 108:n.flags|=8192;break;case 74:n.flags|=16384;break;default:e.Debug.fail()}if(F(),135===Ja&&J(jr))n.declarations=je();else{var r=E();d(t),n.declarations=Ke(8,zr),d(r)}return Z(n)}function jr(){return ve()&&18===F()}function Jr(e,t,n){var r=$(196,e);return r.decorators=t,it(r,n),r.declarationList=Kr(!1),Y(),c(Z(r))}function Ur(t,n,r){var a=$(216,t);a.decorators=n,it(a,r),W(87),a.asteriskToken=H(37),a.name=512&a.flags?er():re();var i=!!a.asteriskToken,o=!!(256&a.flags);return _t(54,i,o,!1,a),a.body=Or(i,o,e.Diagnostics.or_expected),c(Z(a))}function qr(t,n,r){var a=$(145,t);return a.decorators=n,it(a,r),W(121),_t(54,!1,!1,!1,a),a.body=Or(!1,!1,e.Diagnostics.or_expected),c(Z(a))}function Wr(e,t,n,r,a,i,o){var s=$(144,e);s.decorators=t,it(s,n),s.asteriskToken=r,s.name=a,s.questionToken=i;var _=!!r,u=!!(256&s.flags);return _t(54,_,u,!1,s),s.body=Or(_,u,o),c(Z(s))}function Vr(e,t,n,r,a){var i=$(142,e);return i.decorators=t,it(i,n),i.name=r,i.questionToken=a,i.type=Jt(),i.initializer=n&&64&n.flags?h(Gr):g(3,Gr),Y(),Z(i)}function Hr(t,n,r){var a=H(37),i=se(),o=H(53);return a||17===Ja||25===Ja?Wr(t,n,r,a,i,o,e.Diagnostics.or_expected):Vr(t,n,r,i,o)}function Gr(){return Ht(!1)}function Xr(e,t,n,r){var a=$(e,t);return a.decorators=n,it(a,r),a.name=se(),_t(54,!1,!1,!1,a),a.body=Or(!1,!1),Z(a)}function Qr(e){switch(e){case 112:case 110:case 111:case 113:return!0;default:return!1}}function Yr(){var t;if(55===Ja)return!0;for(;e.isModifierKind(Ja);){if(t=Ja,Qr(t))return!0;F()}if(37===Ja)return!0;if(ie()&&(t=Ja,F()),19===Ja)return!0;if(void 0!==t){if(!e.isKeyword(t)||129===t||123===t)return!0;switch(Ja){case 17:case 25:case 54:case 56:case 53:return!0;default:return Q()}}return!1}function $r(){for(var e;;){var t=R();if(!V(55))break;e||(e=[],e.pos=t);var n=$(140,t);n.expression=b(Dn),e.push(Z(n))}return e&&(e.end=I()),e}function Zr(t){for(var n,r=0;;){var a=Xa.getStartPos(),i=Ja;if(74===Ja&&t){if(!U(de))break}else if(!fe())break;n||(n=[],n.pos=a),r|=e.modifierToFlag(i),n.push(Z($(i,a)))}return n&&(n.flags=r,n.end=Xa.getStartPos()),n}function ea(){var t,n=0;if(118===Ja){var r=Xa.getStartPos(),a=Ja;F(),t=[],t.pos=r,n|=e.modifierToFlag(a),t.push(Z($(a,r))),t.flags=n,t.end=Xa.getStartPos()}return t}function ta(){if(23===Ja){var t=$(194);return F(),Z(t)}var n=R(),r=$r(),a=Zr(!0),i=Qn(n,r,a);if(i)return i;if(121===Ja)return qr(n,r,a);if(pt())return mt(n,r,a);if(e.tokenIsIdentifierOrKeyword(Ja)||9===Ja||8===Ja||37===Ja||19===Ja)return Hr(n,r,a);if(r||a){var o=ee(69,!0,e.Diagnostics.Declaration_expected);return Vr(n,r,a,o,void 0)}e.Debug.fail("Should not have attempted to parse class member declaration.")}function na(){return aa(Xa.getStartPos(),void 0,void 0,189)}function ra(e,t,n){return aa(e,t,n,217)}function aa(e,t,n,r){var a=$(r,e);return a.decorators=t,it(a,n),W(73),a.name=ia(),a.typeParameters=nt(),a.heritageClauses=sa(!0),W(15)?(a.members=la(),W(16)):a.members=je(),Z(a)}function ia(){return q()&&!oa()?re():void 0}function oa(){return 106===Ja&&J(ke)}function sa(e){return ua()?Te(20,ca):void 0}function ca(){if(83===Ja||106===Ja){var e=$(246);return e.token=Ja,F(),e.types=Ke(7,_a),Z(e)}}function _a(){var e=$(191);return e.expression=Dn(),25===Ja&&(e.typeArguments=Je(18,Kt,25,27)),Z(e)}function ua(){return 83===Ja||106===Ja}function la(){return Te(5,ta)}function da(e,t,n){var r=$(218,e);return r.decorators=t,it(r,n),W(107),r.name=re(),r.typeParameters=nt(),r.heritageClauses=sa(!1),r.members=Dt(),Z(r)}function pa(e,t,n){var r=$(219,e);return r.decorators=t,it(r,n),W(132),r.name=re(),r.typeParameters=nt(),W(56),r.type=Kt(),Y(),Z(r)}function fa(){var e=$(250,Xa.getStartPos());return e.name=se(),e.initializer=h(Gr),Z(e)}function ma(e,t,n){var r=$(220,e);return r.decorators=t,it(r,n),W(81),r.name=re(),W(15)?(r.members=Ke(6,fa),W(16)):r.members=je(),Z(r)}function ga(){var e=$(222,Xa.getStartPos());return W(15)?(e.statements=Te(1,Ar),W(16)):e.statements=je(),Z(e)}function ya(e,t,n,r){var a=$(221,e),i=65536&r;return a.decorators=t,it(a,n),a.flags|=r,a.name=re(),a.body=V(21)?ya(R(),void 0,void 0,2|i):ga(),Z(a)}function ha(e,t,n){var r=$(221,e);return r.decorators=t,it(r,n),134===Ja?(r.name=re(),r.flags|=2097152):r.name=Ge(!0),r.body=ga(),Z(r)}function va(e,t,n){var r=n?n.flags:0;if(134===Ja)return ha(e,t,n);if(V(126))r|=65536;else if(W(125),9===Ja)return ha(e,t,n);return ya(e,t,n,r)}function ka(){return 127===Ja&&J(ba)}function ba(){return 17===F()}function xa(){return 39===F()}function Ca(e,t,n){W(89);var r,a=Xa.getStartPos();if(q()&&(r=re(),24!==Ja&&133!==Ja)){var i=$(224,e);return i.decorators=t,it(i,n),i.name=r,W(56),i.moduleReference=Sa(),Y(),Z(i)}var o=$(225,e);return o.decorators=t,it(o,n),(r||37===Ja||15===Ja)&&(o.importClause=Da(r,a),W(133)),o.moduleSpecifier=Ea(),Y(),Z(o)}function Da(e,t){var n=$(226,t);return e&&(n.name=e),n.name&&!V(24)||(n.namedBindings=37===Ja?wa():Aa(228)),Z(n)}function Sa(){return ka()?Ta():Ue(!1)}function Ta(){var e=$(235);return W(127),W(17),e.expression=Ea(),W(18),Z(e)}function Ea(){if(9===Ja){var e=Ge();return te(e.text),e}return Vt()}function wa(){var e=$(227);return W(37),W(116),e.name=re(),Z(e)}function Aa(e){var t=$(e);return t.elements=Je(21,228===e?Na:Pa,15,16),Z(t)}function Pa(){return Oa(233)}function Na(){return Oa(229)}function Oa(t){var n=$(t),r=e.isKeyword(Ja)&&!q(),a=Xa.getTokenPos(),i=Xa.getTextPos(),o=ae();return 116===Ja?(n.propertyName=o,W(116),r=e.isKeyword(Ja)&&!q(),a=Xa.getTokenPos(),i=Xa.getTextPos(),n.name=ae()):n.name=o,229===t&&r&&N(a,i-a,e.Diagnostics.Identifier_expected),Z(n)}function Ra(e,t,n){var r=$(231,e);return r.decorators=t,it(r,n),V(37)?(W(133),r.moduleSpecifier=Ea()):(r.exportClause=Aa(232),(133===Ja||9===Ja&&!Xa.hasPrecedingLineBreak())&&(W(133),r.moduleSpecifier=Ea())),Y(),Z(r)}function Ia(e,t,n){var r=$(230,e);return r.decorators=t,it(r,n),V(56)?r.isExportEquals=!0:W(77),r.expression=Gt(),Y(),Z(r)}function Fa(t){for(var n,r=e.createScanner(t.languageVersion,!1,0,Ua),a=[],i=[];;){var o=r.scan();if(2!==o){if(e.isTrivia(o))continue;break}var s={pos:r.getTokenPos(),end:r.getTextPos(),kind:r.getToken()},c=Ua.substring(s.pos,s.end),_=e.getFileReferenceFromReferencePath(c,s);if(_){var u=_.fileReference;t.hasNoDefaultLib=_.isNoDefaultLib;var l=_.diagnosticMessage;u&&a.push(u),l&&Ka.push(e.createFileDiagnostic(t,s.pos,s.end-s.pos,l))}else{var d=/^\/\/\/\s*<amd-module\s+name\s*=\s*('|")(.+?)\1/gim,p=d.exec(c);p&&(n&&Ka.push(e.createFileDiagnostic(t,s.pos,s.end-s.pos,e.Diagnostics.An_AMD_module_cannot_have_multiple_name_assignments)),n=p[2]);var f=/^\/\/\/\s*<amd-dependency\s/gim,m=/\spath\s*=\s*('|")(.+?)\1/gim,g=/\sname\s*=\s*('|")(.+?)\1/gim,y=f.exec(c);if(y){var h=m.exec(c),v=g.exec(c);if(h){var k={path:h[2],name:v?v[2]:void 0};i.push(k)}}}}t.referencedFiles=a,t.amdDependencies=i,t.moduleName=n}function La(t){t.externalModuleIndicator=e.forEach(t.statements,function(e){
return 2&e.flags||224===e.kind&&235===e.moduleReference.kind||225===e.kind||230===e.kind||231===e.kind?e:void 0})}var Ma,Ba,za,Ka,ja,Ja,Ua,qa,Wa,Va,Ha,Ga,Xa=e.createScanner(2,!0),Qa=5,Ya=!1;t.parseSourceFile=n,t.fixupParentReferences=_;var $a;!function(e){e[e.SourceElements=0]="SourceElements",e[e.BlockStatements=1]="BlockStatements",e[e.SwitchClauses=2]="SwitchClauses",e[e.SwitchClauseStatements=3]="SwitchClauseStatements",e[e.TypeMembers=4]="TypeMembers",e[e.ClassMembers=5]="ClassMembers",e[e.EnumMembers=6]="EnumMembers",e[e.HeritageClauseElement=7]="HeritageClauseElement",e[e.VariableDeclarations=8]="VariableDeclarations",e[e.ObjectBindingElements=9]="ObjectBindingElements",e[e.ArrayBindingElements=10]="ArrayBindingElements",e[e.ArgumentExpressions=11]="ArgumentExpressions",e[e.ObjectLiteralMembers=12]="ObjectLiteralMembers",e[e.JsxAttributes=13]="JsxAttributes",e[e.JsxChildren=14]="JsxChildren",e[e.ArrayLiteralMembers=15]="ArrayLiteralMembers",e[e.Parameters=16]="Parameters",e[e.TypeParameters=17]="TypeParameters",e[e.TypeArguments=18]="TypeArguments",e[e.TupleElementTypes=19]="TupleElementTypes",e[e.HeritageClauses=20]="HeritageClauses",e[e.ImportOrExportSpecifiers=21]="ImportOrExportSpecifiers",e[e.JSDocFunctionParameters=22]="JSDocFunctionParameters",e[e.JSDocTypeArguments=23]="JSDocTypeArguments",e[e.JSDocRecordMembers=24]="JSDocRecordMembers",e[e.JSDocTupleTypes=25]="JSDocTupleTypes",e[e.Count=26]="Count"}($a||($a={}));var Za;!function(e){e[e.False=0]="False",e[e.True=1]="True",e[e.Unknown=2]="Unknown"}(Za||(Za={}));var ei;!function(t){function n(){switch(Ja){case 37:case 53:case 17:case 19:case 49:case 15:case 87:case 22:case 92:case 97:return!0}return e.tokenIsIdentifierOrKeyword(Ja)}function r(e,t,n){a("file.js",e,2,void 0,1),Xa.setText(e,t,n),Ja=Xa.scan();var r=i(),s=Ka;return o(),r?{jsDocTypeExpression:r,diagnostics:s}:void 0}function i(){var e=$(252,Xa.getTokenPos());return W(15),e.type=s(),W(16),_(e),Z(e)}function s(){var e=c();if(47===Ja){var t=$(256,e.pos);t.types=T(e),e=Z(t)}if(56===Ja){var n=$(263,e.pos);F(),n.type=e,e=Z(n)}return e}function c(){for(var e=u();;)if(19===Ja){var t=$(255,e.pos);t.elementType=e,F(),W(20),e=Z(t)}else if(53===Ja){var n=$(258,e.pos);n.type=e,F(),e=Z(n)}else{if(49!==Ja)break;var r=$(259,e.pos);r.type=e,F(),e=Z(r)}return e}function u(){switch(Ja){case 37:return E();case 53:return w();case 17:return S();case 19:return C();case 49:return x();case 15:return k();case 87:return f();case 22:return p();case 92:return d();case 97:return l();case 117:case 130:case 128:case 120:case 131:case 103:return X()}return g()}function l(){var e=$(267);return F(),W(54),e.type=c(),Z(e)}function d(){var e=$(266);return F(),W(54),e.type=c(),Z(e)}function p(){var e=$(265);return F(),e.type=c(),Z(e)}function f(){var e=$(264);return F(),W(17),e.parameters=Ke(22,m),D(e.parameters),W(18),54===Ja&&(F(),e.type=c()),Z(e)}function m(){var e=$(139);return e.type=c(),V(56)&&(e.questionToken=$(56)),Z(e)}function g(){var e=$(262);if(e.name=ce(),25===Ja)e.typeArguments=y();else for(;V(21);){if(25===Ja){e.typeArguments=y();break}e.name=v(e.name)}return Z(e)}function y(){F();var e=Ke(23,c);return D(e),h(e),W(27),e}function h(t){if(0===Ka.length&&t&&0===t.length){var n=t.pos-"<".length,r=e.skipTrivia(Ua,t.end)+">".length;return N(n,r-n,e.Diagnostics.Type_argument_list_cannot_be_empty)}}function v(e){var t=$(136,e.pos);return t.left=e,t.right=ae(),Z(t)}function k(){var e=$(260);return F(),e.members=Ke(24,b),D(e.members),W(16),Z(e)}function b(){var e=$(261);return e.name=ce(),54===Ja&&(F(),e.type=c()),Z(e)}function x(){var e=$(259);return F(),e.type=c(),Z(e)}function C(){var e=$(257);return F(),e.types=Ke(25,c),D(e.types),W(20),Z(e)}function D(t){if(0===Ka.length&&t.hasTrailingComma){var n=t.end-",".length;N(n,",".length,e.Diagnostics.Trailing_comma_not_allowed)}}function S(){var e=$(256);return F(),e.types=T(c()),W(18),Z(e)}function T(t){e.Debug.assert(!!t);var n=[];for(n.pos=t.pos,n.push(t);V(47);)n.push(c());return n.end=Xa.getStartPos(),n}function E(){var e=$(253);return F(),Z(e)}function w(){var e=Xa.getStartPos();if(F(),24===Ja||16===Ja||18===Ja||27===Ja||56===Ja||47===Ja){var t=$(254,e);return Z(t)}var t=$(258,e);return t.type=c(),Z(t)}function A(e,t,n){a("file.js",e,2,void 0,1),za={languageVariant:0,text:e};var r=R(t,n),i=Ka;return o(),r?{jsDocComment:r,diagnostics:i}:void 0}function O(e,t,n){var r=Ja,a=Ka.length,i=Ya,o=R(t,n);return o&&(o.parent=e),Ja=r,Ka.length=a,Ya=i,o}function R(t,n){function r(){if(v){var e=$(268,t);return e.tags=v,Z(e,h)}}function a(){for(;5===Ja||4===Ja;)m()}function o(){e.Debug.assert(55===Ja);var t=$(55,Xa.getTokenPos());t.end=Xa.getTextPos(),m();var n=g();if(n){var r=s(t,n)||c(t,n);_(r)}}function s(e,t){if(t)switch(t.text){case"param":return l(e,t);case"return":case"returns":return d(e,t);case"template":return f(e,t);case"type":return p(e,t)}}function c(e,t){var n=$(269,e.pos);return n.atToken=e,n.tagName=t,Z(n)}function _(e){e&&(v||(v=[],v.pos=e.pos),v.push(e),v.end=e.end)}function u(){if(15===Ja){var e=i();return e}}function l(t,n){var r=u();a();var i,o;if(H(19)?(i=g(),o=!0,H(56)&&Vt(),W(20)):69===Ja&&(i=g()),!i)return void N(Xa.getStartPos(),0,e.Diagnostics.Identifier_expected);var s,c;r?c=i:s=i,r||(r=u());var _=$(270,t.pos);return _.atToken=t,_.tagName=n,_.preParameterName=s,_.typeExpression=r,_.postParameterName=c,_.isBracketed=o,Z(_)}function d(t,n){e.forEach(v,function(e){return 271===e.kind})&&N(n.pos,Xa.getTokenPos()-n.pos,e.Diagnostics._0_tag_already_specified,n.text);var r=$(271,t.pos);return r.atToken=t,r.tagName=n,r.typeExpression=u(),Z(r)}function p(t,n){e.forEach(v,function(e){return 272===e.kind})&&N(n.pos,Xa.getTokenPos()-n.pos,e.Diagnostics._0_tag_already_specified,n.text);var r=$(272,t.pos);return r.atToken=t,r.tagName=n,r.typeExpression=u(),Z(r)}function f(t,n){e.forEach(v,function(e){return 273===e.kind})&&N(n.pos,Xa.getTokenPos()-n.pos,e.Diagnostics._0_tag_already_specified,n.text);var r=[];for(r.pos=Xa.getStartPos();;){var a=g();if(!a)return void N(Xa.getStartPos(),0,e.Diagnostics.Identifier_expected);var i=$(138,a.pos);if(i.name=a,Z(i),r.push(i),24!==Ja)break;m()}var o=$(273,t.pos);return o.atToken=t,o.tagName=n,o.typeParameters=r,Z(o),r.end=o.end,o}function m(){return Ja=Xa.scanJSDocToken()}function g(){if(69!==Ja)return void P(e.Diagnostics.Identifier_expected);var t=Xa.getTokenPos(),n=Xa.getTextPos(),r=$(69,t);return r.text=y.substring(t,n),Z(r,n),m(),r}var y=Ua;t=t||0;var h=void 0===n?y.length:t+n;n=h-t,e.Debug.assert(t>=0),e.Debug.assert(h>=t),e.Debug.assert(h<=y.length);var v,k;return 47===y.charCodeAt(t)&&42===y.charCodeAt(t+1)&&42===y.charCodeAt(t+2)&&42!==y.charCodeAt(t+3)&&Xa.scanRange(t+3,n-5,function(){var e=!0,t=!0;for(m();1!==Ja;){switch(Ja){case 55:e&&o(),t=!1;break;case 4:e=!0,t=!1;break;case 37:t&&(e=!1),t=!0;break;case 69:e=!1;break;case 1:}m()}k=r()}),k}t.isJSDocType=n,t.parseJSDocTypeExpressionForTests=r,t.parseJSDocTypeExpression=i,t.parseIsolatedJSDocComment=A,t.parseJSDocComment=O,t.parseJSDocCommentWorker=R}(ei=t.JSDocParser||(t.JSDocParser={}))}(d||(d={}));var p;!function(t){function n(t,n,r,a){if(a=a||e.Debug.shouldAssert(2),l(t,n,r,a),e.textChangeRangeIsUnchanged(r))return t;if(0===t.statements.length)return d.parseSourceFile(t.fileName,n,t.languageVersion,void 0,!0,t.scriptKind);var i=t;e.Debug.assert(!i.hasBeenIncrementallyParsed),i.hasBeenIncrementallyParsed=!0;var o=t.text,s=p(t),u=_(t,r);l(t,n,u,a),e.Debug.assert(u.span.start<=r.span.start),e.Debug.assert(e.textSpanEnd(u.span)===e.textSpanEnd(r.span)),e.Debug.assert(e.textSpanEnd(e.textChangeRangeNewSpan(u))===e.textSpanEnd(e.textChangeRangeNewSpan(r)));var f=e.textChangeRangeNewSpan(u).length-u.span.length;c(i,u.span.start,e.textSpanEnd(u.span),e.textSpanEnd(e.textChangeRangeNewSpan(u)),f,o,n,a);var m=d.parseSourceFile(t.fileName,n,t.languageVersion,s,!0,t.scriptKind);return m}function r(t,n,r,o,c,_){function u(t){var n="";_&&a(t)&&(n=o.substring(t.pos,t.end)),t._children&&(t._children=void 0),t.jsDocComment&&(t.jsDocComment=void 0),t.pos+=r,t.end+=r,_&&a(t)&&e.Debug.assert(n===c.substring(t.pos,t.end)),i(t,u,l),s(t,_)}function l(e){e._children=void 0,e.pos+=r,e.end+=r;for(var t=0,n=e;t<n.length;t++){var a=n[t];u(a)}}n?l(t):u(t)}function a(e){switch(e.kind){case 9:case 8:case 69:return!0}return!1}function o(t,n,r,a,i){e.Debug.assert(t.end>=n,"Adjusting an element that was entirely before the change range"),e.Debug.assert(t.pos<=r,"Adjusting an element that was entirely after the change range"),e.Debug.assert(t.pos<=t.end),t.pos=Math.min(t.pos,a),t.end>=r?t.end+=i:t.end=Math.min(t.end,a),e.Debug.assert(t.pos<=t.end),t.parent&&(e.Debug.assert(t.pos>=t.parent.pos),e.Debug.assert(t.end<=t.parent.end))}function s(t,n){if(n){var r=t.pos;i(t,function(t){e.Debug.assert(t.pos>=r),r=t.end}),e.Debug.assert(r<=t.end)}}function c(t,n,a,c,_,u,l,d){function p(t){if(e.Debug.assert(t.pos<=t.end),t.pos>a)return void r(t,!1,_,u,l,d);var m=t.end;return m>=n?(t.intersectsChange=!0,t._children=void 0,o(t,n,a,c,_),i(t,p,f),void s(t,d)):void e.Debug.assert(n>m)}function f(t){if(e.Debug.assert(t.pos<=t.end),t.pos>a)return void r(t,!0,_,u,l,d);var i=t.end;if(i>=n){t.intersectsChange=!0,t._children=void 0,o(t,n,a,c,_);for(var s=0,f=t;s<f.length;s++){var m=f[s];p(m)}}else e.Debug.assert(n>i)}p(t)}function _(t,n){for(var r=1,a=n.span.start,i=0;a>0&&r>=i;i++){var o=u(t,a);e.Debug.assert(o.pos<=a);var s=o.pos;a=Math.max(0,s-1)}var c=e.createTextSpanFromBounds(a,e.textSpanEnd(n.span)),_=n.newLength+(n.span.start-a);return e.createTextChangeRange(c,_)}function u(t,n){function r(e){for(;;){var t=a(e);if(!t)return e;e=t}}function a(t){var n=void 0;return i(t,function(t){e.nodeIsPresent(t)&&(n=t)}),n}function o(t){return e.nodeIsMissing(t)?void 0:t.pos<=n?(t.pos>=c.pos&&(c=t),n<t.end?(i(t,o),!0):(e.Debug.assert(t.end<=n),void(s=t))):(e.Debug.assert(t.pos>n),!0)}var s,c=t;if(i(t,o),s){var _=r(s);_.pos>c.pos&&(c=_)}return c}function l(t,n,r,a){var i=t.text;if(r&&(e.Debug.assert(i.length-r.span.length+r.newLength===n.length),a||e.Debug.shouldAssert(3))){var o=i.substr(0,r.span.start),s=n.substr(0,r.span.start);e.Debug.assert(o===s);var c=i.substring(e.textSpanEnd(r.span),i.length),_=n.substring(e.textSpanEnd(e.textChangeRangeNewSpan(r)),n.length);e.Debug.assert(c===_)}}function p(t){function n(e){function n(t){return e>=t.pos&&e<t.end?(i(t,n,s),!0):!1}function s(t){if(e>=t.pos&&e<t.end)for(var c=0,_=t.length;_>c;c++){var u=t[c];if(u){if(u.pos===e)return r=t,a=c,o=u,!0;if(u.pos<e&&e<u.end)return i(u,n,s),!0}}return!1}r=void 0,a=-1,o=void 0,i(t,n,s)}var r=t.statements,a=0;e.Debug.assert(a<r.length);var o=r[a],s=-1;return{currentNode:function(t){return t!==s&&(o&&o.end===t&&a<r.length-1&&(a++,o=r[a]),o&&o.pos===t||n(t)),s=t,e.Debug.assert(!o||o.pos===t),o}}}t.updateSourceFile=n;var f;!function(e){e[e.Value=-1]="Value"}(f||(f={}))}(p||(p={}))}(ts||(ts={}));var ts;!function(e){function t(e,t){return 2&(e|t)?2:e&t&8?8:4}function n(t){if(218===t.kind||219===t.kind)return 0;if(e.isConstEnumDeclaration(t))return 2;if(225!==t.kind&&224!==t.kind||2&t.flags){if(222===t.kind){var r=0;return e.forEachChild(t,function(e){switch(n(e)){case 0:return!1;case 2:return r=2,!1;case 1:return r=1,!0}}),r}return 221===t.kind?n(t.body):1}return 0}function r(t,n){var r=(new Date).getTime();s(t,n),e.bindTime+=(new Date).getTime()-r}function a(){function r(t,n){Pe=t,Ne=n,He=!!Pe.externalModuleIndicator,Xe={},Ge=e.objectAllocator.getSymbolConstructor(),Pe.locals||($(Pe),Pe.symbolCount=Qe,Pe.classifiableNames=Xe),Pe=void 0,Ne=void 0,Oe=void 0,Re=void 0,Ie=void 0,Fe=void 0,Le=!1,Me=!1,ze=void 0,Ke=void 0,je=void 0,Je=!1,Ue=!1,qe=!1,We=!1,Ve=!1}function a(e,t){return Qe++,new Ge(e,t)}function i(e,t,n){if(e.flags|=n,t.symbol=e,e.declarations||(e.declarations=[]),e.declarations.push(t),1952&n&&!e.exports&&(e.exports={}),6240&n&&!e.members&&(e.members={}),107455&n){var r=e.valueDeclaration;(!r||r.kind!==t.kind&&221===r.kind)&&(e.valueDeclaration=t)}}function o(t){if(t.name){if(e.isAmbientModule(t))return e.isGlobalScopeAugmentation(t)?"__global":'"'+t.name.text+'"';if(137===t.name.kind){var n=t.name.expression;return e.isStringOrNumericLiteral(n.kind)?n.text:(e.Debug.assert(e.isWellKnownSymbolSyntactically(n)),e.getPropertyNameForKnownSymbolName(n.name.text))}return t.name.text}switch(t.kind){case 145:return"__constructor";case 153:case 148:return"__call";case 154:case 149:return"__new";case 150:return"__index";case 231:return"__export";case 230:return t.isExportEquals?"export=":"default";case 184:switch(e.getSpecialPropertyAssignmentKind(t)){case 2:return"export=";case 1:case 4:return t.left.name.text;case 3:return t.left.expression.name.text}e.Debug.fail("Unknown binary declaration kind");break;case 216:case 217:return 512&t.flags?"default":void 0;case 264:return e.isJSDocConstructSignature(t)?"__new":"__call";case 139:e.Debug.assert(264===t.parent.kind);var r=t.parent,a=e.indexOf(r.parameters,t);return"p"+a}}function s(t){return t.name?e.declarationNameToString(t.name):o(t)}function c(t,n,r,c,_){e.Debug.assert(!e.hasDynamicName(r));var u,l=512&r.flags,d=l&&n?"default":o(r);if(void 0!==d){if(u=e.hasProperty(t,d)?t[d]:t[d]=a(0,d),d&&788448&c&&(Xe[d]=d),u.flags&_){r.name&&(r.name.parent=r);var p=2&u.flags?e.Diagnostics.Cannot_redeclare_block_scoped_variable_0:e.Diagnostics.Duplicate_identifier_0;e.forEach(u.declarations,function(t){512&t.flags&&(p=e.Diagnostics.A_module_cannot_have_multiple_default_exports)}),e.forEach(u.declarations,function(t){Pe.bindDiagnostics.push(e.createDiagnosticForNode(t.name||t,p,s(t)))}),Pe.bindDiagnostics.push(e.createDiagnosticForNode(r.name||r,p,s(r))),u=a(0,d)}}else u=a(0,"__missing");return i(u,r,c),u.parent=n,u}function _(t,n,r){var a=2&e.getCombinedNodeFlags(t);if(8388608&n)return 233===t.kind||224===t.kind&&a?c(Re.symbol.exports,Re.symbol,t,n,r):c(Re.locals,void 0,t,n,r);if(!e.isAmbientModule(t)&&(a||131072&Re.flags)){var i=(107455&n?1048576:0)|(793056&n?2097152:0)|(1536&n?4194304:0),o=c(Re.locals,void 0,t,i,r);return o.exportSymbol=c(Re.symbol.exports,Re.symbol,t,n,r),t.localSymbol=o,o}return c(Re.locals,void 0,t,n,r)}function u(t){var n=Oe,r=Re,a=Ie;Oe=t;var i=C(t);1&i?(Re=Ie=t,4&i&&(Re.locals={}),D(Re)):2&i&&(Ie=t,Ie.locals=void 0);var o,s,c,_,u,d=t.kind,p=t.flags;p&=-1572865,p&=-62914561,218===d&&(Le=!1);var f=251===d||222===d||e.isFunctionLikeKind(d);f&&(o=Be,s=ze,c=Ke,_=je,u=Me,Be=2,Me=!1,ze=Ke=je=void 0),e.isInJavaScriptFile(t)&&t.jsDocComment&&$(t.jsDocComment),l(t),2===Be&&e.isFunctionLikeKind(d)&&e.nodeIsPresent(t.body)&&(p|=524288,Me&&(p|=1048576)),218===d&&(p=Le?262144|p:-262145&p),251===d&&(Je&&(p|=4194304),qe&&(p|=8388608),We&&(p|=16777216),Ue&&(p|=33554432),Ve&&(p|=1073741824)),t.flags=p,f&&(Me=u,Be=o,ze=s,Ke=c,je=_),Re=r,Oe=n,Ie=a}function l(t){if(we(t))return void e.forEachChild(t,$);switch(t.kind){case 201:d(t);break;case 200:p(t);break;case 202:f(t);break;case 203:case 204:m(t);break;case 199:g(t);break;case 207:case 211:y(t);break;case 206:case 205:h(t);break;case 212:v(t);break;case 209:k(t);break;case 223:b(t);break;case 210:x(t);break;default:e.forEachChild(t,$)}}function d(e){var t=84===e.expression.kind?4:Be,n=99===e.expression.kind?4:Be;$(e.expression),Be=t;var r=Ce();$(e.statement),Se(r,n)}function p(e){var t=Be,n=Ce();$(e.statement);var r=99===e.expression.kind?4:t;Se(n,r),$(e.expression)}function f(e){var t=Be,n=Ce();$(e.initializer),$(e.condition),$(e.incrementor),$(e.statement);var r=!e.condition||99===e.condition.kind,a=r?4:t;Se(n,a)}function m(e){var t=Be,n=Ce();$(e.initializer),$(e.expression),$(e.statement),Se(n,t)}function g(e){var n=84===e.expression.kind?4:Be,r=99===e.expression.kind?4:Be;if(Be=n,$(e.expression),$(e.thenStatement),e.elseStatement){var a=Be;Be=r,$(e.elseStatement),Be=t(Be,a)}else Be=t(Be,r)}function y(e){$(e.expression),207===e.kind&&(Me=!0),Be=4}function h(e){$(e.label);var t=Ee(e.label,206===e.kind?Be:4);t&&(Be=4)}function v(e){var n=Be;$(e.tryBlock);var r=Be;Be=n,$(e.catchClause);var a=Be;Be=n,$(e.finallyBlock),Be=t(r,a)}function k(t){var n=Be,r=Ce();$(t.expression),$(t.caseBlock);var a=e.forEach(t.caseBlock.clauses,function(e){return 245===e.kind}),i=a&&2!==Be?4:n;Se(r,i)}function b(t){for(var n=Be,r=0,a=t.clauses;r<a.length;r++){var i=a[r];Be=n,$(i),i.statements.length&&2===Be&&Ne.noFallthroughCasesInSwitch&&Q(i,e.Diagnostics.Fallthrough_case_in_switch)}}function x(e){$(e.label);var t=xe(e.label);$(e.statement),t&&De(e.label,Be)}function C(t){switch(t.kind){case 189:case 217:case 218:case 220:case 168:case 156:case 260:return 1;case 148:case 149:case 150:case 144:case 143:case 216:case 145:case 146:case 147:case 153:case 264:case 154:case 176:case 177:case 221:case 251:case 219:return 5;case 247:case 202:case 203:case 204:case 223:return 2;case 195:return e.isFunctionLike(t.parent)?0:2}return 0}function D(e){Fe&&(Fe.nextContainer=e),Fe=e}function S(e,t,n){T(e,t,n)}function T(e,t,n){switch(Re.kind){case 221:return _(e,t,n);case 251:return w(e,t,n);case 189:case 217:return E(e,t,n);case 220:return c(Re.symbol.exports,Re.symbol,e,t,n);case 156:case 168:case 218:case 260:return c(Re.symbol.members,Re.symbol,e,t,n);case 153:case 154:case 148:case 149:case 150:case 144:case 143:case 145:case 146:case 147:case 216:case 176:case 177:case 264:case 219:return c(Re.locals,void 0,e,t,n)}}function E(e,t,n){return 64&e.flags?c(Re.symbol.exports,Re.symbol,e,t,n):c(Re.symbol.members,Re.symbol,e,t,n)}function w(t,n,r){return e.isExternalModule(Pe)?_(t,n,r):c(Pe.locals,void 0,t,n,r)}function A(e){var t=251===e.kind?e:e.body;if(251===t.kind||222===t.kind)for(var n=0,r=t.statements;n<r.length;n++){var a=r[n];if(231===a.kind||230===a.kind)return!0}return!1}function P(t){e.isInAmbientContext(t)&&!A(t)?t.flags|=131072:t.flags&=-131073}function N(t){if(P(t),e.isAmbientModule(t))2&t.flags&&Q(t,e.Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible),S(t,512,106639);else{var r=n(t);if(0===r)S(t,1024,0);else if(S(t,512,106639),304&t.symbol.flags)t.symbol.constEnumOnlyModule=!1;else{var a=2===r;void 0===t.symbol.constEnumOnlyModule?t.symbol.constEnumOnlyModule=a:t.symbol.constEnumOnlyModule=t.symbol.constEnumOnlyModule&&a}}}function O(e){var t=a(131072,o(e));i(t,e,131072);var n=a(2048,"__type");i(n,e,2048),n.members=(r={},r[t.name]=t,r);var r}function R(t){var n;if(function(e){e[e.Property=1]="Property",e[e.Accessor=2]="Accessor"}(n||(n={})),He)for(var r={},a=0,i=t.properties;a<i.length;a++){var o=i[a];if(69===o.name.kind){var s=o.name,c=248===o.kind||249===o.kind||144===o.kind?1:2,_=r[s.text];if(_){if(1===c&&1===_){var u=e.getErrorSpanForNode(Pe,s);Pe.bindDiagnostics.push(e.createFileDiagnostic(Pe,u.start,u.length,e.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode))}}else r[s.text]=c}}return I(t,4096,"__object")}function I(e,t,n){var r=a(t,n);i(r,e,t)}function F(t,n,r){switch(Ie.kind){case 221:_(t,n,r);break;case 251:if(e.isExternalModule(Re)){_(t,n,r);break}default:Ie.locals||(Ie.locals={},D(Ie)),c(Ie.locals,void 0,t,n,r)}}function L(e){F(e,2,107455)}function M(t){He&&t.originalKeywordKind>=106&&t.originalKeywordKind<=114&&!e.isIdentifierName(t)&&(Pe.parseDiagnostics.length||Pe.bindDiagnostics.push(e.createDiagnosticForNode(t,B(t),e.declarationNameToString(t))))}function B(t){return e.getContainingClass(t)?e.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode:Pe.externalModuleIndicator?e.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode:e.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode}function z(t){He&&e.isLeftHandSideExpression(t.left)&&e.isAssignmentOperator(t.operatorToken.kind)&&U(t,t.left)}function K(e){He&&e.variableDeclaration&&U(e,e.variableDeclaration.name)}function j(t){if(He&&69===t.expression.kind){var n=e.getErrorSpanForNode(Pe,t.expression);Pe.bindDiagnostics.push(e.createFileDiagnostic(Pe,n.start,n.length,e.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode))}}function J(e){return 69===e.kind&&("eval"===e.text||"arguments"===e.text)}function U(t,n){if(n&&69===n.kind){var r=n;if(J(r)){var a=e.getErrorSpanForNode(Pe,n);Pe.bindDiagnostics.push(e.createFileDiagnostic(Pe,a.start,a.length,q(t),r.text))}}}function q(t){return e.getContainingClass(t)?e.Diagnostics.Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode:Pe.externalModuleIndicator?e.Diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode:e.Diagnostics.Invalid_use_of_0_in_strict_mode}function W(e){He&&U(e,e.name)}function V(t){He&&32768&t.flags&&Pe.bindDiagnostics.push(e.createDiagnosticForNode(t,e.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode))}function H(e){He&&U(e,e.operand)}function G(e){He&&(41!==e.operator&&42!==e.operator||U(e,e.operand))}function X(t){He&&Q(t,e.Diagnostics.with_statements_are_not_allowed_in_strict_mode)}function Q(t,n,r,a,i){var o=e.getSpanOfTokenAtPosition(Pe,t.pos);Pe.bindDiagnostics.push(e.createFileDiagnostic(Pe,o.start,o.length,n,r,a,i))}function Y(t){return"__"+e.indexOf(t.parent.parameters,t)}function $(e){if(e){e.parent=Oe;var t=He;t||Z(e),ne(e),u(e),He=t}}function Z(t){switch(t.kind){case 251:case 222:return void ee(t.statements);case 195:return void(e.isFunctionLike(t.parent)&&ee(t.statements));case 217:case 189:return void(He=!0)}}function ee(t){for(var n=0,r=t;n<r.length;n++){var a=r[n];if(!e.isPrologueDirective(a))return;if(te(a))return void(He=!0)}}function te(t){var n=e.getTextOfNodeFromSourceText(Pe.text,t.expression);return'"use strict"'===n||"'use strict'"===n}function ne(t){switch(t.kind){case 69:return M(t);case 184:if(e.isInJavaScriptFile(t)){var n=e.getSpecialPropertyAssignmentKind(t);switch(n){case 1:ue(t);break;case 2:le(t);break;case 3:pe(t);break;case 4:de(t);break;case 0:break;default:e.Debug.fail("Unknown special property assignment kind")}}return z(t);case 247:return K(t);case 178:return j(t);case 8:return V(t);case 183:return H(t);case 182:return G(t);case 208:return X(t);case 162:return void(Le=!0);case 151:return re(t);case 138:return S(t,262144,530912);case 139:return he(t);case 214:case 166:return ye(t);case 142:case 141:case 261:return be(t,4|(t.questionToken?536870912:0),107455);case 248:case 249:return be(t,4,107455);case 250:return be(t,8,107455);case 242:return void(Ve=!0);case 148:case 149:case 150:return S(t,131072,0);case 144:case 143:return be(t,8192|(t.questionToken?536870912:0),e.isObjectLiteralMethod(t)?107455:99263);case 216:return ve(t);case 145:return S(t,16384,0);case 146:return be(t,32768,41919);case 147:return be(t,65536,74687);case 153:case 154:case 264:return O(t);case 156:case 260:return I(t,2048,"__type");case 168:return R(t);case 176:case 177:return ke(t);case 171:e.isInJavaScriptFile(t)&&fe(t);break;case 189:case 217:return me(t);case 218:return F(t,64,792960);case 219:return F(t,524288,793056);case 220:return ge(t);case 221:return N(t);case 224:case 227:case 229:case 233:return S(t,8388608,8388608);case 226:return ce(t);case 231:return se(t);case 230:return oe(t);case 251:return ae()}}function re(e){var t=e.parameterName,n=e.type;t&&69===t.kind&&M(t),t&&162===t.kind&&(Le=!0),$(n)}function ae(){P(Pe),e.isExternalModule(Pe)&&ie()}function ie(){I(Pe,512,'"'+e.removeFileExtension(Pe.fileName)+'"')}function oe(e){var t=230===e.kind?e.expression:e.right;Re.symbol&&Re.symbol.exports?69===t.kind&&230===e.kind?c(Re.symbol.exports,Re.symbol,e,8388608,8496063):c(Re.symbol.exports,Re.symbol,e,4,8496063):I(e,8388608,o(e))}function se(e){Re.symbol&&Re.symbol.exports?e.exportClause||c(Re.symbol.exports,Re.symbol,e,1073741824,0):I(e,1073741824,o(e))}function ce(e){e.name&&S(e,8388608,8388608)}function _e(e){Pe.commonJsModuleIndicator||(Pe.commonJsModuleIndicator=e,ie())}function ue(e){_e(e),c(Pe.symbol.exports,Pe.symbol,e.left,7340036,0)}function le(e){_e(e),c(Pe.symbol.exports,Pe.symbol,e,7340548,0)}function de(e){176!==Re.kind&&216!==Re.kind||(Re.symbol.members=Re.symbol.members||{},c(Re.symbol.members,Re.symbol,e,4,107451))}function pe(e){var t=e.left,n=t.expression,r=n.expression;t.parent=e,r.parent=n,n.parent=t;var a=Re.locals[r.text];a&&16&a.flags&&(a.members||(a.members={}),c(a.members,a,t,4,107451))}function fe(t){!Pe.commonJsModuleIndicator&&e.isRequireCall(t,!1)&&_e(t)}function me(t){if(e.isDeclarationFile(Pe)||e.isInAmbientContext(t)||(void 0!==e.getClassExtendsHeritageClauseElement(t)&&(Je=!0),e.nodeIsDecorated(t)&&(qe=!0)),217===t.kind)F(t,32,899519);else{var n=t.name?t.name.text:"__class";I(t,32,n),t.name&&(Xe[t.name.text]=t.name.text)}var r=t.symbol,i=a(134217732,"prototype");e.hasProperty(r.exports,i.name)&&(t.name&&(t.name.parent=t),Pe.bindDiagnostics.push(e.createDiagnosticForNode(r.exports[i.name].declarations[0],e.Diagnostics.Duplicate_identifier_0,i.name))),r.exports[i.name]=i,i.parent=r}function ge(t){return e.isConst(t)?F(t,128,899967):F(t,256,899327)}function ye(t){He&&U(t,t.name),e.isBindingPattern(t.name)||(e.isBlockOrCatchScoped(t)?L(t):e.isParameterDeclaration(t)?S(t,1,107455):S(t,1,107454))}function he(t){if(e.isDeclarationFile(Pe)||e.isInAmbientContext(t)||!e.nodeIsDecorated(t)||(qe=!0,We=!0),He&&U(t,t.name),e.isBindingPattern(t.name)?I(t,1,Y(t)):S(t,1,107455),e.isParameterPropertyDeclaration(t)){var n=t.parent.parent;c(n.symbol.members,n.symbol,t,4,107455)}}function ve(t){return e.isDeclarationFile(Pe)||e.isInAmbientContext(t)||e.isAsyncFunctionLike(t)&&(Ue=!0),W(t),S(t,16,106927)}function ke(t){e.isDeclarationFile(Pe)||e.isInAmbientContext(t)||e.isAsyncFunctionLike(t)&&(Ue=!0),W(t);var n=t.name?t.name.text:"__function";return I(t,16,n)}function be(t,n,r){return e.isDeclarationFile(Pe)||e.isInAmbientContext(t)||(e.isAsyncFunctionLike(t)&&(Ue=!0),e.nodeIsDecorated(t)&&(qe=!0)),e.hasDynamicName(t)?I(t,n,"__computed"):S(t,n,r)}function xe(t){return Ae(),e.hasProperty(Ke,t.text)?!1:(Ke[t.text]=ze.push(1)-1,!0)}function Ce(){Ae();var e=ze.push(1)-1;return je.push(e),e}function De(t,n){var r=Ke[t.text];e.Debug.assert(void 0!==r),e.Debug.assert(ze.length==r+1),Ke[t.text]=void 0,Te(ze.pop(),n,t)}function Se(t,n){ze.length!==t+1&&e.Debug.assert(!1,"Label stack: "+ze.length+", index:"+t);var r=je.pop();t!==r&&e.Debug.assert(!1,"i: "+r+", index: "+t),Te(ze.pop(),n,void 0)}function Te(n,r,a){1===n?(a&&!Ne.allowUnusedLabels&&Pe.bindDiagnostics.push(e.createDiagnosticForNode(a,e.Diagnostics.Unused_label)),Be=r):Be=t(n,r)}function Ee(n,r){Ae();var a=n?Ke[n.text]:e.lastOrUndefined(je);if(void 0===a)return!1;var i=ze[a];return ze[a]=1===i?r:t(i,r),!0}function we(t){function r(e){var t=n(e);return 1===t||2===t&&Ne.preserveConstEnums}switch(Be){case 4:var a=e.isStatement(t)&&197!==t.kind||217===t.kind||221===t.kind&&r(t)||220===t.kind&&(!e.isConstEnumDeclaration(t)||Ne.preserveConstEnums);if(a){Be=8;var i=!Ne.allowUnreachableCode&&!e.isInAmbientContext(t)&&(196!==t.kind||24576&e.getCombinedNodeFlags(t.declarationList)||e.forEach(t.declarationList.declarations,function(e){return e.initializer}));i&&Q(t,e.Diagnostics.Unreachable_code_detected)}case 8:return!0;default:return!1}}function Ae(){Ke||(Be=2,Ke={},ze=[],je=[])}var Pe,Ne,Oe,Re,Ie,Fe,Le,Me,Be,ze,Ke,je,Je,Ue,qe,We,Ve,He,Ge,Xe,Qe=0;return r}e.bindTime=0,function(e){e[e.NonInstantiated=0]="NonInstantiated",e[e.Instantiated=1]="Instantiated",e[e.ConstEnumOnly=2]="ConstEnumOnly"}(e.ModuleInstanceState||(e.ModuleInstanceState={}));var i;e.ModuleInstanceState;!function(e){e[e.Unintialized=1]="Unintialized",e[e.Reachable=2]="Reachable",e[e.Unreachable=4]="Unreachable",e[e.ReportedUnreachable=8]="ReportedUnreachable"}(i||(i={})),e.getModuleInstanceState=n;var o;!function(e){e[e.None=0]="None",e[e.IsContainer=1]="IsContainer",e[e.IsBlockScopedContainer=2]="IsBlockScopedContainer",e[e.HasLocals=4]="HasLocals",e[e.IsContainerWithLocals=5]="IsContainerWithLocals"}(o||(o={}));var s=a();e.bindSourceFile=r}(ts||(ts={}));var ts;!function(e){function t(e){return e.id||(e.id=i,i++),e.id}function n(e){return e.id||(e.id=a,a++),e.id}function r(r,a){function i(e,t){return X_(e,t),Ql}function s(t,n,r,a,i){var o=t?e.createDiagnosticForNode(t,n,r,a,i):e.createCompilerDiagnostic(n,r,a,i);cp.add(o)}function c(e,t){return Ul++,new zl(e,t)}function _(e){var t=0;return 2&e&&(t|=107455),1&e&&(t|=107454),4&e&&(t|=107455),8&e&&(t|=107455),16&e&&(t|=106927),32&e&&(t|=899519),64&e&&(t|=792960),256&e&&(t|=899327),128&e&&(t|=899967),512&e&&(t|=106639),8192&e&&(t|=99263),32768&e&&(t|=41919),65536&e&&(t|=74687),262144&e&&(t|=530912),524288&e&&(t|=793056),8388608&e&&(t|=8388608),t}function u(e,t){t.mergeId||(t.mergeId=o,o++),rp[t.mergeId]=e}function l(e){var t=c(33554432|e.flags,e.name);return t.declarations=e.declarations.slice(0),t.parent=e.parent,e.valueDeclaration&&(t.valueDeclaration=e.valueDeclaration),e.constEnumOnlyModule&&(t.constEnumOnlyModule=!0),e.members&&(t.members=p(e.members)),e.exports&&(t.exports=p(e.exports)),u(t,e),t}function d(t,n){if(t.flags&_(n.flags)){var r=2&t.flags||2&n.flags?e.Diagnostics.Cannot_redeclare_block_scoped_variable_0:e.Diagnostics.Duplicate_identifier_0;e.forEach(n.declarations,function(e){s(e.name?e.name:e,r,Ee(n))}),e.forEach(t.declarations,function(e){s(e.name?e.name:e,r,Ee(n))})}else 512&n.flags&&512&t.flags&&t.constEnumOnlyModule&&!n.constEnumOnlyModule&&(t.constEnumOnlyModule=!1),t.flags|=n.flags,n.valueDeclaration&&(!t.valueDeclaration||221===t.valueDeclaration.kind&&221!==n.valueDeclaration.kind)&&(t.valueDeclaration=n.valueDeclaration),e.forEach(n.declarations,function(e){t.declarations.push(e)}),n.members&&(t.members||(t.members={}),f(t.members,n.members)),n.exports&&(t.exports||(t.exports={}),f(t.exports,n.exports)),u(t,n)}function p(t){var n={};for(var r in t)e.hasProperty(t,r)&&(n[r]=t[r]);return n}function f(t,n){for(var r in n)if(e.hasProperty(n,r))if(e.hasProperty(t,r)){var a=t[r];33554432&a.flags||(t[r]=a=l(a)),d(a,n[r])}else t[r]=n[r]}function m(t){var n=t.parent;if(n.symbol.valueDeclaration!==n)return void e.Debug.assert(n.symbol.declarations.length>1);if(e.isGlobalScopeAugmentation(n))f(Xd,n.symbol.exports);else{var r=G(t,t,e.Diagnostics.Invalid_module_name_in_augmentation_module_0_cannot_be_found);if(!r)return;r=X(r),1536&r.flags?(r=33554432&r.flags?r:l(r),d(r,n.symbol)):s(t,e.Diagnostics.Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity,t.text)}}function g(t,n,r){function a(t,n){return function(r){return cp.add(e.createDiagnosticForNode(r,n,t))}}for(var i in n)e.hasProperty(n,i)&&(e.hasProperty(t,i)?e.forEach(t[i].declarations,a(i,r)):t[i]=n[i])}function y(e){if(67108864&e.flags)return e;var t=n(e);return ap[t]||(ap[t]={})}function h(e){var n=t(e);return ip[n]||(ip[n]={})}function v(t){return 251===t.kind&&!e.isExternalOrCommonJsModule(t)}function k(t,n,r){if(r&&e.hasProperty(t,n)){var a=t[n];if(e.Debug.assert(0===(16777216&a.flags),"Should never get an instantiated symbol here."),a.flags&r)return a;if(8388608&a.flags){var i=j(a);if(i===ed||i.flags&r)return a}}}function b(t,n){var r=t.parent,a=t.parent.parent,i=k(r.locals,n,107455),o=k(a.symbol.members,n,107455);return i&&o?[i,o]:void e.Debug.fail("There should exist two symbols, one as property declaration and one as parameter declaration")}function x(t,n){function a(t,n){var r=e.getEnclosingBlockScopeContainer(t);if(196===t.parent.parent.kind||202===t.parent.parent.kind)return T(n,t,r);if(204===t.parent.parent.kind||203===t.parent.parent.kind){var a=t.parent.parent.expression;return T(n,a,r)}}function i(t,n){for(var r=e.getEnclosingBlockScopeContainer(t),a=n;a;){if(a===r)return!1;if(e.isFunctionLike(a))return!0;var i=a.parent&&142===a.parent.kind&&0===(64&a.parent.flags)&&a.parent.initializer===a;if(i)return!0;a=a.parent}return!1}var o=e.getSourceFileOfNode(t),s=e.getSourceFileOfNode(n);if(o!==s){if(Gl||!Vl.outFile&&!Vl.out)return!0;var c=r.getSourceFiles();return e.indexOf(c,o)<=e.indexOf(c,s)}return t.pos<=n.pos?214!==t.kind||!a(t,n):i(t,n)}function C(t,n,r,a,i){var o,c,_,u,l=t;e:for(;t;){if(t.locals&&!v(t)&&(o=k(t.locals,n,r))){var d=!0;
if(e.isFunctionLike(t)&&c&&c!==t.body&&(r&o.flags&793056&&268!==c.kind&&(d=262144&o.flags?c===t.type||139===c.kind||138===c.kind:!1),107455&r&&1&o.flags&&(d=139===c.kind||c===t.type&&139===o.valueDeclaration.kind)),d)break e;o=void 0}switch(t.kind){case 251:if(!e.isExternalOrCommonJsModule(t))break;case 221:var p=ae(t).exports;if(251===t.kind||e.isAmbientModule(t)){if(o=p["default"]){var f=e.getLocalSymbolForExportDefault(o);if(f&&o.flags&r&&f.name===n)break e;o=void 0}if(e.hasProperty(p,n)&&8388608===p[n].flags&&e.getDeclarationOfKind(p[n],233))break}if(o=k(p,n,8914931&r))break e;break;case 220:if(o=k(ae(t).exports,n,8&r))break e;break;case 142:case 141:if(e.isClassLike(t.parent)&&!(64&t.flags)){var m=ce(t.parent);m&&m.locals&&k(m.locals,n,107455&r)&&(_=t)}break;case 217:case 189:case 218:if(o=k(ae(t).members,n,793056&r)){if(c&&64&c.flags)return void s(l,e.Diagnostics.Static_members_cannot_reference_class_type_parameters);break e}if(189===t.kind&&32&r){var g=t.name;if(g&&n===g.text){o=t.symbol;break e}}break;case 137:if(u=t.parent.parent,(e.isClassLike(u)||218===u.kind)&&(o=k(ae(u).members,n,793056&r)))return void s(l,e.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);break;case 144:case 143:case 145:case 146:case 147:case 216:case 177:if(3&r&&"arguments"===n){o=$l;break e}break;case 176:if(3&r&&"arguments"===n){o=$l;break e}if(16&r){var y=t.name;if(y&&n===y.text){o=t.symbol;break e}}break;case 140:t.parent&&139===t.parent.kind&&(t=t.parent),t.parent&&e.isClassElement(t.parent)&&(t=t.parent)}c=t,t=t.parent}if(o||(o=k(Xd,n,r)),!o)return void(a&&(D(l,n,i)||s(l,a,"string"==typeof i?i:e.declarationNameToString(i))));if(a){if(_){var h=_.name;return void s(l,e.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor,e.declarationNameToString(h),"string"==typeof i?i:e.declarationNameToString(i))}if(2&r){var b=oe(o);2&b.flags&&S(b,l)}}return o}function D(t,n,r){if(!t||69===t.kind&&ru(t)||ja(t))return!1;for(var a=e.getThisContainer(t,!0),i=a;i;){if(e.isClassLike(i.parent)){var o=ae(i.parent);if(!o)break;var c=_t(o);if(mn(c,n))return s(t,e.Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0,"string"==typeof r?r:e.declarationNameToString(r),Ee(o)),!0;if(i===a&&!(64&i.flags)){var _=Ot(o).thisType;if(mn(_,n))return s(t,e.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0,"string"==typeof r?r:e.declarationNameToString(r)),!0}}i=i.parent}return!1}function S(t,n){e.Debug.assert(0!==(2&t.flags));var r=e.forEach(t.declarations,function(t){return e.isBlockOrCatchScoped(t)?t:void 0});e.Debug.assert(void 0!==r,"Block-scoped variable declaration is undefined"),x(e.getAncestor(r,214),n)||s(n,e.Diagnostics.Block_scoped_variable_0_used_before_its_declaration,e.declarationNameToString(r.name))}function T(t,n,r){if(!n)return!1;for(var a=t;a&&a!==r&&!e.isFunctionLike(a);a=a.parent)if(a===n)return!0;return!1}function E(t){if(e.isAliasSymbolDeclaration(t)){if(224===t.kind)return t;for(;t&&225!==t.kind;)t=t.parent;return t}}function w(t){return e.forEach(t.declarations,function(t){return e.isAliasSymbolDeclaration(t)?t:void 0})}function A(t){return 235===t.moduleReference.kind?X(H(t,e.getExternalModuleImportEqualsDeclarationExpression(t))):q(t.moduleReference,t)}function P(t){var n=H(t,t.parent.moduleSpecifier);if(n){var r=n.exports["export="]?mn(_t(n.exports["export="]),"default"):K(n.exports["default"]);if(r||Xl){if(!r&&Xl)return X(n)||K(n)}else s(t.name,e.Diagnostics.Module_0_has_no_default_export,Ee(n));return r}}function N(e){var t=e.parent.parent.moduleSpecifier;return Q(H(e,t),t)}function O(t,n){if(794592&t.flags)return t;var r=c(t.flags|n.flags,t.name);return r.declarations=e.concatenate(t.declarations,n.declarations),r.parent=t.parent||n.parent,t.valueDeclaration&&(r.valueDeclaration=t.valueDeclaration),n.members&&(r.members=n.members),t.exports&&(r.exports=t.exports),r}function R(t,n){if(1536&t.flags){var r=Z(t);if(e.hasProperty(r,n))return K(r[n])}}function I(e,t){if(3&e.flags){var n=e.valueDeclaration.type;if(n)return K(mn(Pr(n),t))}}function F(t,n){var r=H(t,t.moduleSpecifier),a=Q(r,t.moduleSpecifier);if(a){var i=n.propertyName||n.name;if(i.text){var o=void 0;o=r&&r.exports&&r.exports["export="]?mn(_t(a),i.text):I(a,i.text);var c=R(a,i.text),_=c&&o?O(o,c):c||o;return _||s(i,e.Diagnostics.Module_0_has_no_exported_member_1,W(r),e.declarationNameToString(i)),_}}}function L(e){return F(e.parent.parent.parent,e)}function M(e){return e.parent.parent.moduleSpecifier?F(e.parent.parent,e):V(e.propertyName||e.name,901119)}function B(e){return V(e.expression,901119)}function z(e){switch(e.kind){case 224:return A(e);case 226:return P(e);case 227:return N(e);case 229:return L(e);case 233:return M(e);case 230:return B(e)}}function K(e){return e&&8388608&e.flags&&!(901119&e.flags)?j(e):e}function j(t){e.Debug.assert(0!==(8388608&t.flags),"Should only get Alias here.");var n=y(t);if(n.target)n.target===td&&(n.target=ed);else{n.target=td;var r=w(t),a=z(r);n.target===td?n.target=a||ed:s(r,e.Diagnostics.Circular_definition_of_import_alias_0,Ee(t))}return n.target}function J(e){var t=ae(e),n=j(t);if(n){var r=n===ed&&Vl.isolatedModules||n!==ed&&107455&n.flags&&!Tu(n);r&&U(t)}}function U(t){var n=y(t);if(!n.referenced){n.referenced=!0;var r=w(t);230===r.kind?Os(r.expression):233===r.kind?Os(r.propertyName||r.name):e.isInternalModuleImportEqualsDeclaration(r)&&Os(r.moduleReference)}}function q(t,n){return n||(n=e.getAncestor(t,224),e.Debug.assert(void 0!==n)),69===t.kind&&e.isRightSideOfQualifiedNameOrPropertyAccess(t)&&(t=t.parent),69===t.kind||136===t.parent.kind?V(t,1536):(e.Debug.assert(224===t.parent.kind),V(t,901119))}function W(e){return e.parent?W(e.parent)+"."+Ee(e):Ee(e)}function V(t,n,r){if(!e.nodeIsMissing(t)){var a;if(69===t.kind){var i=1536===n?e.Diagnostics.Cannot_find_namespace_0:e.Diagnostics.Cannot_find_name_0;if(a=C(t,t.text,n,r?void 0:i,t),!a)return}else if(136===t.kind||169===t.kind){var o=136===t.kind?t.left:t.expression,c=136===t.kind?t.right:t.name,_=V(o,1536,r);if(!_||_===ed||e.nodeIsMissing(c))return;if(a=k(Z(_),c.text,n),!a)return void(r||s(c,e.Diagnostics.Module_0_has_no_exported_member_1,W(_),e.declarationNameToString(c)))}else e.Debug.fail("Unknown entity name kind.");return e.Debug.assert(0===(16777216&a.flags),"Should never get an instantiated symbol here."),a.flags&n?a:j(a)}}function H(t,n){return G(t,n,e.Diagnostics.Cannot_find_module_0)}function G(t,n,a){if(9===n.kind){var i=n,o=e.escapeIdentifier(i.text);if(void 0!==o){var c=e.isExternalModuleNameRelative(o);if(!c){var _=k(Xd,'"'+o+'"',512);if(_)return re(_)}var u=e.getResolvedModule(e.getSourceFileOfNode(t),i.text),l=u&&r.getSourceFile(u.resolvedFileName);return l?l.symbol?re(l.symbol):void(a&&s(i,e.Diagnostics.File_0_is_not_a_module,l.fileName)):void(a&&s(i,a,o))}}}function X(e){return e&&re(K(e.exports["export="]))||e}function Q(t,n){var r=X(t);return!r||1539&r.flags||(s(n,e.Diagnostics.Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct,Ee(t)),r=void 0),r}function Y(e){return void 0!==e.exports["export="]}function $(e){return xn(ee(e))}function Z(e){return 1536&e.flags?ee(e):e.exports||Wl}function ee(e){var t=y(e);return t.resolvedExports||(t.resolvedExports=ne(e))}function te(t,n,r,a){for(var i in n)"default"===i||e.hasProperty(t,i)?r&&a&&"default"!==i&&e.hasProperty(t,i)&&K(t[i])!==K(n[i])&&(r[i].exportsWithDuplicate?r[i].exportsWithDuplicate.push(a):r[i].exportsWithDuplicate=[a]):(t[i]=n[i],r&&a&&(r[i]={specifierText:e.getTextOfNode(a.moduleSpecifier)}))}function ne(t){function n(t){if(t&&1952&t.flags&&!e.contains(r,t)){r.push(t);var a=p(t.exports),i=t.exports.__export;if(i){for(var o={},s={},c=0,_=i.declarations;c<_.length;c++){var u=_[c],l=H(u,u.moduleSpecifier),d=n(l);te(o,d,s,u)}for(var f in s){var m=s[f].exportsWithDuplicate;if("export="!==f&&m&&m.length&&!e.hasProperty(a,f))for(var g=0,y=m;g<y.length;g++){var u=y[g];cp.add(e.createDiagnosticForNode(u,e.Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity,s[f].specifierText,f))}}te(a,o)}return a}}var r=[];return n(t)||t.exports}function re(e){var t;return e&&e.mergeId&&(t=rp[e.mergeId])?t:e}function ae(e){return re(e.symbol)}function ie(e){return re(e.parent)}function oe(e){return e&&0!==(1048576&e.flags)?re(e.exportSymbol):e}function se(e){return 16777216&e.flags?se(y(e).target):107455&e.flags?!0:8388608&e.flags?0!==(107455&j(e).flags):!1}function ce(t){for(var n=t.members,r=0,a=n;r<a.length;r++){var i=a[r];if(145===i.kind&&e.nodeIsPresent(i.body))return i}}function _e(e){var t=new Kl(Zl,e);return t.id=Jl,Jl++,t}function ue(e,t){var n=_e(e);return n.intrinsicName=t,n}function le(e,t){var n=_e(e);return n.symbol=t,n}function de(e){return 95===e.charCodeAt(0)&&95===e.charCodeAt(1)&&95!==e.charCodeAt(2)&&64!==e.charCodeAt(2)}function pe(t){var n;for(var r in t)if(e.hasProperty(t,r)&&!de(r)){n||(n=[]);var a=t[r];se(a)&&n.push(a)}return n||ql}function fe(e,t,n,r,a,i){return e.members=t,e.properties=pe(t),e.callSignatures=n,e.constructSignatures=r,a&&(e.stringIndexType=a),i&&(e.numberIndexType=i),e}function me(e,t,n,r,a,i){return fe(le(65536,e),t,n,r,a,i)}function ge(t,n){for(var r,a=t;a;a=a.parent){if(a.locals&&!v(a)&&(r=n(a.locals)))return r;switch(a.kind){case 251:if(!e.isExternalOrCommonJsModule(a))break;case 221:if(r=n(ae(a).exports))return r;break;case 217:case 218:if(r=n(ae(a).members))return r}}return n(Xd)}function ye(e){return 107455===e?107455:1536}function he(t,n,r,a){function i(o){function s(e,t){if(!ve(e,n,t))return!0;var r=he(e.parent,n,ye(t),a);return!!r}function c(n,a){return t===(a||n)?!e.forEach(n.declarations,be)&&s(n,r):void 0}return c(e.lookUp(o,t.name))?[t]:e.forEachValue(o,function(t){if(8388608&t.flags&&"export="!==t.name&&!e.getDeclarationOfKind(t,233)&&(!a||e.forEach(t.declarations,e.isExternalModuleImportEqualsDeclaration))){var n=j(t);if(c(t,j(t)))return[t];var o=n.exports?i(n.exports):void 0;if(o&&s(t,ye(r)))return[t].concat(o)}})}return t?ge(n,i):void 0}function ve(t,n,r){var a=!1;return ge(n,function(n){if(!e.hasProperty(n,t.name))return!1;var i=n[t.name];return i===t?!0:(i=8388608&i.flags&&!e.getDeclarationOfKind(i,233)?j(i):i,i.flags&r?(a=!0,!0):!1)}),a}function ke(t,n,r){function a(e){for(;e;e=e.parent)if(be(e))return ae(e)}if(t&&n&&!(262144&t.flags)){for(var i=t,o=r;t;){var s=he(t,n,o,!1);if(s){var c=xe(s[0]);return c?c:{accessibility:1,errorSymbolName:Ee(i,n,r),errorModuleName:t!==i?Ee(t,n,1536):void 0}}o=ye(r),t=ie(t)}var _=e.forEach(i.declarations,a);if(_){var u=a(n);if(_!==u)return{accessibility:2,errorSymbolName:Ee(i,n,r),errorModuleName:Ee(_)}}return{accessibility:1,errorSymbolName:Ee(i,n,r)}}return{accessibility:0}}function be(t){return e.isAmbientModule(t)||251===t.kind&&e.isExternalOrCommonJsModule(t)}function xe(t){function n(t){if(!Ie(t)){var n=E(t);return!n||2&n.flags||!Ie(n.parent)?!1:(h(t).isVisible=!0,r?e.contains(r,n)||r.push(n):r=[n],!0)}return!0}var r;if(!e.forEach(t.declarations,function(e){return!n(e)}))return{accessibility:0,aliasesToMakeVisible:r}}function Ce(t,n){var r;r=155===t.parent.kind?1156031:136===t.kind||169===t.kind||224===t.parent.kind?1536:793056;var a=O_(t),i=C(n,a.text,r,void 0,void 0);return i&&xe(i)||{accessibility:1,errorSymbolName:e.getTextOfNode(a),errorNode:a}}function De(t,n){t.writeKeyword(e.tokenToString(n))}function Se(t,n){t.writePunctuation(e.tokenToString(n))}function Te(e){e.writeSpace(" ")}function Ee(t,n,r){var a=e.getSingleLineStringWriter();Re().buildSymbolDisplay(t,a,n,r);var i=a.string();return e.releaseStringWriter(a),i}function we(t,n,r,a){var i=e.getSingleLineStringWriter();Re().buildSignatureDisplay(t,i,n,r,a);var o=i.string();return e.releaseStringWriter(i),o}function Ae(t,n,r){var a=e.getSingleLineStringWriter();Re().buildTypeDisplay(t,a,n,r);var i=a.string();e.releaseStringWriter(a);var o=Vl.noErrorTruncation||4&r?void 0:100;return o&&i.length>=o&&(i=i.substr(0,o-"...".length)+"..."),i}function Pe(t,n,r){var a=e.getSingleLineStringWriter();Re().buildTypePredicateDisplay(t,a,n,r);var i=a.string();return e.releaseStringWriter(a),i}function Ne(e){if(e.symbol&&2048&e.symbol.flags){for(var t=e.symbol.declarations[0].parent;161===t.kind;)t=t.parent;if(219===t.kind)return ae(t)}}function Oe(t){return t&&t.parent&&222===t.parent.kind&&e.isExternalModuleAugmentation(t.parent.parent)}function Re(){function t(t){if(t.declarations&&t.declarations.length){var n=t.declarations[0];if(n.name)return e.declarationNameToString(n.name);switch(n.kind){case 189:return"(Anonymous class)";case 176:case 177:return"(Anonymous function)"}}return t.name}function n(e,n){n.writeSymbol(t(e),e)}function r(t,r,a,o,s,c){function u(e){d&&(1&s&&(16777216&e.flags?_(gt(d),e.mapper,r,a):i(d,r,a)),Se(r,21)),d=e,n(e,r)}function l(t,n){if(t){var r=he(t,a,n,!!(2&s));if(r&&!ve(r[0],a,1===r.length?n:ye(n))||l(ie(r?r[0]:t),ye(n)),r)for(var i=0,o=r;i<o.length;i++){var c=o[i];u(c)}else{if(!d&&e.forEach(t.declarations,be))return;if(2048&t.flags||4096&t.flags)return;u(t)}}}var d;r.trackSymbol(t,a,o);var p=262144&t.flags,f=128&c;return p||!a&&!f?u(t):void l(t,o)}function a(t,n,a,i,o){function s(t,o){16777343&t.flags?n.writeKeyword(16&i||!Ue(t)?t.intrinsicName:"any"):33554432&t.flags?(v&&n.reportInaccessibleThisError(),n.writeKeyword("this")):4096&t.flags?u(t,o):3712&t.flags?r(t.symbol,n,a,793056,0,o):8192&t.flags?l(t):49152&t.flags?d(t,o):65536&t.flags?f(t,o):256&t.flags?n.writeStringLiteral('"'+e.escapeString(t.text)+'"'):(Se(n,15),Te(n),Se(n,22),Te(n),Se(n,16))}function c(e,t){for(var r=0;r<e.length;r++)r>0&&(24!==t&&Te(n),Se(n,t),Te(n)),s(e[r],24===t?0:64)}function _(e,t,i,o,c){if((32&e.flags||!de(e.name))&&r(e,n,a,793056,0,c),o>i){for(Se(n,25),s(t[i],0),i++;o>i;)Se(n,24),Te(n),s(t[i],0),i++;Se(n,27)}}function u(t,r){var a=t.typeArguments||ql;if(t.target!==vd||1&r){var i=t.target.outerTypeParameters,o=0;if(i)for(var c=i.length;c>o;){var u=o,l=zn(i[o]);do o++;while(c>o&&zn(i[o])===l);e.rangeEquals(i,a,u,o)||(_(l,a,u,o,r),Se(n,21))}var d=(t.target.typeParameters||ql).length;_(t.symbol,a,o,d,r)}else s(a[0],64),Se(n,19),Se(n,20)}function l(e){Se(n,19),c(e.elementTypes,24),Se(n,20)}function d(e,t){64&t&&Se(n,17),c(e.types,16384&e.flags?47:46),64&t&&Se(n,18)}function f(t,i){function s(){var t=!!(8192&c.flags&&e.forEach(c.declarations,function(e){return 64&e.flags})),n=!!(16&c.flags)&&(c.parent||e.forEach(c.declarations,function(e){return 251===e.parent.kind||222===e.parent.kind}));return t||n?!!(2&i)||e.contains(o,c):void 0}var c=t.symbol;if(c)if(928&c.flags)m(t,i);else if(s())m(t,i);else if(e.contains(o,c)){var _=Ne(t);_?r(_,n,a,793056,0,i):De(n,117)}else o||(o=[]),o.push(c),y(t,i),o.pop();else y(t,i)}function m(e,t){De(n,101),Te(n),r(e.symbol,n,a,107455,0,t)}function g(t,n,r){var a=In(t.symbol,n);return a?(e.Debug.assert(0!==a.parameters.length),e.declarationNameToString(a.parameters[0].name)):r}function y(e,t){var i=on(e);if(!i.properties.length&&!i.stringIndexType&&!i.numberIndexType){if(!i.callSignatures.length&&!i.constructSignatures.length)return Se(n,15),void Se(n,16);if(1===i.callSignatures.length&&!i.constructSignatures.length)return 64&t&&Se(n,17),p(i.callSignatures[0],n,a,8|h,void 0,o),void(64&t&&Se(n,18));if(1===i.constructSignatures.length&&!i.callSignatures.length)return 64&t&&Se(n,17),De(n,92),Te(n),p(i.constructSignatures[0],n,a,8|h,void 0,o),void(64&t&&Se(n,18))}var c=v;v=!0,Se(n,15),n.writeLine(),n.increaseIndent();for(var _=0,u=i.callSignatures;_<u.length;_++){var l=u[_];p(l,n,a,h,void 0,o),Se(n,23),n.writeLine()}for(var d=0,f=i.constructSignatures;d<f.length;d++){var l=f[d];p(l,n,a,h,1,o),Se(n,23),n.writeLine()}i.stringIndexType&&(Se(n,19),n.writeParameter(g(i,0,"x")),Se(n,54),Te(n),De(n,130),Se(n,20),Se(n,54),Te(n),s(i.stringIndexType,0),Se(n,23),n.writeLine()),i.numberIndexType&&(Se(n,19),n.writeParameter(g(i,1,"x")),Se(n,54),Te(n),De(n,128),Se(n,20),Se(n,54),Te(n),s(i.numberIndexType,0),Se(n,23),n.writeLine());for(var m=0,y=i.properties;m<y.length;m++){var k=y[m],b=_t(k);if(8208&k.flags&&!sn(b).length)for(var x=yn(b,0),C=0,D=x;C<D.length;C++){var l=D[C];r(k,n),536870912&k.flags&&Se(n,53),p(l,n,a,h,void 0,o),Se(n,23),n.writeLine()}else r(k,n),536870912&k.flags&&Se(n,53),Se(n,54),Te(n),s(b,0),Se(n,23),n.writeLine()}n.decreaseIndent(),Se(n,16),v=c}var h=16&i,v=!1;return s(t,i)}function i(e,t,n,r){var a=h_(e);(32&a.flags||64&a.flags||524288&a.flags)&&c(mt(e),t,n,r)}function o(e,t,r,i,o){n(e.symbol,t);var s=Bn(e);s&&(Te(t),De(t,83),Te(t),a(s,t,r,i,o))}function s(t,r,i,o,s){var c=t.valueDeclaration;e.isRestParameter(c)&&Se(r,22),n(t,r),Cn(c)&&Se(r,53),Se(r,54),Te(r),a(_t(t),r,i,o,s)}function c(e,t,n,r,a){if(e&&e.length){Se(t,25);for(var i=0;i<e.length;i++)i>0&&(Se(t,24),Te(t)),o(e[i],t,n,r,a);Se(t,27)}}function _(e,t,n,r,i,o){if(e&&e.length){Se(n,25);for(var s=0;s<e.length;s++)s>0&&(Se(n,24),Te(n)),a(t(e[s]),n,r,0);Se(n,27)}}function u(e,t,n,r,a){Se(t,17);for(var i=0;i<e.length;i++)i>0&&(Se(t,24),Te(t)),s(e[i],t,n,r,a);Se(t,18)}function l(t,n,r,i,o){e.isIdentifierTypePredicate(t)?n.writeParameter(t.parameterName):De(n,97),Te(n),De(n,124),Te(n),a(t.type,n,r,i,o)}function d(e,t,n,r,i){if(8&r?(Te(t),Se(t,34)):Se(t,54),Te(t),e.typePredicate)l(e.typePredicate,t,n,r,i);else{var o=wn(e);a(o,t,n,r,i)}}function p(e,t,n,r,a,i){1===a&&(De(t,92),Te(t)),e.target&&32&r?_(e.target.typeParameters,e.mapper,t,n):c(e.typeParameters,t,n,r,i),u(e.parameters,t,n,r,i),d(e,t,n,r,i)}return qd||(qd={buildSymbolDisplay:r,buildTypeDisplay:a,buildTypeParameterDisplay:o,buildTypePredicateDisplay:l,buildParameterDisplay:s,buildDisplayForParametersAndDelimiters:u,buildDisplayForTypeParametersAndDelimiters:c,buildTypeParameterDisplayFromSymbol:i,buildSignatureDisplay:p,buildReturnTypeDisplay:d})}function Ie(t){function n(){switch(t.kind){case 166:return Ie(t.parent.parent);case 214:if(e.isBindingPattern(t.name)&&!t.name.elements.length)return!1;case 221:case 217:case 218:case 219:case 216:case 220:case 224:if(e.isExternalModuleAugmentation(t))return!0;var n=Ke(t);return 2&e.getCombinedNodeFlags(t)||224!==t.kind&&251!==n.kind&&e.isInAmbientContext(n)?Ie(n):v(n);case 142:case 141:case 146:case 147:case 144:case 143:if(48&t.flags)return!1;case 145:case 149:case 148:case 150:case 139:case 222:case 153:case 154:case 156:case 152:case 157:case 158:case 159:case 160:case 161:return Ie(t.parent);case 226:case 227:case 229:return!1;case 138:case 251:return!0;case 230:return!1;default:e.Debug.fail("isDeclarationVisible unknown: SyntaxKind: "+t.kind)}}if(t){var r=h(t);return void 0===r.isVisible&&(r.isVisible=!!n()),r.isVisible}return!1}function Fe(t){function n(t){e.forEach(t,function(t){h(t).isVisible=!0;var r=E(t)||t;if(e.contains(i,r)||i.push(r),e.isInternalModuleImportEqualsDeclaration(t)){var a=t.moduleReference,o=O_(a),s=C(t,o.text,901119,e.Diagnostics.Cannot_find_name_0,o);s&&n(s.declarations)}})}var r;if(t.parent&&230===t.parent.kind)r=C(t.parent,t.text,9289727,e.Diagnostics.Cannot_find_name_0,t);else if(233===t.parent.kind){var a=t.parent;r=a.parent.parent.moduleSpecifier?F(a.parent.parent,a):V(a.propertyName||a.name,9289727)}var i=[];return r&&n(r.declarations),i}function Le(e,t){var n=Me(e,t);if(n>=0){for(var r=ep.length,a=n;r>a;a++)tp[a]=!1;return!1}return ep.push(e),tp.push(!0),np.push(t),!0}function Me(e,t){for(var n=ep.length-1;n>=0;n--){if(Be(ep[n],np[n]))return-1;if(ep[n]===e&&np[n]===t)return n}return-1}function Be(t,n){return 0===n?y(t).type:2===n?y(t).declaredType:1===n?(e.Debug.assert(!!(1024&t.flags)),t.resolvedBaseConstructorType):3===n?t.resolvedReturnType:void e.Debug.fail("Unhandled TypeSystemPropertyName "+n)}function ze(){return ep.pop(),np.pop(),tp.pop()}function Ke(t){for(t=e.getRootDeclaration(t);t;)switch(t.kind){case 214:case 215:case 229:case 228:case 227:case 226:t=t.parent;break;default:return t.parent}}function je(t){var n=Ot(ie(t));return n.typeParameters?Jn(n,e.map(n.typeParameters,function(e){return nd})):n}function Je(e,t){var n=mn(e,t);return n?_t(n):void 0}function Ue(e){return e&&0!==(1&e.flags)}function qe(e){var t=ae(e);return t&&y(t).type||Qe(e)}function We(t){switch(t.kind){case 69:return t.text;case 9:case 8:return t.text;case 137:if(e.isStringOrNumericLiteral(t.expression.kind))return t.expression.text}}function Ve(t){return 137===t.kind&&!e.isStringOrNumericLiteral(t.expression.kind)}function He(t){var n=t.parent,r=qe(n.parent);if(r===ud)return ud;if(!r||Ue(r))return t.initializer?Os(t.initializer):r;var a;if(164===n.kind){var i=t.propertyName||t.name;if(Ve(i))return nd;var o=We(i);if(a=Je(r,o)||Bi(o)&&vn(r,1)||vn(r,0),!a)return s(i,e.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature,Ae(r),e.declarationNameToString(i)),ud}else{var c=Yc(r,n,!1);if(t.dotDotDotToken)a=cr(c);else{var _=""+e.indexOf(n.elements,t);if(a=xa(r)?Je(r,_):c,!a)return Da(r)?s(t,e.Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2,Ae(r),r.elementTypes.length,n.elements.length):s(t,e.Diagnostics.Type_0_has_no_property_1,Ae(r),_),ud}}return a}function Ge(e){var t=Xe(e);return t?Pr(t):void 0}function Xe(t){var n=e.getJSDocTypeTag(t);if(n&&n.typeExpression)return n.typeExpression.type;if(214===t.kind&&215===t.parent.kind&&196===t.parent.parent.kind){var r=e.getJSDocTypeTag(t.parent.parent);if(r&&r.typeExpression)return r.typeExpression.type}else if(139===t.kind){var a=e.getCorrespondingJSDocParameterTag(t);if(a&&a.typeExpression)return a.typeExpression.type}}function Qe(t){if(32&t.parserContextFlags){var n=Ge(t);if(n&&n!==ud)return n}if(203===t.parent.parent.kind)return rd;if(204===t.parent.parent.kind)return Qc(t.parent.parent.expression)||nd;if(e.isBindingPattern(t.parent))return He(t);if(t.type)return Pr(t.type);if(139===t.kind){var r=t.parent;if(147===r.kind&&!e.hasDynamicName(r)){var a=e.getDeclarationOfKind(t.parent.symbol,146);if(a)return wn(Sn(a))}var n=ai(t);if(n)return n}return t.initializer?Os(t.initializer):249===t.kind?Va(t.name):e.isBindingPattern(t.name)?et(t.name,!1):void 0}function Ye(t,n){return t.initializer?Ea(Os(t.initializer)):e.isBindingPattern(t.name)?et(t.name,n):nd}function $e(t,n){var r={},a=!1;e.forEach(t.elements,function(e){var t=e.propertyName||e.name;if(Ve(t))return void(a=!0);var i=We(t),o=67108868|(e.initializer?536870912:0),s=c(o,i);s.type=Ye(e,n),s.bindingElement=e,r[s.name]=s});var i=me(void 0,r,ql,ql,void 0,void 0);return n&&(i.pattern=t),a&&(i.flags|=67108864),i}function Ze(t,n){var r=t.elements;if(0===r.length||r[r.length-1].dotDotDotToken)return Hl>=2?or(nd):Ad;var a=e.map(r,function(e){return 190===e.kind?nd:Ye(e,n)});if(n){var i=lr(a);return i.pattern=t,i}return ur(a)}function et(e,t){return 164===e.kind?$e(e,t):Ze(e,t)}function tt(t,n){var r=Qe(t);if(r)return n&&Pa(t,r),248===t.kind?r:Ea(r);if(r=t.dotDotDotToken?Ad:nd,n&&Vl.noImplicitAny){var a=e.getRootDeclaration(t);sc(a)||139===a.kind&&sc(a.parent)||Aa(t,r)}return r}function nt(t){var n=y(t);if(!n.type){if(134217728&t.flags)return n.type=je(t);var r=t.valueDeclaration;if(247===r.parent.kind)return n.type=nd;if(230===r.kind)return n.type=Ls(r.expression);if(184===r.kind)return n.type=vr(e.map(t.declarations,function(e){return Os(e.right)}));if(169===r.kind&&184===r.parent.kind)return n.type=Os(r.parent.right);if(!Le(t,0))return ud;var a=tt(r,!0);ze()||(t.valueDeclaration.type?(a=ud,s(t.valueDeclaration,e.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation,Ee(t))):(a=nd,Vl.noImplicitAny&&s(t.valueDeclaration,e.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer,Ee(t)))),n.type=a}return n.type}function rt(t){if(t){if(146===t.kind)return t.type&&Pr(t.type);var n=e.getSetAccessorTypeAnnotationNode(t);return n&&Pr(n)}}function at(t){var n=y(t);if(!n.type){if(!Le(t,0))return ud;var r=e.getDeclarationOfKind(t,146),a=e.getDeclarationOfKind(t,147),i=void 0,o=rt(r);if(o)i=o;else{var c=rt(a);c?i=c:r&&r.body?i=es(r):(Vl.noImplicitAny&&s(a,e.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation,Ee(t)),i=nd)}if(!ze()&&(i=nd,Vl.noImplicitAny)){var _=e.getDeclarationOfKind(t,146);s(_,e.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions,Ee(t))}n.type=i}return n.type}function it(e){var t=y(e);return t.type||(t.type=le(65536,e)),t.type}function ot(e){var t=y(e);return t.type||(t.type=At(ie(e))),t.type}function st(e){var t=y(e);if(!t.type){var n=j(e);t.type=107455&n.flags?_t(n):ud}return t.type}function ct(e){var t=y(e);return t.type||(t.type=Vr(_t(t.target),t.mapper)),t.type}function _t(e){return 16777216&e.flags?ct(e):7&e.flags?nt(e):9136&e.flags?it(e):8&e.flags?ot(e):98304&e.flags?at(e):8388608&e.flags?st(e):ud}function ut(e){return 4096&e.flags?e.target:e}function lt(t,n){function r(t){var a=ut(t);return a===n||e.forEach(xt(a),r)}return r(t)}function dt(t,n){for(var r=0,a=n;r<a.length;r++){var i=a[r],o=Pt(ae(i));t?e.contains(t,o)||t.push(o):t=[o]}return t}function pt(e,t){for(;;){if(t=t.parent,!t)return e;if(217===t.kind||189===t.kind||216===t.kind||176===t.kind||144===t.kind||177===t.kind){var n=t.typeParameters;if(n)return dt(pt(e,t),n)}}}function ft(t){var n=32&t.flags?t.valueDeclaration:e.getDeclarationOfKind(t,218);return pt(void 0,n)}function mt(e){for(var t,n=0,r=e.declarations;n<r.length;n++){var a=r[n];if(218===a.kind||217===a.kind||189===a.kind||219===a.kind){var i=a;i.typeParameters&&(t=dt(t,i.typeParameters))}}return t}function gt(t){return e.concatenate(ft(t),mt(t))}function yt(e){return 80896&e.flags&&yn(e,1).length>0}function ht(t){return e.getClassExtendsHeritageClauseElement(t.symbol.valueDeclaration)}function vt(t,n){var r=n?n.length:0;return e.filter(yn(t,1),function(e){return(e.typeParameters?e.typeParameters.length:0)===r})}function kt(t,n){var r=vt(t,n);if(n){var a=e.map(n,Pr);r=e.map(r,function(e){return Pn(e,a)})}return r}function bt(t){if(!t.resolvedBaseConstructorType){var n=ht(t);if(!n)return t.resolvedBaseConstructorType=cd;if(!Le(t,1))return ud;var r=Ls(n.expression);if(80896&r.flags&&on(r),!ze())return s(t.symbol.valueDeclaration,e.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_base_expression,Ee(t.symbol)),t.resolvedBaseConstructorType=ud;if(r!==ud&&r!==_d&&!yt(r))return s(n.expression,e.Diagnostics.Type_0_is_not_a_constructor_function_type,Ae(r)),t.resolvedBaseConstructorType=ud;t.resolvedBaseConstructorType=r}return t.resolvedBaseConstructorType}function xt(t){var n=32&t.symbol.flags,r=64&t.symbol.flags;return t.resolvedBaseTypes||(n||r||e.Debug.fail("type must be class or interface"),n&&Ct(t),r&&St(t)),t.resolvedBaseTypes}function Ct(t){t.resolvedBaseTypes=t.resolvedBaseTypes||ql;var n=bt(t);if(80896&n.flags){var r,a=ht(t),i=n&&n.symbol?Ot(n.symbol):void 0;if(n.symbol&&32&n.symbol.flags&&Dt(i))r=Un(a,n.symbol);else{var o=kt(n,a.typeArguments);if(!o.length)return void s(a.expression,e.Diagnostics.No_base_constructor_has_the_specified_number_of_type_arguments);r=wn(o[0])}if(r!==ud)return 3072&ut(r).flags?t===r||lt(r,t)?void s(t.symbol.valueDeclaration,e.Diagnostics.Type_0_recursively_references_itself_as_a_base_type,Ae(t,void 0,1)):void(t.resolvedBaseTypes===ql?t.resolvedBaseTypes=[r]:t.resolvedBaseTypes.push(r)):void s(a.expression,e.Diagnostics.Base_constructor_return_type_0_is_not_a_class_or_interface_type,Ae(r))}}function Dt(e){var t=e.outerTypeParameters;if(t){var n=t.length-1,r=e.typeArguments;return t[n].symbol!==r[n].symbol}return!0}function St(t){t.resolvedBaseTypes=t.resolvedBaseTypes||ql;for(var n=0,r=t.symbol.declarations;n<r.length;n++){var a=r[n];if(218===a.kind&&e.getInterfaceBaseTypeNodes(a))for(var i=0,o=e.getInterfaceBaseTypeNodes(a);i<o.length;i++){var c=o[i],_=Pr(c);_!==ud&&(3072&ut(_).flags?t===_||lt(_,t)?s(a,e.Diagnostics.Type_0_recursively_references_itself_as_a_base_type,Ae(t,void 0,1)):t.resolvedBaseTypes===ql?t.resolvedBaseTypes=[_]:t.resolvedBaseTypes.push(_):s(c,e.Diagnostics.An_interface_may_only_extend_a_class_or_another_interface))}}}function Tt(t){for(var n=0,r=t.declarations;n<r.length;n++){var a=r[n];if(218===a.kind){if(262144&a.flags)return!1;var i=e.getInterfaceBaseTypeNodes(a);if(i)for(var o=0,s=i;o<s.length;o++){var c=s[o];if(e.isSupportedExpressionWithTypeArguments(c)){var _=V(c.expression,793056,!0);if(!_||!(64&_.flags)||Et(_).thisType)return!1}}}}return!0}function Et(t){var n=y(t);if(!n.declaredType){var r=32&t.flags?1024:2048,a=n.declaredType=le(r,t),i=ft(t),o=mt(t);(i||o||1024===r||!Tt(t))&&(a.flags|=4096,a.typeParameters=e.concatenate(i,o),a.outerTypeParameters=i,a.localTypeParameters=o,a.instantiations={},a.instantiations[Kn(a.typeParameters)]=a,a.target=a,a.typeArguments=a.typeParameters,a.thisType=_e(33554944),a.thisType.symbol=t,a.thisType.constraint=a)}return n.declaredType}function wt(t){var n=y(t);if(!n.declaredType){if(!Le(t,2))return ud;var r=e.getDeclarationOfKind(t,219),a=Pr(r.type);ze()?(n.typeParameters=mt(t),n.typeParameters&&(n.instantiations={},n.instantiations[Kn(n.typeParameters)]=a)):(a=ud,s(r.name,e.Diagnostics.Type_alias_0_circularly_references_itself,Ee(t))),n.declaredType=a}return n.declaredType}function At(e){var t=y(e);if(!t.declaredType){var n=_e(128);n.symbol=e,t.declaredType=n}return t.declaredType}function Pt(t){var n=y(t);if(!n.declaredType){var r=_e(512);r.symbol=t,e.getDeclarationOfKind(t,138).constraint||(r.constraint=Vd),n.declaredType=r}return n.declaredType}function Nt(e){var t=y(e);return t.declaredType||(t.declaredType=Ot(j(e))),t.declaredType}function Ot(t){return e.Debug.assert(0===(16777216&t.flags)),96&t.flags?Et(t):524288&t.flags?wt(t):384&t.flags?At(t):262144&t.flags?Pt(t):8388608&t.flags?Nt(t):ud}function Rt(e){if(e.typeArguments)for(var t=0,n=e.typeArguments;t<n.length;t++){var r=n[t];if(!It(r))return!1}return!0}function It(e){switch(e.kind){case 117:case 130:case 128:case 120:case 131:case 103:case 163:return!0;case 157:return It(e.elementType);case 152:return Rt(e)}return!1}function Ft(e){return e.type&&It(e.type)||!e.type&&!e.initializer}function Lt(e){if(!(145===e.kind||e.type&&It(e.type)))return!1;for(var t=0,n=e.parameters;t<n.length;t++){var r=n[t];if(!Ft(r))return!1}return!0}function Mt(e){if(e.declarations&&1===e.declarations.length){var t=e.declarations[0];if(t)switch(t.kind){case 142:case 141:return Ft(t);case 144:case 143:case 145:return Lt(t)}}return!1}function Bt(e){for(var t={},n=0,r=e;n<r.length;n++){var a=r[n];t[a.name]=a}return t}function zt(e,t,n){for(var r={},a=0,i=e;a<i.length;a++){var o=i[a];r[o.name]=n&&Mt(o)?o:qr(o,t)}return r}function Kt(t,n){for(var r=0,a=n;r<a.length;r++){var i=a[r];e.hasProperty(t,i.name)||(t[i.name]=i)}}function jt(e){if(!e.declaredProperties){var t=e.symbol;e.declaredProperties=pe(t.members),e.declaredCallSignatures=Tn(t.members.__call),e.declaredConstructSignatures=Tn(t.members.__new),e.declaredStringIndexType=Fn(t,0),e.declaredNumberIndexType=Fn(t,1)}return e}function Jt(t,n){return 4096&t.flags?Jn(t.target,e.concatenate(t.typeArguments,[n||t.target.thisType])):t}function Ut(t,n,r,a){var i=zr,o=n.symbol.members,s=n.declaredCallSignatures,c=n.declaredConstructSignatures,_=n.declaredStringIndexType,u=n.declaredNumberIndexType;e.rangeEquals(r,a,0,r.length)||(i=Ir(r,a),o=zt(n.declaredProperties,i,1===r.length),s=Nr(n.declaredCallSignatures,i,Ur),c=Nr(n.declaredConstructSignatures,i,Ur),_=Vr(n.declaredStringIndexType,i),u=Vr(n.declaredNumberIndexType,i));var l=xt(n);if(l.length){o===n.symbol.members&&(o=Bt(n.declaredProperties));for(var d=e.lastOrUndefined(a),p=0,f=l;p<f.length;p++){var m=f[p],g=d?Jt(Vr(m,i),d):m;Kt(o,sn(g)),s=e.concatenate(s,yn(g,0)),c=e.concatenate(c,yn(g,1)),_=_||vn(g,0),u=u||vn(g,1)}}fe(t,o,s,c,_,u)}function qt(e){Ut(e,jt(e),ql,ql)}function Wt(t){var n=jt(t.target),r=e.concatenate(n.typeParameters,[n.thisType]),a=t.typeArguments&&t.typeArguments.length===r.length?t.typeArguments:e.concatenate(t.typeArguments,[t]);
Ut(t,n,r,a)}function Vt(e,t,n,r,a,i,o,s){var c=new jl(Zl);return c.declaration=e,c.typeParameters=t,c.parameters=n,c.resolvedReturnType=r,c.typePredicate=a,c.minArgumentCount=i,c.hasRestParameter=o,c.hasStringLiterals=s,c}function Ht(e){return Vt(e.declaration,e.typeParameters,e.parameters,e.resolvedReturnType,e.typePredicate,e.minArgumentCount,e.hasRestParameter,e.hasStringLiterals)}function Gt(t){var n=bt(t),r=yn(n,1);if(0===r.length)return[Vt(void 0,t.localTypeParameters,ql,t,void 0,0,!1,!1)];for(var a=ht(t),i=e.map(a.typeArguments,Pr),o=i?i.length:0,s=[],c=0,_=r;c<_.length;c++){var u=_[c],l=u.typeParameters?u.typeParameters.length:0;if(l===o){var d=l?Pn(u,i):Ht(u);d.typeParameters=t.localTypeParameters,d.resolvedReturnType=t,s.push(d)}}return s}function Xt(e){for(var t={},n=0;n<e.length;n++){var r=c(67108868,""+n);r.type=e[n],t[n]=r}return t}function Qt(e){var t=vr(e.elementTypes,!0),n=on(ir(vd,[t,e])),r=Xt(e.elementTypes);Kt(r,n.properties),fe(e,r,n.callSignatures,n.constructSignatures,n.stringIndexType,n.numberIndexType)}function Yt(e,t,n,r){for(var a=0,i=e;a<i.length;a++){var o=i[a];if(ma(o,t,n,r,Yr))return o}}function $t(t,n,r){if(n.typeParameters){if(r>0)return;for(var a=1;a<t.length;a++)if(!Yt(t[a],n,!1,!1))return;return[n]}for(var i=void 0,a=0;a<t.length;a++){var o=a===r?n:Yt(t[a],n,!0,!0);if(!o)return;e.contains(i,o)||(i||(i=[])).push(o)}return i}function Zt(t,n){for(var r=e.map(t,function(e){return yn(e,n)}),a=void 0,i=0;i<r.length;i++)for(var o=0,s=r[i];o<s.length;o++){var c=s[o];if(!a||!Yt(a,c,!1,!0)){var _=$t(r,c,i);if(_){var u=c;_.length>1&&(u=Ht(c),u.resolvedReturnType=void 0,u.unionSignatures=_),(a||(a=[])).push(u)}}}return a||ql}function en(e,t){for(var n=[],r=0,a=e;r<a.length;r++){var i=a[r],o=vn(i,t);if(!o)return;n.push(o)}return vr(n)}function tn(e){var t=Zt(e.types,0),n=Zt(e.types,1),r=en(e.types,0),a=en(e.types,1);fe(e,Wl,t,n,r,a)}function nn(e,t){return e?t?br([e,t]):e:t}function rn(t){for(var n=ql,r=ql,a=void 0,i=void 0,o=0,s=t.types;o<s.length;o++){var c=s[o];n=e.concatenate(n,yn(c,0)),r=e.concatenate(r,yn(c,1)),a=nn(a,vn(c,0)),i=nn(i,vn(c,1))}fe(t,Wl,n,r,a,i)}function an(e){var t=e.symbol;if(e.target){var n=zt(sn(e.target),e.mapper,!1),r=Nr(yn(e.target,0),e.mapper,Ur),a=Nr(yn(e.target,1),e.mapper,Ur),i=Vr(vn(e.target,0),e.mapper),o=Vr(vn(e.target,1),e.mapper);fe(e,n,r,a,i,o)}else if(2048&t.flags){var n=t.members,r=Tn(n.__call),a=Tn(n.__new),i=Fn(t,0),o=Fn(t,1);fe(e,n,r,a,i,o)}else{var n=Wl,a=ql;if(1952&t.flags&&(n=Z(t)),32&t.flags){var s=Et(t);a=Tn(t.members.__constructor),a.length||(a=Gt(s));var c=bt(s);80896&c.flags&&(n=Bt(pe(n)),Kt(n,sn(c)))}var o=384&t.flags?rd:void 0;fe(e,n,ql,a,void 0,o),8208&t.flags&&(e.callSignatures=Tn(t))}}function on(e){return e.members||(4096&e.flags?Wt(e):3072&e.flags?qt(e):65536&e.flags?an(e):8192&e.flags?Qt(e):16384&e.flags?tn(e):32768&e.flags&&rn(e)),e}function sn(e){return 80896&e.flags?on(e).properties:ql}function cn(t,n){if(80896&t.flags){var r=on(t);if(e.hasProperty(r.members,n)){var a=r.members[n];if(se(a))return a}}}function _n(e){for(var t=0,n=e.types;t<n.length;t++){for(var r=n[t],a=0,i=un(r);a<i.length;a++){var o=i[a];fn(e,o.name)}if(16384&e.flags)break}return e.resolvedProperties?xn(e.resolvedProperties):ql}function un(e){return e=dn(e),49152&e.flags?_n(e):sn(e)}function ln(e){if(!e.resolvedApparentType){for(var t=Bn(e);t&&512&t.flags;)t=Bn(t);e.resolvedApparentType=Jt(t||ld,e)}return e.resolvedApparentType}function dn(e){return 512&e.flags&&(e=ln(e)),258&e.flags?e=kd:132&e.flags?e=bd:8&e.flags?e=xd:16777216&e.flags&&(e=Sd),e}function pn(t,n){for(var r,a=t.types,i=32768&t.flags?536870912:0,o=0,s=a;o<s.length;o++){var _=s[o],u=dn(_);if(u!==ud){var l=mn(u,n);if(!l||48&io(l)){if(16384&t.flags)return}else i&=l.flags,r?e.contains(r,l)||r.push(l):r=[l]}}if(r){if(1===r.length)return r[0];for(var d=[],p=[],f=0,m=r;f<m.length;f++){var l=m[f];l.declarations&&e.addRange(p,l.declarations),d.push(_t(l))}var g=c(335544324|i,n);return g.containingType=t,g.declarations=p,g.type=16384&t.flags?vr(d):br(d),g}}function fn(t,n){var r=t.resolvedProperties||(t.resolvedProperties={});if(e.hasProperty(r,n))return r[n];var a=pn(t,n);return a&&(r[n]=a),a}function mn(t,n){if(t=dn(t),80896&t.flags){var r=on(t);if(e.hasProperty(r.members,n)){var a=r.members[n];if(se(a))return a}if(r===fd||r.callSignatures.length||r.constructSignatures.length){var a=cn(hd,n);if(a)return a}return cn(yd,n)}return 49152&t.flags?fn(t,n):void 0}function gn(e,t){if(130048&e.flags){var n=on(e);return 0===t?n.callSignatures:n.constructSignatures}return ql}function yn(e,t){return gn(dn(e),t)}function hn(e,t){if(130048&e.flags){var n=on(e);return 0===t?n.stringIndexType:n.numberIndexType}}function vn(e,t){return hn(dn(e),t)}function kn(t){if(32&t.parserContextFlags){var n=e.getJSDocTemplateTag(t);if(n)return bn(n.typeParameters)}}function bn(t){var n=[];return e.forEach(t,function(t){var r=Pt(t.symbol);e.contains(n,r)||n.push(r)}),n}function xn(e){var t=[];for(var n in e)de(n)||t.push(e[n]);return t}function Cn(t){if(32&t.parserContextFlags){if(t.type&&263===t.type.kind)return!0;var n=e.getCorrespondingJSDocParameterTag(t);if(n){if(n.isBracketed)return!0;if(n.typeExpression)return 263===n.typeExpression.type.kind}}if(e.hasQuestionToken(t))return!0;if(t.initializer){var r=t.parent,a=Sn(r),i=e.indexOf(r.parameters,t);return e.Debug.assert(i>=0),i>=a.minArgumentCount}return!1}function Dn(e){if(69===e.parameterName.kind){var t=e.parameterName;return{kind:1,parameterName:t?t.text:void 0,parameterIndex:t?Js(e.parent.parameters,t):void 0,type:Pr(e.type)}}return{kind:0,type:Pr(e.type)}}function Sn(t){var n=h(t);if(!n.resolvedSignature){for(var r=145===t.kind?Et(re(t.parent.symbol)):void 0,a=r?r.localTypeParameters:t.typeParameters?bn(t.typeParameters):kn(t),i=[],o=!1,s=-1,c=e.isJSDocConstructSignature(t),_=void 0,u=void 0,l=c?1:0,d=t.parameters.length;d>l;l++){var p=t.parameters[l],f=p.symbol;if(f&&4&f.flags&&!e.isBindingPattern(p.name)){var m=C(p,f.name,107455,void 0,void 0);f=m}i.push(f),p.type&&163===p.type.kind&&(o=!0),p.initializer||p.questionToken||p.dotDotDotToken?0>s&&(s=l):s=-1}if(0>s&&(s=t.parameters.length),c)s--,_=Pr(t.parameters[0].type);else if(r)_=r;else if(t.type)_=Pr(t.type),151===t.type.kind&&(u=Dn(t.type));else{if(32&t.parserContextFlags){var g=$o(t);g&&g!==ud&&(_=g)}if(146===t.kind&&!e.hasDynamicName(t)){var y=e.getDeclarationOfKind(t.symbol,147);_=rt(y)}!_&&e.nodeIsMissing(t.body)&&(_=nd)}n.resolvedSignature=Vt(t,a,i,_,u,s,e.hasRestParameter(t),o)}return n.resolvedSignature}function Tn(e){if(!e)return ql;for(var t=[],n=0,r=e.declarations.length;r>n;n++){var a=e.declarations[n];switch(a.kind){case 153:case 154:case 216:case 144:case 143:case 145:case 148:case 149:case 150:case 146:case 147:case 176:case 177:case 264:if(n>0&&a.body){var i=e.declarations[n-1];if(a.parent===i.parent&&a.kind===i.kind&&a.pos===i.end)break}t.push(Sn(a))}}return t}function En(e){var t=H(e,e);if(t){var n=X(t);if(n)return _t(n)}return nd}function wn(t){if(!t.resolvedReturnType){if(!Le(t,3))return ud;var n=void 0;if(n=t.target?Vr(wn(t.target),t.mapper):t.unionSignatures?vr(e.map(t.unionSignatures,wn)):es(t.declaration),!ze()&&(n=nd,Vl.noImplicitAny)){var r=t.declaration;r.name?s(r.name,e.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions,e.declarationNameToString(r.name)):s(r,e.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions)}t.resolvedReturnType=n}return t.resolvedReturnType}function An(t){if(t.hasRestParameter){var n=_t(e.lastOrUndefined(t.parameters));if(4096&n.flags&&n.target===vd)return n.typeArguments[0]}return nd}function Pn(e,t){return Ur(e,Ir(e.typeParameters,t),!0)}function Nn(e){return e.typeParameters?(e.erasedSignatureCache||(e.target?e.erasedSignatureCache=Ur(Nn(e.target),e.mapper):e.erasedSignatureCache=Ur(e,Mr(e.typeParameters),!0)),e.erasedSignatureCache):e}function On(e){if(!e.isolatedSignatureType){var t=145===e.declaration.kind||149===e.declaration.kind,n=le(327680);n.members=Wl,n.properties=ql,n.callSignatures=t?ql:[e],n.constructSignatures=t?[e]:ql,e.isolatedSignatureType=n}return e.isolatedSignatureType}function Rn(e){return e.members.__index}function In(e,t){var n=1===t?128:130,r=Rn(e);if(r)for(var a=0,i=r.declarations;a<i.length;a++){var o=i[a],s=o;if(1===s.parameters.length){var c=s.parameters[0];if(c&&c.type&&c.type.kind===n)return s}}}function Fn(e,t){var n=In(e,t);return n?n.type?Pr(n.type):nd:void 0}function Ln(t){return e.getDeclarationOfKind(t.symbol,138).constraint}function Mn(t,n){for(var r;t&&!(33554432&t.flags)&&512&t.flags&&!e.contains(r,t);){if(t===n)return!0;(r||(r=[])).push(t);var a=Ln(t);t=a&&Pr(a)}return!1}function Bn(t){if(!t.constraint)if(t.target){var n=Bn(t.target);t.constraint=n?Vr(n,t.mapper):Vd}else{var r=Ln(t),a=Pr(r);Mn(a,t)&&(s(r,e.Diagnostics.Type_parameter_0_has_a_circular_constraint,Ae(t)),a=ud),t.constraint=a}return t.constraint===Vd?void 0:t.constraint}function zn(t){return ae(e.getDeclarationOfKind(t.symbol,138).parent)}function Kn(e){if(e)switch(e.length){case 1:return""+e[0].id;case 2:return e[0].id+","+e[1].id;default:for(var t="",n=0;n<e.length;n++)n>0&&(t+=","),t+=e[n].id;return t}return""}function jn(e){for(var t=0,n=0,r=e;n<r.length;n++){var a=r[n];t|=a.flags}return 14680064&t}function Jn(e,t){var n=Kn(t),r=e.instantiations[n];if(!r){var a=4096|(t?jn(t):0);r=e.instantiations[n]=le(a,e.symbol),r.target=e,r.typeArguments=t}return r}function Un(t,n){var r=Ot(n),a=r.localTypeParameters;return a?t.typeArguments&&t.typeArguments.length===a.length?Jn(r,e.concatenate(r.outerTypeParameters,e.map(t.typeArguments,Pr))):(s(t,e.Diagnostics.Generic_type_0_requires_1_type_argument_s,Ae(r,void 0,1),a.length),ud):t.typeArguments?(s(t,e.Diagnostics.Type_0_is_not_generic,Ae(r)),ud):r}function qn(t,n){var r=Ot(n),a=y(n),i=a.typeParameters;if(i){if(!t.typeArguments||t.typeArguments.length!==i.length)return s(t,e.Diagnostics.Generic_type_0_requires_1_type_argument_s,Ee(n),i.length),ud;var o=e.map(t.typeArguments,Pr),c=Kn(o);return a.instantiations[c]||(a.instantiations[c]=Vr(r,Ir(i,o)))}return t.typeArguments?(s(t,e.Diagnostics.Type_0_is_not_generic,Ee(n)),ud):r}function Wn(t,n){return t.typeArguments?(s(t,e.Diagnostics.Type_0_is_not_generic,Ee(n)),ud):Ot(n)}function Vn(t){switch(t.kind){case 152:return t.typeName;case 262:return t.name;case 191:if(e.isSupportedExpressionWithTypeArguments(t))return t.expression}}function Hn(e,t){return t?V(t,793056)||ed:ed}function Gn(e,t){return t===ed?ud:96&t.flags?Un(e,t):524288&t.flags?qn(e,t):107455&t.flags&&262===e.kind?_t(t):Wn(e,t)}function Xn(t){var n=h(t);if(!n.resolvedType){var r=void 0,a=void 0;if(262===t.kind){var i=Vn(t);r=Hn(t,i),a=Gn(t,r),n.resolvedSymbol=r,n.resolvedType=a}else{var o=152===t.kind?t.typeName:e.isSupportedExpressionWithTypeArguments(t)?t.expression:void 0;r=o&&V(o,793056)||ed,a=r===ed?ud:96&r.flags?Un(t,r):524288&r.flags?qn(t,r):Wn(t,r)}n.resolvedSymbol=r,n.resolvedType=a}return n.resolvedType}function Qn(e){var t=h(e);return t.resolvedType||(t.resolvedType=Ea(Ls(e.exprName))),t.resolvedType}function Yn(t,n){function r(e){for(var t=e.declarations,n=0,r=t;n<r.length;n++){var a=r[n];switch(a.kind){case 217:case 218:case 220:return a}}}if(!t)return n?pd:ld;var a=Ot(t);return 80896&a.flags?(a.typeParameters?a.typeParameters.length:0)!==n?(s(r(t),e.Diagnostics.Global_type_0_must_have_1_type_parameter_s,t.name,n),n?pd:ld):a:(s(r(t),e.Diagnostics.Global_type_0_must_be_a_class_or_interface_type,t.name),n?pd:ld)}function $n(t){return er(t,107455,e.Diagnostics.Cannot_find_global_value_0)}function Zn(t){return er(t,793056,e.Diagnostics.Cannot_find_global_type_0)}function er(e,t,n){return C(void 0,e,t,n,e)}function tr(e,t){return void 0===t&&(t=0),Yn(Zn(e),t)}function nr(e,t){var n=er(e,1536,void 0),r=n&&k(n.exports,t,793056);return r&&Ot(r)}function rr(){return md||(md=$n("Symbol"))}function ar(e){var t=Id();return t!==pd?Jn(t,[e]):ld}function ir(e,t){return e!==pd?Jn(e,t):ld}function or(e){return ir(Td,[e])}function sr(e){return ir(wd,[e])}function cr(e){return ir(vd,[e])}function _r(e){var t=h(e);return t.resolvedType||(t.resolvedType=cr(Pr(e.elementType))),t.resolvedType}function ur(e){var t=Kn(e);return Qd[t]||(Qd[t]=lr(e))}function lr(e){var t=le(8192|jn(e));return t.elementTypes=e,t}function dr(t){var n=h(t);return n.resolvedType||(n.resolvedType=ur(e.map(t.elementTypes,Pr))),n.resolvedType}function pr(t,n,r){n.flags&r?fr(t,n.types,r):e.contains(t,n)||t.push(n)}function fr(e,t,n){for(var r=0,a=t;r<a.length;r++){var i=a[r];pr(e,i,n)}}function mr(e,t){for(var n=0,r=t.length;r>n;n++)if(e!==t[n]&&Zr(e,t[n]))return!0;return!1}function gr(e){for(var t=e.length;t>0;)t--,mr(e[t],e)&&e.splice(t,1)}function yr(e){for(var t=0,n=e;t<n.length;t++){var r=n[t];if(Ue(r))return!0}return!1}function hr(e,t){for(var n=e.length;n>0&&e.length>1;)n--,e[n]===t&&e.splice(n,1)}function vr(e,t){if(0===e.length)return dd;var n=[];if(fr(n,e,16384),yr(n))return nd;if(t?(hr(n,cd),hr(n,_d)):gr(n),1===n.length)return n[0];var r=Kn(n),a=Yd[r];return a||(a=Yd[r]=le(16384|jn(n)),a.types=n),a}function kr(t){var n=h(t);return n.resolvedType||(n.resolvedType=vr(e.map(t.types,Pr),!0)),n.resolvedType}function br(e){if(0===e.length)return ld;var t=[];if(fr(t,e,32768),yr(t))return nd;if(1===t.length)return t[0];var n=Kn(t),r=$d[n];return r||(r=$d[n]=le(32768|jn(t)),r.types=t),r}function xr(t){var n=h(t);return n.resolvedType||(n.resolvedType=br(e.map(t.types,Pr))),n.resolvedType}function Cr(e){var t=h(e);return t.resolvedType||(t.resolvedType=le(65536,e.symbol)),t.resolvedType}function Dr(t){if(e.hasProperty(Zd,t))return Zd[t];var n=Zd[t]=_e(256);return n.text=t,n}function Sr(e){var t=h(e);return t.resolvedType||(t.resolvedType=Dr(e.text)),t.resolvedType}function Tr(e){var t=h(e);if(!t.resolvedType){var n=Pr(e.type);t.resolvedType=n?cr(n):ud}return t.resolvedType}function Er(t){var n=h(t);if(!n.resolvedType){var r=e.map(t.types,Pr);n.resolvedType=ur(r)}return n.resolvedType}function wr(t){var n=e.getThisContainer(t,!1),r=n&&n.parent;return!r||!e.isClassLike(r)&&218!==r.kind||64&n.flags||145===n.kind&&!e.isNodeDescendentOf(t,n.body)?(s(t,e.Diagnostics.A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface),ud):Et(ae(r)).thisType}function Ar(e){var t=h(e);return t.resolvedType||(t.resolvedType=wr(e)),t.resolvedType}function Pr(e){switch(e.kind){case 117:case 253:case 254:return nd;case 130:return rd;case 128:return ad;case 120:return id;case 131:return od;case 103:return sd;case 162:return Ar(e);case 163:return Sr(e);case 152:case 262:return Xn(e);case 151:return id;case 191:return Xn(e);case 155:return Qn(e);case 157:case 255:return _r(e);case 158:return dr(e);case 159:case 256:return kr(e);case 160:return xr(e);case 161:case 258:case 259:case 266:case 267:case 263:return Pr(e.type);case 153:case 154:case 156:case 264:case 260:return Cr(e);case 69:case 136:var t=cu(e);return t&&Ot(t);case 257:return Er(e);case 265:return Tr(e);default:return ud}}function Nr(e,t,n){if(e&&e.length){for(var r=[],a=0,i=e;a<i.length;a++){var o=i[a];r.push(n(o,t))}return r}return e}function Or(e,t){return function(n){return n===e?t:n}}function Rr(e,t,n,r){return function(a){return a===e?t:a===n?r:a}}function Ir(e,t){switch(e.length){case 1:return Or(e[0],t[0]);case 2:return Rr(e[0],t[0],e[1],t[1])}return function(n){for(var r=0;r<e.length;r++)if(n===e[r])return t[r];return n}}function Fr(e){return function(t){return t===e?nd:t}}function Lr(e,t){return function(n){return n===e||n===t?nd:n}}function Mr(e){switch(e.length){case 1:return Fr(e[0]);case 2:return Lr(e[0],e[1])}return function(t){for(var n=0,r=e;n<r.length;n++){var a=r[n];if(t===a)return nd}return t}}function Br(e){if(!e.mapper){var t=function(t){for(var n=e.typeParameters,r=0;r<n.length;r++)if(t===n[r])return e.inferences[r].isFixed=!0,Ba(e,r);return t};t.context=e,e.mapper=t}return e.mapper}function zr(e){return e}function Kr(e,t){return function(n){return Vr(e(n),t)}}function jr(e){var t=_e(512);return t.symbol=e.symbol,t.target=e,t}function Jr(t,n){return e.isIdentifierTypePredicate(t)?{kind:1,parameterName:t.parameterName,parameterIndex:t.parameterIndex,type:Vr(t.type,n)}:{kind:0,type:Vr(t.type,n)}}function Ur(t,n,r){var a,i;if(t.typeParameters&&!r){a=e.map(t.typeParameters,jr),n=Kr(Ir(t.typeParameters,a),n);for(var o=0,s=a;o<s.length;o++){var c=s[o];c.mapper=n}}t.typePredicate&&(i=Jr(t.typePredicate,n));var _=Vt(t.declaration,a,Nr(t.parameters,n,qr),Vr(t.resolvedReturnType,n),i,t.minArgumentCount,t.hasRestParameter,t.hasStringLiterals);return _.target=t,_.mapper=n,_}function qr(e,t){if(16777216&e.flags){var n=y(e);e=n.target,t=Kr(n.mapper,t)}var r=c(83886080|e.flags,e.name);return r.declarations=e.declarations,r.parent=e.parent,r.target=e,r.mapper=t,e.valueDeclaration&&(r.valueDeclaration=e.valueDeclaration),r}function Wr(e,t){if(t.instantiations){var n=t.instantiations[e.id];if(n)return n}else t.instantiations=[];var r=le(196608,e.symbol);return r.target=e,r.mapper=t,t.instantiations[e.id]=r,r}function Vr(e,t){if(e&&t!==zr){if(512&e.flags)return t(e);if(65536&e.flags)return e.symbol&&14384&e.symbol.flags?Wr(e,t):e;if(4096&e.flags)return Jn(e.target,Nr(e.typeArguments,t,Vr));if(8192&e.flags)return ur(Nr(e.elementTypes,t,Vr));if(16384&e.flags)return vr(Nr(e.types,t,Vr),!0);if(32768&e.flags)return br(Nr(e.types,t,Vr))}return e}function Hr(t){switch(e.Debug.assert(144!==t.kind||e.isObjectLiteralMethod(t)),t.kind){case 176:case 177:return Gr(t);case 168:return e.forEach(t.properties,Hr);case 167:return e.forEach(t.elements,Hr);case 185:return Hr(t.whenTrue)||Hr(t.whenFalse);case 184:return 52===t.operatorToken.kind&&(Hr(t.left)||Hr(t.right));case 248:return Hr(t.initializer);case 144:case 143:return Gr(t);case 175:return Hr(t.expression)}return!1}function Gr(t){return!t.typeParameters&&t.parameters.length&&!e.forEach(t.parameters,function(e){return e.type})}function Xr(e){if(80896&e.flags){var t=on(e);if(t.constructSignatures.length){var n=le(65536,e.symbol);n.members=t.members,n.properties=t.properties,n.callSignatures=ql,n.constructSignatures=ql,e=n}}return e}function Qr(e,t){return _a(e,t,fp,void 0)}function Yr(e,t){return _a(e,t,fp,void 0)?-1:0}function $r(e,t){return _a(e,t,pp,void 0)?-1:0}function Zr(e,t){return ta(e,t,void 0)}function ea(e,t){return na(e,t,void 0)}function ta(e,t,n,r,a){return _a(e,t,dp,n,r,a)}function na(e,t,n,r,a){return _a(e,t,pp,n,r,a)}function ra(e,t,n){return 0!==aa(e,t,n,!1,void 0,$r)}function aa(t,n,r,a,i,o){if(t===n)return-1;if(!n.hasRestParameter&&t.minArgumentCount>n.parameters.length)return 0;t=Nn(t),n=Nn(n);for(var s=-1,c=sa(t),_=sa(n),u=ca(t,c,n,_),l=t.parameters,d=n.parameters,p=0;u>p;p++){var f=c>p?_t(l[p]):An(t),m=_>p?_t(d[p]):An(n),g=o(f,m,!1)||o(m,f,a);if(!g)return a&&i(e.Diagnostics.Types_of_parameters_0_and_1_are_incompatible,l[c>p?p:c].name,d[_>p?p:_].name),0;s&=g}if(!r){var y=wn(n);if(y===sd)return s;var h=wn(t);if(n.typePredicate){if(t.typePredicate)s&=ia(t.typePredicate,n.typePredicate,a,i,o);else if(e.isIdentifierTypePredicate(n.typePredicate))return a&&i(e.Diagnostics.Signature_0_must_have_a_type_predicate,we(t)),0}else s&=o(h,y,a)}return s}function ia(t,n,r,a,i){if(t.kind!==n.kind)return r&&(a(e.Diagnostics.A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard),a(e.Diagnostics.Type_predicate_0_is_not_assignable_to_1,Pe(t),Pe(n))),0;if(1===t.kind){var o=t,s=n;if(o.parameterIndex!==s.parameterIndex)return r&&(a(e.Diagnostics.Parameter_0_is_not_in_the_same_position_as_parameter_1,o.parameterName,s.parameterName),a(e.Diagnostics.Type_predicate_0_is_not_assignable_to_1,Pe(t),Pe(n))),0}var c=i(t.type,n.type,r);return 0===c&&r&&a(e.Diagnostics.Type_predicate_0_is_not_assignable_to_1,Pe(t),Pe(n)),c}function oa(e,t){var n=Nn(e),r=Nn(t),a=wn(n),i=wn(r);return i===sd||_a(i,a,pp,void 0)||_a(a,i,pp,void 0)?ra(n,r,!0):!1}function sa(e){var t=e.parameters.length;return e.hasRestParameter?t-1:t}function ca(e,t,n,r){return e.hasRestParameter===n.hasRestParameter?e.hasRestParameter?Math.max(t,r)+1:Math.min(t,r):e.hasRestParameter?r:t}function _a(t,n,r,a,i,o){function c(t,n,r,i){e.Debug.assert(!!a),P=e.chainDiagnosticMessages(P,t,n,r,i)}function _(t,n,r){var a=Ae(n),i=Ae(r);a===i&&(a=Ae(n,void 0,128),i=Ae(r,void 0,128)),c(t||e.Diagnostics.Type_0_is_not_assignable_to_type_1,a,i)}function u(e,t,n,a){var i;if(e===t)return-1;if(r===fp)return l(e,t);if(Ue(t))return-1;if(e===cd)return-1;if(e===_d&&t!==cd)return-1;if(128&e.flags&&t===ad)return-1;if(128&e.flags&&128&t.flags&&(i=A(e,t)))return i;if(256&e.flags&&t===rd)return-1;if(r===pp){if(Ue(e))return-1;if(e===ad&&128&t.flags)return-1}if(8&e.flags&&8&t.flags)return-1;if(1048576&e.flags){if(p(e,t,n))return n&&_(a,e,t),0;49152&t.flags&&(e=Sa(e))}var o=P;if(16384&e.flags){if(i=h(e,t,n))return i}else if(32768&t.flags){if(i=g(e,t,n))return i}else{if(32768&e.flags&&(i=y(e,t,n&&!(16384&t.flags))))return i;if(16384&t.flags&&(i=m(e,t,n)))return i}if(512&e.flags){var s=Bn(e);(!s||1&s.flags)&&(s=ld);var c=n&&s!==ld;if(i=u(s,t,c))return P=o,i}else{if(4096&e.flags&&4096&t.flags&&e.target===t.target&&(i=v(e,t,n)))return i;var d=dn(e);if(113664&d.flags&&80896&t.flags){var f=n&&P===o&&!(16777726&e.flags);if(i=k(d,e,t,f))return P=o,i}}return n&&_(a,e,t),0}function l(e,t){var n;return 80896&e.flags&&80896&t.flags?4096&e.flags&&4096&t.flags&&e.target===t.target&&(n=v(e,t,!1))?n:k(e,e,t,!1):(16384&e.flags&&16384&t.flags||32768&e.flags&&32768&t.flags)&&(n=f(e,t))&&(n&=f(t,e))?n:0}function d(e,t){if(80896&e.flags){var n=on(e);if(r===pp&&(e===yd||0===n.properties.length)||n.stringIndexType||n.numberIndexType||mn(e,t))return!0}else if(49152&e.flags)for(var a=0,i=e.types;a<i.length;a++){var o=i[a];if(d(o,t))return!0}return!1}function p(t,n,r){if(!(67108864&n.flags)&&fs(n,80896))for(var i=0,o=sn(t);i<o.length;i++){var s=o[i];if(!d(n,s.name))return r&&(e.Debug.assert(!!a),a=s.valueDeclaration,c(e.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1,Ee(s),Ae(n))),!0}return!1}function f(e,t){for(var n=-1,r=e.types,a=0,i=r;a<i.length;a++){var o=i[a],s=m(o,t,!1);if(!s)return 0;n&=s}return n}function m(e,t,n){for(var r=t.types,a=0,i=r.length;i>a;a++){var o=u(e,r[a],n&&a===i-1);if(o)return o}return 0}function g(e,t,n){for(var r=-1,a=t.types,i=0,o=a;i<o.length;i++){var s=o[i],c=u(e,s,n);if(!c)return 0;r&=c}return r}function y(e,t,n){for(var r=e.types,a=0,i=r.length;i>a;a++){var o=u(r[a],t,n&&a===i-1);if(o)return o}return 0}function h(e,t,n){for(var r=-1,a=e.types,i=0,o=a;i<o.length;i++){var s=o[i],c=u(s,t,n);if(!c)return 0;r&=c}return r}function v(e,t,n){var a=e.typeArguments||ql,i=t.typeArguments||ql;if(a.length!==i.length&&r===fp)return 0;for(var o=a.length<=i.length?a.length:i.length,s=-1,c=0;o>c;c++){var _=u(a[c],i[c],n);if(!_)return 0;s&=_}return s}function k(t,n,a,i){if(L)return 0;var o=r!==fp||t.id<a.id?t.id+","+a.id:a.id+","+t.id,s=r[o];if(void 0!==s){if(!i||2!==s)return 1===s?-1:0;r[o]=3}if(F>0){for(var c=0;F>c;c++)if(R[c][o])return 1;if(100===F)return L=!0,0}else N=[],O=[],R=[],I=0;N[F]=t,O[F]=a,R[F]={},R[F][o]=1,F++;var _=I;1&I||!la(t,N,F)||(I|=1),2&I||!la(a,O,F)||(I|=2);var u;if(3===I?u=1:(u=b(t,a,i),u&&(u&=C(t,a,0,i),u&&(u&=C(t,a,1,i),u&&(u&=T(t,n,a,i),u&&(u&=E(t,n,a,i)))))),I=_,F--,u){var l=R[F],d=-1===u||0===F?r:R[F-1];e.copyMap(l,d)}else r[o]=i?3:2;return u}function b(t,n,a){if(r===fp)return x(t,n);for(var i=-1,o=sn(n),s=r===dp&&!(524288&t.flags),_=0,l=o;_<l.length;_++){var d=l[_],p=mn(t,d.name);if(p!==d)if(p){if(!(134217728&d.flags)){var f=io(p),m=io(d);if(16&f||16&m){if(p.valueDeclaration!==d.valueDeclaration)return a&&(16&f&&16&m?c(e.Diagnostics.Types_have_separate_declarations_of_a_private_property_0,Ee(d)):c(e.Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2,Ee(d),Ae(16&f?t:n),Ae(16&f?n:t))),0}else if(32&m){var g=p.parent&&32&p.parent.flags,y=g?Ot(ie(p)):void 0,h=Ot(ie(d));if(!y||!lt(y,h))return a&&c(e.Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2,Ee(d),Ae(y||t),Ae(h)),0}else if(32&f)return a&&c(e.Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2,Ee(d),Ae(t),Ae(n)),0;var v=u(_t(p),_t(d),a);if(!v)return a&&c(e.Diagnostics.Types_of_property_0_are_incompatible,Ee(d)),0;if(i&=v,536870912&p.flags&&!(536870912&d.flags))return a&&c(e.Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2,Ee(d),Ae(t),Ae(n)),0}}else if(!(536870912&d.flags)||s)return a&&c(e.Diagnostics.Property_0_is_missing_in_type_1,Ee(d),Ae(t)),0}return i}function x(e,t){if(!(80896&e.flags&&80896&t.flags))return 0;var n=sn(e),r=sn(t);if(n.length!==r.length)return 0;for(var a=-1,i=0,o=n;i<o.length;i++){var s=o[i],c=cn(t,s.name);if(!c)return 0;var _=pa(s,c,u);if(!_)return 0;a&=_}return a}function C(t,n,a,i){if(r===fp)return S(t,n,a);if(n===fd||t===fd)return-1;var o=yn(t,a),s=yn(n,a);if(1===a&&o.length&&s.length&&ua(t)&&!ua(n))return i&&c(e.Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type),0;var _=-1,u=P;e:for(var l=0,d=s;l<d.length;l++){var p=d[l];if(!p.hasStringLiterals||262144&n.flags){for(var f=i,m=0,g=o;m<g.length;m++){var y=g[m];if(!y.hasStringLiterals||262144&t.flags){var h=D(y,p,f);if(h){_&=h,P=u;continue e}f=!1}}return f&&c(e.Diagnostics.Type_0_provides_no_match_for_the_signature_1,Ae(t),we(p,void 0,void 0,a)),0}}return _}function D(e,t,n){return aa(e,t,!1,n,c,u)}function S(e,t,n){var r=yn(e,n),a=yn(t,n);if(r.length!==a.length)return 0;for(var i=-1,o=0,s=r.length;s>o;o++){var c=ma(r[o],a[o],!1,!1,u);if(!c)return 0;i&=c}return i}function T(t,n,a,i){if(r===fp)return w(0,t,a);var o=vn(a,0);if(o){if(1&o.flags&&!(16777726&n.flags))return-1;var s=vn(t,0);if(!s)return i&&c(e.Diagnostics.Index_signature_is_missing_in_type_0,Ae(t)),0;var _=u(s,o,i);return _?_:(i&&c(e.Diagnostics.Index_signatures_are_incompatible),0)}return-1}function E(t,n,a,i){if(r===fp)return w(1,t,a);var o=vn(a,1);if(o){if(1&o.flags&&!(16777726&n.flags))return-1;var s=vn(t,0),_=vn(t,1);if(!s&&!_)return i&&c(e.Diagnostics.Index_signature_is_missing_in_type_0,Ae(t)),0;var l=void 0;return l=s&&_?u(s,o,!1)||u(_,o,i):u(s||_,o,i),l?l:(i&&c(e.Diagnostics.Index_signatures_are_incompatible),0)}return-1}function w(e,t,n){var r=vn(n,e),a=vn(t,e);return a||r?a&&r?u(a,r):0:-1}function A(t,n){if(t.symbol.name!==n.symbol.name||128&t.symbol.flags||128&n.symbol.flags)return 0;for(var r=_t(n.symbol),a=0,i=un(_t(t.symbol));a<i.length;a++){var o=i[a];if(8&o.flags){var s=mn(r,o.name);if(!(s&&8&s.flags))return c(e.Diagnostics.Property_0_is_missing_in_type_1,o.name,Ae(n,void 0,128)),0}}return-1}var P,N,O,R,I,F=0,L=!1;e.Debug.assert(r!==fp||!a,"no error reporting in identity checking");var M=u(t,n,!!a,i);return L?s(a,e.Diagnostics.Excessive_stack_depth_comparing_types_0_and_1,Ae(t),Ae(n)):P&&(o&&(P=e.concatenateDiagnosticMessageChains(o,P)),cp.add(e.createDiagnosticForNodeFromMessageChain(a,P))),0!==M}function ua(e){if(65536&e.flags){var t=e.symbol;if(t&&32&t.flags){var n=v_(t);if(n&&128&n.flags)return!0}}return!1}function la(e,t,n){if(135168&e.flags&&n>=5)for(var r=e.symbol,a=0,i=0;n>i;i++){var o=t[i];if(135168&o.flags&&o.symbol===r&&(a++,a>=5))return!0}return!1}function da(e,t){return 0!==pa(e,t,Yr)}function pa(e,t,n){if(e===t)return-1;var r=48&io(e),a=48&io(t);if(r!==a)return 0;if(r){if(h_(e)!==h_(t))return 0}else if((536870912&e.flags)!==(536870912&t.flags))return 0;return n(_t(e),_t(t))}function fa(e,t,n){return e.parameters.length===t.parameters.length&&e.minArgumentCount===t.minArgumentCount&&e.hasRestParameter===t.hasRestParameter?!0:!!(n&&e.minArgumentCount<=t.minArgumentCount&&(e.hasRestParameter&&!t.hasRestParameter||e.hasRestParameter===t.hasRestParameter&&e.parameters.length>=t.parameters.length))}function ma(e,t,n,r,a){if(e===t)return-1;if(!fa(e,t,n))return 0;if((e.typeParameters?e.typeParameters.length:0)!==(t.typeParameters?t.typeParameters.length:0))return 0;e=Nn(e),t=Nn(t);for(var i=-1,o=t.parameters.length,s=0;o>s;s++){var c=ga(e,s)?An(e):_t(e.parameters[s]),_=ga(t,s)?An(t):_t(t.parameters[s]),u=a(c,_);if(!u)return 0;i&=u}return r||(i&=a(wn(e),wn(t))),i}function ga(e,t){return e.hasRestParameter&&t>=e.parameters.length-1}function ya(e,t){for(var n=0,r=t;n<r.length;n++){var a=r[n];if(e!==a&&!Zr(a,e))return!1}return!0}function ha(t){return e.forEach(t,function(e){return ya(e,t)?e:void 0})}function va(t,n,r){for(var a,i,o=0,s=0;s<t.length;s++){for(var c=0,_=void 0,u=0;u<t.length;u++)Zr(t[u],t[s])?c++:_||(_=t[u]);if(e.Debug.assert(!!_,"If there is no common supertype, each type should have a downfallType"),c>o&&(a=t[s],i=_,o=c),o===t.length-1)break}ta(i,a,n,e.Diagnostics.Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0,r)}function ka(e){return 4096&e.flags&&e.target===vd}function ba(e){return!(96&e.flags)&&ea(e,Ad)}function xa(e){return!!mn(e,"0")}function Ca(e){return 256&e.flags}function Da(e){return!!(8192&e.flags)}function Sa(e){if(1048576&e.flags){var t=e.regularType;return t||(t=_e(-1048577&e.flags),t.symbol=e.symbol,t.members=e.members,t.properties=e.properties,t.callSignatures=e.callSignatures,t.constructSignatures=e.constructSignatures,t.stringIndexType=e.stringIndexType,t.numberIndexType=e.numberIndexType,e.regularType=t),t}return e}function Ta(t){var n=sn(t),r={};e.forEach(n,function(e){var t=_t(e),n=Ea(t);if(t!==n){var a=c(67108864|e.flags,e.name);a.declarations=e.declarations,a.parent=e.parent,a.type=n,a.target=e,e.valueDeclaration&&(a.valueDeclaration=e.valueDeclaration),e=a}r[e.name]=e});var a=vn(t,0),i=vn(t,1);return a&&(a=Ea(a)),i&&(i=Ea(i)),me(t.symbol,r,ql,ql,a,i)}function Ea(t){if(6291456&t.flags){if(96&t.flags)return nd;if(524288&t.flags)return Ta(t);if(16384&t.flags)return vr(e.map(t.types,Ea),!0);if(ka(t))return cr(Ea(t.typeArguments[0]));if(Da(t))return ur(e.map(t.elementTypes,Ea))}return t}function wa(t){var n=!1;if(16384&t.flags)for(var r=0,a=t.types;r<a.length;r++){var i=a[r];wa(i)&&(n=!0)}if(ka(t))return wa(t.typeArguments[0]);if(Da(t))for(var o=0,c=t.elementTypes;o<c.length;o++){var i=c[o];wa(i)&&(n=!0)}if(524288&t.flags)for(var _=0,u=sn(t);_<u.length;_++){var l=u[_],i=_t(l);2097152&i.flags&&(wa(i)||s(l.valueDeclaration,e.Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type,l.name,Ae(Ea(i))),n=!0)}return n}function Aa(t,n){var r,a=Ae(Ea(n));switch(t.kind){case 142:case 141:r=e.Diagnostics.Member_0_implicitly_has_an_1_type;break;case 139:r=t.dotDotDotToken?e.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type:e.Diagnostics.Parameter_0_implicitly_has_an_1_type;break;case 216:case 144:case 143:case 146:case 147:case 176:case 177:if(!t.name)return void s(t,e.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type,a);r=e.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type;break;default:r=e.Diagnostics.Variable_0_implicitly_has_an_1_type}s(t,r,e.declarationNameToString(t.name),a)}function Pa(e,t){a&&Vl.noImplicitAny&&2097152&t.flags&&(wa(t)||Aa(e,t))}function Na(e,t,n){var r,a=e.parameters.length,i=t.parameters.length;e.hasRestParameter&&t.hasRestParameter?(r=a>i?a:i,a--,i--):e.hasRestParameter?(a--,r=i):t.hasRestParameter?(i--,r=a):r=i>a?a:i;for(var o=0;r>o;o++){var s=a>o?_t(e.parameters[o]):An(e),c=i>o?_t(t.parameters[o]):An(t);n(s,c)}}function Oa(t,n){var r=e.map(t,Ra);return{typeParameters:t,inferUnionTypes:n,inferences:r,inferredTypes:new Array(t.length)}}function Ra(){return{primary:void 0,secondary:void 0,isFixed:!1}}function Ia(t,n,r){function a(e,t){for(var n=0;p>n;n++)if(e===u[n]&&t===l[n])return!0;return!1}function i(n,r){if(16384&n.flags&&16384&r.flags||32768&n.flags&&32768&r.flags){for(var c=void 0,g=0,y=r.types;g<y.length;g++){var h=y[g];Fa(h,n.types)&&((c||(c=[])).push(h),i(h,h))}c&&(n=La(n,c),r=La(r,c))}if(512&r.flags){if(8388608&n.flags)return;for(var v=t.typeParameters,k=0;k<v.length;k++)if(r===v[k]){
var b=t.inferences[k];if(!b.isFixed){var x=f?b.secondary||(b.secondary=[]):b.primary||(b.primary=[]);e.contains(x,n)||x.push(n)}return}}else if(4096&n.flags&&4096&r.flags&&n.target===r.target)for(var C=n.typeArguments||ql,D=r.typeArguments||ql,S=C.length<D.length?C.length:D.length,k=0;S>k;k++)i(C[k],D[k]);else if(8192&n.flags&&8192&r.flags&&n.elementTypes.length===r.elementTypes.length)for(var C=n.elementTypes,D=r.elementTypes,k=0;k<C.length;k++)i(C[k],D[k]);else if(49152&r.flags){for(var D=r.types,T=0,E=void 0,w=0,A=D;w<A.length;w++){var h=A[w];512&h.flags&&e.contains(t.typeParameters,h)?(E=h,T++):i(n,h)}16384&r.flags&&1===T&&(f++,i(n,E),f--)}else if(49152&n.flags)for(var C=n.types,P=0,N=C;P<N.length;P++){var O=N[P];i(O,r)}else if(n=dn(n),80896&n.flags&&(4096&r.flags&&r.typeArguments||8192&r.flags||65536&r.flags&&r.symbol&&10272&r.symbol.flags)){if(a(n,r))return;if(p>d)return;if(la(n,u,p)&&la(r,l,p))return;var R=n.id+","+r.id;if(e.hasProperty(m,R))return;m[R]=!0,0===p&&(u=[],l=[]),u[p]=n,l[p]=r,p++,o(n,r),s(n,r,0),s(n,r,1),_(n,r,0,0),_(n,r,1,1),_(n,r,0,1),p--}}function o(e,t){for(var n=sn(t),r=0,a=n;r<a.length;r++){var o=a[r],s=cn(e,o.name);s&&i(_t(s),_t(o))}}function s(e,t,n){for(var r=yn(e,n),a=yn(t,n),i=r.length,o=a.length,s=o>i?i:o,_=0;s>_;_++)c(Nn(r[i-s+_]),Nn(a[o-s+_]))}function c(e,t){Na(e,t,i),e.typePredicate&&t.typePredicate&&e.typePredicate.kind===t.typePredicate.kind?i(e.typePredicate.type,t.typePredicate.type):i(wn(e),wn(t))}function _(e,t,n,r){var a=vn(t,r);if(a){var o=vn(e,n);o&&i(o,a)}}var u,l,d=5,p=0,f=0,m={};i(n,r)}function Fa(e,t){for(var n=0,r=t;n<r.length;n++){var a=r[n];if(Qr(a,e))return!0}return!1}function La(e,t){for(var n=[],r=0,a=e.types;r<a.length;r++){var i=a[r];Fa(i,t)||n.push(i)}return 16384&e.flags?vr(n,!0):br(n)}function Ma(e,t){var n=e.inferences[t];return n.primary||n.secondary||ql}function Ba(e,t){var n,r=e.inferredTypes[t];if(!r){var a=Ma(e,t);if(a.length){var i=e.inferUnionTypes?vr(a):ha(a);r=i?Ea(i):ud,n=!!i}else r=ld,n=!0;if(e.inferredTypes[t]=r,n){var o=Bn(e.typeParameters[t]);if(o){var s=Vr(o,Br(e));ea(r,Jt(s,r))||(e.inferredTypes[t]=r=s)}}else(void 0===e.failedTypeParameterIndex||e.failedTypeParameterIndex>t)&&(e.failedTypeParameterIndex=t)}return r}function za(e){for(var t=0;t<e.inferredTypes.length;t++)Ba(e,t);return e.inferredTypes}function Ka(t){var n=h(t);return n.resolvedSymbol||(n.resolvedSymbol=!e.nodeIsMissing(t)&&C(t,t.text,1156031,e.Diagnostics.Cannot_find_name_0,t)||ed),n.resolvedSymbol}function ja(t){for(;t;)switch(t.kind){case 155:return!0;case 69:case 136:t=t.parent;continue;default:return!1}e.Debug.fail("should not get here")}function Ja(t){return!!(t.initializer||e.isBindingPattern(t.parent)&&Ja(t.parent.parent))}function Ua(t,n){function r(n){if(n.operatorToken.kind>=56&&n.operatorToken.kind<=68){var r=Wa(n.left);if(69===r.kind&&Ka(r)===t)return!0}return e.forEachChild(n,i)}function a(n){return!e.isBindingPattern(n.name)&&ae(n)===t&&Ja(n)?!0:e.forEachChild(n,i)}function i(t){switch(t.kind){case 184:return r(t);case 214:case 166:return a(t);case 164:case 165:case 167:case 168:case 169:case 170:case 171:case 172:case 174:case 192:case 175:case 182:case 178:case 181:case 179:case 180:case 183:case 187:case 185:case 188:case 195:case 196:case 198:case 199:case 200:case 201:case 202:case 203:case 204:case 207:case 208:case 209:case 244:case 245:case 210:case 211:case 212:case 247:case 236:case 237:case 241:case 242:case 238:case 243:return e.forEachChild(t,i)}return!1}var o=h(n);if(o.assignmentChecks){var s=o.assignmentChecks[t.id];if(void 0!==s)return s}else o.assignmentChecks={};return o.assignmentChecks[t.id]=i(n)}function qa(t,n){function r(n,r,a){function i(e){return a===!!(e.flags&_)}if(179!==r.left.kind||9!==r.right.kind)return n;var o=r.left,s=r.right;if(69!==o.expression.kind||Ka(o.expression)!==t)return n;33===r.operatorToken.kind&&(a=!a);var c=_p[s.text];if(c&&c.type===cd)return n;var _;return c?_=c.flags:(a=!a,_=16777614),16384&n.flags?vr(e.filter(n.types,i),!0):a&&c&&Zr(c.type,n)?c.type:i(n)?n:dd}function a(e,t,n){return n?l(l(e,t.left,!0),t.right,!0):vr([l(e,t.left,!1),l(e,t.right,!1)])}function i(e,t,n){return n?vr([l(e,t.left,!0),l(e,t.right,!0)]):l(l(e,t.left,!1),t.right,!1)}function o(n,r,a){if(Ue(n)||69!==r.left.kind||Ka(r.left)!==t)return n;var i=Ls(r.right);if(!Zr(i,hd))return n;var o,c=mn(i,"prototype");if(c){var _=_t(c);Ue(_)||(o=_)}if(!o){var u=void 0;2048&i.flags?u=jt(i).declaredConstructSignatures:65536&i.flags&&(u=yn(i,1)),u&&u.length&&(o=vr(e.map(u,function(e){return wn(Nn(e))})))}return o?s(n,o,a):n}function s(t,n,r){if(!r)return 16384&t.flags?vr(e.filter(t.types,function(e){return!Zr(e,n)})):t;if(16384&t.flags){var a=e.filter(t.types,function(e){return ea(e,n)});if(a.length)return vr(a)}return ea(n,t)?n:t}function c(n,r,a){if(1&n.flags)return n;var i=Uo(r),o=i.typePredicate;if(!o)return n;if(!e.isIdentifierTypePredicate(o)){var c=Wa(r.expression);return _(n,o,c,a)}return r.arguments[o.parameterIndex]&&u(r.arguments[o.parameterIndex])===t?s(n,o.type,a):n}function _(e,n,r,a){if(170===r.kind||169===r.kind){var i=r,o=Wa(i.expression);if(69===o.kind&&u(o)===t)return s(e,n.type,a)}return e}function u(e){switch(e=Wa(e),e.kind){case 69:case 169:return su(e)}}function l(e,t,n){switch(t.kind){case 171:return c(e,t,n);case 175:return l(e,t.expression,n);case 184:var s=t.operatorToken.kind;if(32===s||33===s)return r(e,t,n);if(51===s)return a(e,t,n);if(52===s)return i(e,t,n);if(91===s)return o(e,t,n);break;case 182:if(49===t.operator)return l(e,t.operand,!n)}return e}var d=_t(t);if(n&&3&t.flags&&(Ue(d)||97792&d.flags)){var p=e.getDeclarationOfKind(t,214),f=p&&Ke(p),m=d,g=[];e:for(;n.parent;){var y=n;switch(n=n.parent,n.kind){case 199:case 185:case 184:g.push({node:n,child:y});break;case 251:case 221:break e}if(n===f)break}for(var h=void 0;h=g.pop();){var v=h.node,y=h.child;switch(v.kind){case 199:y!==v.expression&&(d=l(d,v.expression,y===v.thenStatement));break;case 185:y!==v.condition&&(d=l(d,v.condition,y===v.whenTrue));break;case 184:y===v.right&&(51===v.operatorToken.kind?d=l(d,v.left,!0):52===v.operatorToken.kind&&(d=l(d,v.left,!1)));break;default:e.Debug.fail("Unreachable!")}d!==m&&Ua(t,v)&&(d=m)}d===dd&&(d=m)}return d}function Wa(e){for(;175===e.kind;)e=e.expression;return e}function Va(t){var n=Ka(t);if(n===$l){var r=e.getContainingFunction(t);177===r.kind&&2>Hl&&s(t,e.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression),8&t.parserContextFlags&&(h(r).flags|=8192)}8388608&n.flags&&!ja(t)&&!Tu(j(n))&&U(n);var a=oe(n);if(2===Hl&&32&a.flags&&217===a.valueDeclaration.kind&&e.nodeIsDecorated(a.valueDeclaration))for(var r=e.getContainingClass(t);void 0!==r;){if(r===a.valueDeclaration&&r.name!==t){h(r).flags|=524288,h(t).flags|=1048576;break}r=e.getContainingClass(r)}return Oc(t,t),Pc(t,t),Ga(t,n),qa(a,t)}function Ha(t,n){for(var r=t;r&&r!==n;){if(e.isFunctionLike(r))return!0;r=r.parent}return!1}function Ga(t,n){if(!(Hl>=2||0===(34&n.flags)||247===n.valueDeclaration.parent.kind)){for(var r=e.getEnclosingBlockScopeContainer(n.valueDeclaration),a=Ha(t.parent,r),i=r,o=!1;i&&!e.nodeStartsNewLexicalEnvironment(i);){if(e.isIterationStatement(i,!1)){o=!0;break}i=i.parent}o&&(a&&(h(i).flags|=65536),202===r.kind&&e.getAncestor(n.valueDeclaration,215).parent===r&&Xa(t,r)&&(h(n.valueDeclaration).flags|=2097152),h(n.valueDeclaration).flags|=262144),a&&(h(n.valueDeclaration).flags|=131072)}}function Xa(t,n){for(var r=t;175===r.parent.kind;)r=r.parent;var a=!1;if(184===r.parent.kind&&(a=r.parent.left===r&&e.isAssignmentOperator(r.parent.operatorToken.kind)),182===r.parent.kind||183===r.parent.kind){var i=r.parent;a=41===i.operator||42===i.operator}if(!a)return!1;for(;r!==n;){if(r===n.statement)return!0;r=r.parent}return!1}function Qa(e,t){if(h(e).flags|=2,142===t.kind||145===t.kind){var n=t.parent;h(n).flags|=4}else h(t).flags|=4}function Ya(t){if(e.isSuperCallExpression(t))return t;if(!e.isFunctionLike(t))return e.forEachChild(t,Ya)}function $a(e){var t=h(e);return void 0===t.hasSuperCall&&(t.superCall=Ya(e.body),t.hasSuperCall=!!t.superCall),t.superCall}function Za(e){var t=ae(e),n=Ot(t),r=bt(n);return r===_d}function ei(t){var n=e.getThisContainer(t,!0),r=!1;if(145===n.kind){var a=n.parent,i=e.getClassExtendsHeritageClauseElement(a);if(i&&!Za(a)){var o=$a(n);(!o||o.end>t.pos)&&s(t,e.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class)}}switch(177===n.kind&&(n=e.getThisContainer(n,!1),r=2>Hl),n.kind){case 221:s(t,e.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body);break;case 220:s(t,e.Diagnostics.this_cannot_be_referenced_in_current_location);break;case 145:ni(t,n)&&s(t,e.Diagnostics.this_cannot_be_referenced_in_constructor_arguments);break;case 142:case 141:64&n.flags&&s(t,e.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer);break;case 137:s(t,e.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name)}if(r&&Qa(t,n),e.isClassLike(n.parent)){var c=ae(n.parent);return 64&n.flags?_t(c):Ot(c).thisType}if(e.isInJavaScriptFile(t)){var _=ti(n);if(_&&_!==ud)return _;if(176===n.kind&&3===e.getSpecialPropertyAssignmentKind(n.parent)){var u=n.parent.left.expression.expression,l=Ls(u).symbol;if(l&&l.members&&16&l.flags)return qo(l)}}return nd}function ti(t){var n=e.getJSDocTypeTag(t);if(n&&n.typeExpression&&n.typeExpression.type&&264===n.typeExpression.type.kind){var r=n.typeExpression.type;if(r.parameters.length>0&&267===r.parameters[0].type.kind)return Pr(r.parameters[0].type)}}function ni(e,t){for(var n=e;n&&n!==t;n=n.parent)if(139===n.kind)return!0;return!1}function ri(t){function n(t){return t?r?145===t.kind:e.isClassLike(t.parent)||168===t.parent.kind?64&t.flags?144===t.kind||143===t.kind||146===t.kind||147===t.kind:144===t.kind||143===t.kind||146===t.kind||147===t.kind||142===t.kind||141===t.kind||145===t.kind:!1:!1}var r=171===t.parent.kind&&t.parent.expression===t,a=e.getSuperContainer(t,!0),i=!1;if(!r)for(;a&&177===a.kind;)a=e.getSuperContainer(a,!0),i=2>Hl;var o=n(a),c=0;if(!o){for(var _=t;_&&_!==a&&137!==_.kind;)_=_.parent;return _&&137===_.kind?s(t,e.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name):r?s(t,e.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors):a&&a.parent&&(e.isClassLike(a.parent)||168===a.parent.kind)?s(t,e.Diagnostics.super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class):s(t,e.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions),ud}if(c=64&a.flags||r?512:256,h(t).flags|=c,144===a.kind&&256&a.flags&&(e.isSuperPropertyOrElementAccess(t.parent)&&Ni(t.parent)?h(a).flags|=4096:h(a).flags|=2048),i&&Qa(t.parent,a),168===a.parent.kind)return 2>Hl?(s(t,e.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher),ud):nd;var u=a.parent,l=Ot(ae(u)),d=l&&xt(l)[0];return d?145===a.kind&&ni(t,a)?(s(t,e.Diagnostics.super_cannot_be_referenced_in_constructor_arguments),ud):512===c?bt(l):d:(e.getClassExtendsHeritageClauseElement(u)||s(t,e.Diagnostics.super_can_only_be_referenced_in_a_derived_class),ud)}function ai(t){var n=t.parent;if((Ei(n)||e.isObjectLiteralMethod(n))&&Hr(n)){var r=Ai(n);if(r){var a=e.hasRestParameter(n),i=n.parameters.length-(a?1:0),o=e.indexOf(n.parameters,t);if(i>o)return Go(r,o);if(a&&o===n.parameters.length-1&&ga(r,n.parameters.length-1))return _t(e.lastOrUndefined(r.parameters))}}}function ii(t){var n=t.parent;if(t===n.initializer){if(n.type)return Pr(n.type);if(139===n.kind){var r=ai(n);if(r)return r}if(e.isBindingPattern(n.name))return et(n.name,!0)}}function oi(t){var n=e.getContainingFunction(t);return n&&!n.asteriskToken?_i(n):void 0}function si(t){var n=e.getContainingFunction(t);if(n){var r=_i(n);if(r)return t.asteriskToken?r:t_(r)}}function ci(t){for(;t.parent&&!e.isFunctionLike(t.parent);){if(139===t.parent.kind&&t.parent.initializer===t)return!0;t=t.parent}return!1}function _i(t){if(t.type||145===t.kind||146===t.kind&&e.getSetAccessorTypeAnnotationNode(e.getDeclarationOfKind(t.symbol,147)))return wn(Sn(t));var n=wi(t);return n?wn(n):void 0}function ui(t,n){var r=wo(t),a=e.indexOf(r,n);if(a>=0){var i=Uo(t);return Go(i,a)}}function li(e,t){return 173===e.parent.kind?ui(e.parent,t):void 0}function di(e){var t=e.parent,n=t.operatorToken.kind;if(n>=56&&68>=n){if(e===t.right)return Ls(t.left)}else{if(52===n){var r=Si(t);return r||e!==t.right||(r=Ls(t.left)),r}if((51===n||24===n)&&e===t.right)return Si(t)}}function pi(e,t){if(!(16384&e.flags))return t(e);for(var n,r,a=e.types,i=0,o=a;i<o.length;i++){var s=o[i],c=t(s);c&&(n?r?r.push(c):r=[n,c]:n=c)}return r?vr(r):n}function fi(e,t){return pi(e,function(e){var n=130048&e.flags?mn(e,t):void 0;return n?_t(n):void 0})}function mi(e,t){return pi(e,function(e){return hn(e,t)})}function gi(t){return!!(16384&t.flags?e.forEach(t.types,Ca):Ca(t))}function yi(t){return!!(16384&t.flags?e.forEach(t.types,xa):xa(t))}function hi(t,n){return!!(16384&t.flags?e.forEach(t.types,function(e){return hn(e,n)}):hn(t,n))}function vi(t){return e.Debug.assert(e.isObjectLiteralMethod(t)),Z_(t)?void 0:ki(t)}function ki(t){var n=t.parent,r=Di(n);if(r){if(!e.hasDynamicName(t)){var a=ae(t).name,i=fi(r,a);if(i)return i}return Fi(t.name)&&mi(r,1)||mi(r,0)}}function bi(t){var n=t.parent,r=Di(n);if(r){var a=e.indexOf(n.elements,t);return fi(r,""+a)||mi(r,1)||(Hl>=2?Zc(r,void 0):void 0)}}function xi(e){var t=e.parent;return e===t.whenTrue||e===t.whenFalse?Si(t):void 0}function Ci(t){var n=t.kind,r=t.parent,a=Yi(r);if(241===t.kind){if(!a||Ue(a))return;return Je(a,t.name.text)}return 242===t.kind?a:void e.Debug.fail("Expected JsxAttribute or JsxSpreadAttribute, got ts.SyntaxKind["+n+"]")}function Di(e){var t=Si(e);return t&&dn(t)}function Si(t){if(!Z_(t)){if(t.contextualType)return t.contextualType;var n=t.parent;switch(n.kind){case 214:case 139:case 142:case 141:case 166:return ii(t);case 177:case 207:return oi(t);case 187:return si(n);case 171:case 172:return ui(n,t);case 174:case 192:return Pr(n.type);case 184:return di(t);case 248:return ki(n);case 167:return bi(t);case 185:return xi(t);case 193:return e.Debug.assert(186===n.parent.kind),li(n.parent,t);case 175:return Si(n);case 243:return Si(n);case 241:case 242:return Ci(n)}}}function Ti(e){var t=gn(e,0);if(1===t.length){var n=t[0];if(!n.typeParameters)return n}}function Ei(e){return 176===e.kind||177===e.kind}function wi(t){return Ei(t)||e.isObjectLiteralMethod(t)?Ai(t):void 0}function Ai(t){e.Debug.assert(144!==t.kind||e.isObjectLiteralMethod(t));var n=e.isObjectLiteralMethod(t)?vi(t):Di(t);if(n){if(!(16384&n.flags))return Ti(n);for(var r,a=n.types,i=0,o=a;i<o.length;i++){var s=o[i],c=Ti(s);if(c)if(r){if(!ma(r[0],c,!1,!0,Yr))return;r.push(c)}else r=[c]}var _;return r&&(_=Ht(r[0]),_.resolvedReturnType=void 0,_.unionSignatures=r),_}}function Pi(e){return e&&e.context}function Ni(e){var t=e.parent;return 184===t.kind&&56===t.operatorToken.kind&&t.left===e?!0:248===t.kind?Ni(t.parent):167===t.kind?Ni(t):!1}function Oi(e,t){var n=Os(e.expression,t);return Yc(n,e.expression,!1)}function Ri(e){return 166===e.kind&&!!e.initializer||184===e.kind&&56===e.operatorToken.kind}function Ii(t,n){for(var r=t.elements,a=!1,i=[],o=Ni(t),c=0,_=r;c<_.length;c++){var u=_[c];if(o&&188===u.kind){var l=Ls(u.expression,n),d=vn(l,1)||(Hl>=2?Zc(l,void 0):void 0);d&&i.push(d)}else{var p=Ls(u,n);i.push(p)}a=a||188===u.kind}if(!a){if(o&&i.length){var p=lr(i);return p.pattern=t,p}var f=Di(t);if(f&&yi(f)){var m=f.pattern;if(m&&(165===m.kind||167===m.kind))for(var g=m.elements,y=i.length;y<g.length;y++){var h=g[y];Ri(h)?i.push(f.elementTypes[y]):(190!==h.kind&&s(h,e.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value),i.push(ud))}if(i.length)return ur(i)}}return cr(i.length?vr(i):cd)}function Fi(e){return 137===e.kind?Li(e):Bi(e.text)}function Li(e){return Mi(zi(e),132)}function Mi(e,t){return Ue(e)||ms(e,t)}function Bi(e){return(+e).toString()===e}function zi(t){var n=h(t.expression);return n.resolvedType||(n.resolvedType=Ls(t.expression),Mi(n.resolvedType,16777606)?yo(t.expression,n.resolvedType,!0):s(t,e.Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any)),n.resolvedType}function Ki(t,n){function r(n){if(_&&hi(_,n)){for(var r=[],a=0;a<o.length;a++){var i=t.properties[a];if(0===n||Fi(i.name)){var s=_t(o[a]);e.contains(r,s)||r.push(s)}}var c=r.length?vr(r):cd;return l|=c.flags,c}}var a=Ni(t);dl(t,a);for(var i={},o=[],_=Di(t),u=_&&_.pattern&&(164===_.pattern.kind||168===_.pattern.kind),l=0,d=!1,p=0,f=t.properties;p<f.length;p++){var m=f[p],g=m.symbol;if(248===m.kind||249===m.kind||e.isObjectLiteralMethod(m)){var y=void 0;248===m.kind?y=Rs(m,n):144===m.kind?y=Is(m,n):(e.Debug.assert(249===m.kind),y=Ls(m.name,n)),l|=y.flags;var h=c(67108868|g.flags,g.name);if(a){var v=248===m.kind&&Ri(m.initializer)||249===m.kind&&m.objectAssignmentInitializer;v&&(h.flags|=536870912),e.hasDynamicName(m)&&(d=!0)}else if(u&&!(67108864&_.flags)){var k=mn(_,g.name);k?h.flags|=536870912&k.flags:Vl.suppressExcessPropertyErrors||s(m.name,e.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1,Ee(g),Ae(_))}h.declarations=g.declarations,h.parent=g.parent,g.valueDeclaration&&(h.valueDeclaration=g.valueDeclaration),h.type=y,h.target=g,g=h}else e.Debug.assert(146===m.kind||147===m.kind),Ys(m);e.hasDynamicName(m)||(i[g.name]=g),o.push(g)}if(u)for(var b=0,x=un(_);b<x.length;b++){var h=x[b];e.hasProperty(i,h.name)||(536870912&h.flags||s(h.valueDeclaration||h.bindingElement,e.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value),i[h.name]=h,o.push(h))}var C=r(0),D=r(1),S=me(t.symbol,i,ql,ql,C,D),T=Vl.suppressExcessPropertyErrors?0:1048576;return S.flags|=4718592|T|14680064&l|(d?67108864:0),a&&(S.pattern=t),S}function ji(e){return no(e),Ud||nd}function Ji(e){no(e.openingElement),Gi(e.closingElement);for(var t=0,n=e.children;t<n.length;t++){var r=n[t];switch(r.kind){case 243:ro(r);break;case 236:Ji(r);break;case 237:ji(r)}}return Ud||nd}function Ui(e){return e.indexOf("-")<0}function qi(t){return 136===t.kind?!1:e.isIntrinsicJsxName(t.text)}function Wi(t,n,r){var a=void 0;if(n===ld&&Ui(t.name.text))s(t.parent,e.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property,Qi());else if(n&&!Ue(n)){var i=mn(n,t.name.text);if(a=i&&_t(i),Ui(t.name.text)){var o=vn(n,0);if(o)a=o;else if(!a)return s(t.name,e.Diagnostics.Property_0_does_not_exist_on_type_1,t.name.text,Ae(n)),ud}}var c;return c=t.initializer?Ls(t.initializer):id,a&&na(c,a,t),r[t.name.text]=!0,c}function Vi(t,n,r){for(var a=Ls(t.expression),i=un(a),o=0,s=i;o<s.length;o++){var c=s[o];if(!r[c.name]){var _=mn(n,c.name);if(_){var u=e.chainDiagnosticMessages(void 0,e.Diagnostics.Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property,c.name);na(_t(c),_t(_),t,void 0,u)}r[c.name]=!0}}return a}function Hi(e){return void 0===up[e]?up[e]=nr(lp.JSX,e)||ud:up[e]}function Gi(t){function n(t){var n=Hi(lp.IntrinsicElements);if(n!==ud){var r=mn(n,t.tagName.text);if(r)return i.jsxFlags|=1,r;var a=vn(n,0);return a?(i.jsxFlags|=2,n.symbol):(s(t,e.Diagnostics.Property_0_does_not_exist_on_type_1,t.tagName.text,"JSX."+lp.IntrinsicElements),ed)}return Vl.noImplicitAny&&s(t,e.Diagnostics.JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists,lp.IntrinsicElements),ed}function r(e){var t=a(e);return t&&t!==ed&&(i.jsxFlags|=4,8388608&t.flags&&U(t)),t||ed}function a(e){if(69===e.tagName.kind){var t=e.tagName,n=Ka(t);return n.exportSymbol||n}return co(e.tagName).symbol}var i=h(t);return i.resolvedSymbol||(qi(t.tagName)?i.resolvedSymbol=n(t):i.resolvedSymbol=r(t)),i.resolvedSymbol}function Xi(t){e.Debug.assert(!!(4&h(t).jsxFlags),"Should not call getJsxElementInstanceType on non-class Element");var n=Gi(t);if(n===ed)return nd;var r=_t(n);if(Ue(r))return nd;var a=yn(r,1);return 0===a.length&&(a=yn(r,0),0===a.length)?(s(t.tagName,e.Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures,e.getTextOfNode(t.tagName)),ud):vr(a.map(wn))}function Qi(){var t=er(lp.JSX,1536,void 0),n=t&&k(t.exports,lp.ElementAttributesPropertyNameContainer,793056),r=n&&Ot(n),a=r&&un(r);return a?0===a.length?"":1===a.length?a[0].name:void s(n.declarations[0],e.Diagnostics.The_global_type_JSX_0_may_not_have_more_than_one_property,lp.ElementAttributesPropertyNameContainer):void 0}function Yi(t){var n=h(t);if(!n.resolvedJsxType){var r=Gi(t);if(4&n.jsxFlags){var a=Xi(t),i=Zi();if(!i||!ea(a,i)){var o=_t(r),c=o&&yn(o,0),_=c&&c.length>0&&c[0],u=_&&wn(_),l=u&&(0===_.parameters.length?ld:_t(_.parameters[0]));if(u&&ea(u,Ud)){var d=Hi(lp.IntrinsicAttributes);return d!==ud&&(l=nn(d,l)),n.resolvedJsxType=l}}if(i&&_a(a,i,pp,t,e.Diagnostics.JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements),Ue(a))return n.resolvedJsxType=a;var p=Qi();if(void 0===p)return n.resolvedJsxType=nd;if(""===p)return n.resolvedJsxType=a;var f=Je(a,p);if(f){if(Ue(f)||f===ud)return n.resolvedJsxType=f;if(16384&f.flags)return s(t.tagName,e.Diagnostics.JSX_element_attributes_type_0_may_not_be_a_union_type,Ae(f)),n.resolvedJsxType=nd;var m=f,g=Hi(lp.IntrinsicClassAttributes);if(g!==ud){var y=mt(g.symbol);y?1===y.length&&(m=nn(Jn(g,[a]),m)):m=nn(f,g)}var v=Hi(lp.IntrinsicAttributes);return v!==ud&&(m=nn(v,m)),n.resolvedJsxType=m}return n.resolvedJsxType=ld}return 1&n.jsxFlags?n.resolvedJsxType=_t(r):2&n.jsxFlags?n.resolvedJsxType=Fn(r,0):n.resolvedJsxType=nd}return n.resolvedJsxType}function $i(e){var t=Yi(e.parent),n=mn(t,e.name.text);return n||ed}function Zi(){return jd||(jd=nr(lp.JSX,lp.ElementClass)),jd}function eo(){var e=Hi(lp.IntrinsicElements);return e?un(e):ql}function to(t){0===(Vl.jsx||0)&&s(t,e.Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided),void 0===Ud&&Vl.noImplicitAny&&s(t,e.Diagnostics.JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist)}function no(t){pl(t),to(t);var n=2===Vl.jsx?e.Diagnostics.Cannot_find_name_0:void 0,r=Vl.reactNamespace?Vl.reactNamespace:"React",a=C(t.tagName,r,107455,n,r);a&&(y(a).referenced=!0);for(var i=Yi(t),o={},c=!1,_=t.attributes.length-1;_>=0;_--)if(241===t.attributes[_].kind)Wi(t.attributes[_],i,o);else{e.Debug.assert(242===t.attributes[_].kind);var u=Vi(t.attributes[_],i,o);Ue(u)&&(c=!0)}if(i&&!c)for(var l=un(i),_=0;_<l.length;_++)536870912&l[_].flags||void 0!==o[l[_].name]||s(t,e.Diagnostics.Property_0_is_missing_in_type_1,l[_].name,Ae(i))}function ro(e){return e.expression?Ls(e.expression):ud}function ao(e){return e.valueDeclaration?e.valueDeclaration.kind:142}function io(t){return t.valueDeclaration?e.getCombinedNodeFlags(t.valueDeclaration):134217728&t.flags?72:0}function oo(t,n,r,a){var i=io(a),o=Ot(ie(a));if(95===n.kind){var c=169===t.kind?t.name:t.right;if(2>Hl&&144!==ao(a))return s(c,e.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword),!1;if(128&i)return s(c,e.Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression,Ee(a),Ae(o)),!1}if(!(48&i))return!0;var _=e.getContainingClass(t),u=_?Ot(ae(_)):void 0;return 16&i?o!==u?(s(t,e.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1,Ee(a),Ae(o)),!1):!0:95===n.kind?!0:u&<(u,o)?64&i?!0:(33554432&r.flags&&(r=Bn(r)),3072&ut(r).flags&<(r,u)?!0:(s(t,e.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1,Ee(a),Ae(u)),!1)):(s(t,e.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses,Ee(a),Ae(o)),!1)}function so(e){return _o(e,e.expression,e.name)}function co(e){return _o(e,e.left,e.right)}function _o(t,n,r){var a=Ls(n);if(Ue(a))return a;var i=dn(Ea(a));if(i===ud)return ud;var o=mn(i,r.text);return o?(h(t).resolvedSymbol=o,o.parent&&32&o.parent.flags&&oo(t,n,i,o),_t(o)):(r.text&&s(r,e.Diagnostics.Property_0_does_not_exist_on_type_1,e.declarationNameToString(r),Ae(33554432&a.flags?i:a)),ud)}function uo(e,t){var n=169===e.kind?e.expression:e.left,r=Ls(n);if(r!==ud&&!Ue(r)){var a=mn(Ea(r),t);if(a&&a.parent&&32&a.parent.flags)return oo(e,n,r,a)}return!0}function lo(t){var n=t.initializer;if(215===n.kind){var r=n.declarations[0];if(r&&!e.isBindingPattern(r.name))return ae(r)}else if(69===n.kind)return Ka(n)}function po(e){return vn(e,1)&&!vn(e,0)}function fo(e){var t=Wa(e);if(69===t.kind){var n=Ka(t);if(3&n.flags)for(var r=e,a=e.parent;a;){if(203===a.kind&&r===a.statement&&lo(a)===n&&po(Ls(a.expression)))return!0;r=a,a=a.parent}}return!1}function mo(t){if(!t.argumentExpression){var n=e.getSourceFileOfNode(t);if(172===t.parent.kind&&t.parent.expression===t){var r=e.skipTrivia(n.text,t.expression.end),a=t.end;El(n,r,a-r,e.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead)}else{var r=t.end-"]".length,a=t.end;El(n,r,a-r,e.Diagnostics.Expression_expected)}}var i=dn(Ls(t.expression)),o=t.argumentExpression?Ls(t.argumentExpression):ud;if(i===ud)return ud;var c=gs(i);if(c&&(!t.argumentExpression||9!==t.argumentExpression.kind))return s(t.argumentExpression,e.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal),ud;if(t.argumentExpression){var _=go(t.argumentExpression,o);if(void 0!==_){var u=mn(i,_);if(u)return h(t).resolvedSymbol=u,_t(u);if(c)return s(t.argumentExpression,e.Diagnostics.Property_0_does_not_exist_on_const_enum_1,_,Ee(i.symbol)),ud}}if(Mi(o,16777606)){if(Mi(o,132)||fo(t.argumentExpression)){var l=vn(i,1);if(l)return l}var d=vn(i,0);return d?d:(!Vl.noImplicitAny||Vl.suppressImplicitAnyIndexErrors||Ue(i)||s(t,vn(i,1)?e.Diagnostics.Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number:e.Diagnostics.Index_signature_of_object_type_implicitly_has_an_any_type),nd)}return s(t,e.Diagnostics.An_index_expression_argument_must_be_of_type_string_number_symbol_or_any),ud}function go(t,n){if(9===t.kind||8===t.kind)return t.text;if(170===t.kind||169===t.kind){var r=Nu(t);if(void 0!==r)return r.toString()}if(yo(t,n,!1)){var a=t.name.text;return e.getPropertyNameForKnownSymbolName(a)}}function yo(t,n,r){if(n===ud)return!1;if(!e.isWellKnownSymbolSyntactically(t))return!1;if(0===(16777216&n.flags))return r&&s(t,e.Diagnostics.A_computed_property_name_of_the_form_0_must_be_of_type_symbol,e.getTextOfNode(t)),!1;var a=t.expression,i=Ka(a);if(!i)return!1;var o=rr();return o?i!==o?(r&&s(a,e.Diagnostics.Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object),!1):!0:!1}function ho(t){return 173===t.kind?Ls(t.template):140!==t.kind&&e.forEach(t.arguments,function(e){Ls(e)}),Hd}function vo(e){return ho(e),Gd}function ko(t,n){var r,a,i,o,s=0,c=-1;e.Debug.assert(!n.length);for(var _=0,u=t;_<u.length;_++){var l=u[_],d=l.declaration&&ae(l.declaration),p=l.declaration&&l.declaration.parent;a&&d!==a?(i=s=n.length,r=p):r&&p===r?i++:(r=p,i=s),a=d,l.hasStringLiterals?(c++,o=c,s++):o=i,n.splice(o,0,l)}}function bo(e){for(var t=0;t<e.length;t++){var n=e[t];if(n&&188===n.kind)return t}return-1}function xo(t,n,r){var a,i,o,s,c=-1;if(173===t.kind){var _=t;if(a=n.length,i=void 0,186===_.template.kind){var u=_.template,l=e.lastOrUndefined(u.templateSpans);e.Debug.assert(void 0!==l),o=e.nodeIsMissing(l.literal)||!!l.literal.isUnterminated}else{var d=_.template;e.Debug.assert(11===d.kind),o=!!d.isUnterminated}}else if(140===t.kind)s=!0,i=void 0,a=Ao(t,void 0,r);else{var p=t;if(!p.arguments)return e.Debug.assert(172===p.kind),0===r.minArgumentCount;a=p.arguments.hasTrailingComma?n.length+1:n.length,o=p.arguments.end===p.end,i=p.typeArguments,c=bo(n)}var f=!i||r.typeParameters&&i.length===r.typeParameters.length;if(!f)return!1;if(c>=0)return ga(r,c);if(!r.hasRestParameter&&a>r.parameters.length)return!1;var m=a>=r.minArgumentCount;return o||m}function Co(e){if(80896&e.flags){var t=on(e);if(1===t.callSignatures.length&&0===t.constructSignatures.length&&0===t.properties.length&&!t.stringIndexType&&!t.numberIndexType)return t.callSignatures[0]}}function Do(e,t,n){var r=Oa(e.typeParameters,!0);return Na(t,e,function(e,t){Ia(r,Vr(e,n),t)}),Pn(e,za(r))}function So(e,t,n,r,a){for(var i=t.typeParameters,o=Br(a),s=0;s<i.length;s++)a.inferences[s].isFixed||(a.inferredTypes[s]=void 0);void 0===a.failedTypeParameterIndex||a.inferences[a.failedTypeParameterIndex].isFixed||(a.failedTypeParameterIndex=void 0);for(var c=Ao(e,n,t),s=0;c>s;s++){var _=Fo(e,n,s);if(void 0===_||190!==_.kind){var u=Go(t,s),l=Io(e,s,_);if(void 0===l){var d=r&&void 0!==r[s]?zr:o;l=Ns(_,u,d)}Ia(a,l,u)}}if(r)for(var s=0;c>s;s++)if(r[s]===!1){var _=n[s],u=Go(t,s);Ia(a,Ns(_,u,o),u)}za(a)}function To(t,n,r,a,i){for(var o,s=t.typeParameters,c=!0,_=0;_<s.length;_++)if(c){var u=Bn(s[_]);if(u){var l=void 0,d=e.Diagnostics.Type_0_does_not_satisfy_the_constraint_1;a&&i&&(l=e.chainDiagnosticMessages(l,d),d=i),o||(o=Ir(s,r));var p=r[_];c=na(p,Jt(Vr(u,o),p),a?n[_]:void 0,d,l)}}return c}function Eo(t,n,r,a,i,o){for(var s=Ao(t,n,r),c=0;s>c;c++){var _=Fo(t,n,c);if(void 0===_||190!==_.kind){var u=Go(r,c),l=Io(t,c,_);void 0===l&&(l=9!==_.kind||o?Ns(_,u,i&&i[c]?zr:void 0):Dr(_.text));var d=o?Lo(t,c,_):void 0,p=e.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1;if(!_a(l,u,a,d,p))return!1}}return!0}function wo(t){var n;if(173===t.kind){var r=t.template;n=[void 0],186===r.kind&&e.forEach(r.templateSpans,function(e){n.push(e.expression)})}else{if(140===t.kind)return;n=t.arguments||ql}return n}function Ao(e,t,n){if(140!==e.kind)return t.length;switch(e.parent.kind){case 217:case 189:return 1;case 142:return 2;case 144:case 146:case 147:return 0===Hl?2:n.parameters.length>=3?3:2;case 139:return 3}}function Po(t){if(217===t.kind){var n=ae(t);return _t(n)}if(139===t.kind&&(t=t.parent,145===t.kind)){var n=ae(t);return _t(n)}return 142===t.kind||144===t.kind||146===t.kind||147===t.kind?pu(t):(e.Debug.fail("Unsupported decorator target."),ud)}function No(t){if(217===t.kind)return e.Debug.fail("Class decorators should not have a second synthetic argument."),ud;if(139===t.kind&&(t=t.parent,145===t.kind))return nd;if(142===t.kind||144===t.kind||146===t.kind||147===t.kind){var n=t;switch(n.name.kind){case 69:case 8:case 9:return Dr(n.name.text);case 137:var r=zi(n.name);return ms(r,16777216)?r:rd;default:return e.Debug.fail("Unsupported property name."),ud}}return e.Debug.fail("Unsupported decorator target."),ud}function Oo(t){if(217===t.kind)return e.Debug.fail("Class decorators should not have a third synthetic argument."),ud;if(139===t.kind)return ad;if(142===t.kind)return e.Debug.fail("Property decorators should not have a third synthetic argument."),ud;if(144===t.kind||146===t.kind||147===t.kind){var n=lu(t);return ar(n)}return e.Debug.fail("Unsupported decorator target."),ud}function Ro(t,n){return 0===n?Po(t.parent):1===n?No(t.parent):2===n?Oo(t.parent):(e.Debug.fail("Decorators should not have a fourth synthetic argument."),ud)}function Io(e,t,n){return 140===e.kind?Ro(e,t):0===t&&173===e.kind?Dd:void 0}function Fo(e,t,n){return 140===e.kind||0===n&&173===e.kind?void 0:t[n]}function Lo(e,t,n){return 140===e.kind?e.expression:0===t&&173===e.kind?e.template:n}function Mo(t,n,r,i){function o(n,r,a,o){var s;s=e.chainDiagnosticMessages(s,n,r,a,o),i&&(s=e.chainDiagnosticMessages(s,i)),cp.add(e.createDiagnosticForNodeFromMessageChain(t,s))}function s(n,r){for(var a=0,i=n;a<i.length;a++){var o=i[a];if(xo(t,p,o)){for(var s=void 0,_=void 0,u=o.typeParameters?Oa(o.typeParameters,!1):void 0;;){if(s=o,s.typeParameters){var l=void 0;if(c?(l=e.map(c,Pr),_=To(s,c,l,!1)):(So(t,s,p,d,u),_=void 0===u.failedTypeParameterIndex,l=u.inferredTypes),!_)break;s=Pn(s,l)}if(!Eo(t,p,s,r,d,!1))break;var f=d?e.indexOf(d,!0):-1;if(0>f)return s;d[f]=!1}if(o.typeParameters){var h=s;_?m=h:(g=o,c||(y=u))}else e.Debug.assert(o===s),m=o}}}var c,_=173===t.kind,u=140===t.kind;_||u||(c=t.typeArguments,
95!==t.expression.kind&&e.forEach(c,q_));var l=r||[];if(ko(n,l),!l.length)return o(e.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target),vo(t);var d,p=wo(t);if(!u)for(var f=_?1:0;f<p.length;f++)Hr(p[f])&&(d||(d=new Array(p.length)),d[f]=!0);var m,g,y,h;if(l.length>1&&(h=s(l,dp)),h||(m=void 0,g=void 0,y=void 0,h=s(l,pp)),h)return h;if(m)Eo(t,p,m,pp,void 0,!0);else if(g)if(_||u||!c){e.Debug.assert(y.failedTypeParameterIndex>=0);var v=g.typeParameters[y.failedTypeParameterIndex],k=Ma(y,y.failedTypeParameterIndex),b=e.chainDiagnosticMessages(void 0,e.Diagnostics.The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly,Ae(v));i&&(b=e.chainDiagnosticMessages(b,i)),va(k,t.expression||t.tag,b)}else{var x=t.typeArguments;To(g,x,e.map(x,Pr),!0,i)}else o(e.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target);if(!a)for(var C=0,D=l;C<D.length;C++){var S=D[C];if(xo(t,p,S))return S.typeParameters&&c&&(S=Pn(S,e.map(c,Pr))),S}return vo(t)}function Bo(t,n){if(95===t.expression.kind){var r=ri(t.expression);if(r!==ud){var a=e.getClassExtendsHeritageClauseElement(e.getContainingClass(t)),i=kt(r,a.typeArguments);return Mo(t,i,n)}return ho(t)}var o=Ls(t.expression),c=dn(o);if(c===ud)return vo(t);var _=yn(c,0),u=yn(c,1);return Ue(o)||!(_.length||u.length||16384&o.flags)&&ea(o,hd)?(o!==ud&&t.typeArguments&&s(t,e.Diagnostics.Untyped_function_calls_may_not_accept_type_arguments),ho(t)):_.length?Mo(t,_,n):(u.length?s(t,e.Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new,Ae(o)):s(t,e.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature),vo(t))}function zo(t,n){if(t.arguments&&1>Hl){var r=bo(t.arguments);r>=0&&s(t.arguments[r],e.Diagnostics.Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher)}var a=Ls(t.expression);if(a=dn(a),a===ud)return vo(t);var i=a.symbol&&v_(a.symbol);if(i&&128&i.flags)return s(t,e.Diagnostics.Cannot_create_an_instance_of_the_abstract_class_0,e.declarationNameToString(i.name)),vo(t);if(Ue(a))return t.typeArguments&&s(t,e.Diagnostics.Untyped_function_calls_may_not_accept_type_arguments),ho(t);var o=yn(a,1);if(o.length)return Mo(t,o,n);var c=yn(a,0);if(c.length){var _=Mo(t,c,n);return wn(_)!==sd&&s(t,e.Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword),_}return s(t,e.Diagnostics.Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature),vo(t)}function Ko(t,n){var r=Ls(t.tag),a=dn(r);if(a===ud)return vo(t);var i=yn(a,0);return Ue(r)||!i.length&&!(16384&r.flags)&&ea(r,hd)?ho(t):i.length?Mo(t,i,n):(s(t,e.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature),vo(t))}function jo(t){switch(t.parent.kind){case 217:case 189:return e.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression;case 139:return e.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression;case 142:return e.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression;case 144:case 146:case 147:return e.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression}}function Jo(t,n){var r=Ls(t.expression),a=dn(r);if(a===ud)return vo(t);var i=yn(a,0);if(r===nd||!i.length&&!(16384&r.flags)&&ea(r,hd))return ho(t);var o=jo(t);if(!i.length){var s=void 0;return s=e.chainDiagnosticMessages(s,e.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature),s=e.chainDiagnosticMessages(s,o),cp.add(e.createDiagnosticForNodeFromMessageChain(t,s)),vo(t)}return Mo(t,i,n,o)}function Uo(t,n){var r=h(t);return r.resolvedSignature&&!n||(r.resolvedSignature=Hd,171===t.kind?r.resolvedSignature=Bo(t,n):172===t.kind?r.resolvedSignature=zo(t,n):173===t.kind?r.resolvedSignature=Ko(t,n):140===t.kind?r.resolvedSignature=Jo(t,n):e.Debug.fail("Branch in 'getResolvedSignature' should be unreachable.")),r.resolvedSignature}function qo(e){var t=y(e);return t.inferredClassType||(t.inferredClassType=me(void 0,e.members,ql,ql,void 0,void 0)),t.inferredClassType}function Wo(t){rl(t,t.typeArguments)||il(t,t.arguments);var n=Uo(t);if(95===t.expression.kind)return sd;if(172===t.kind){var r=n.declaration;if(r&&145!==r.kind&&149!==r.kind&&154!==r.kind&&!e.isJSDocConstructSignature(r)){var a=Ls(t.expression).symbol;return a&&a.members&&16&a.flags?qo(a):(Vl.noImplicitAny&&s(t,e.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type),nd)}}return e.isInJavaScriptFile(t)&&e.isRequireCall(t,!0)?En(t.arguments[0]):wn(n)}function Vo(e){return wn(Uo(e))}function Ho(t){var n=Sa(Ls(t.expression)),r=Pr(t.type);if(a&&r!==ud){var i=Ea(n),o=fs(r,258)&&fs(i,258);o||ea(r,i)||na(n,r,t,e.Diagnostics.Neither_type_0_nor_type_1_is_assignable_to_the_other)}return r}function Go(e,t){return e.hasRestParameter?t<e.parameters.length-1?_t(e.parameters[t]):An(e):t<e.parameters.length?_t(e.parameters[t]):nd}function Xo(t,n,r){for(var a=t.parameters.length-(t.hasRestParameter?1:0),i=0;a>i;i++){var o=t.parameters[i],s=Go(n,i);Yo(o,s,r)}if(t.hasRestParameter&&ga(n,t.parameters.length-1)){var o=e.lastOrUndefined(t.parameters),s=_t(e.lastOrUndefined(n.parameters));Yo(o,s,r)}}function Qo(t){if(e.isBindingPattern(t.name))for(var n=0,r=t.name.elements;n<r.length;n++){var a=r[n];190!==a.kind&&(69===a.name.kind&&(y(ae(a)).type=He(a)),Qo(a))}}function Yo(e,t,n){var r=y(e);r.type?Pi(n)&&Ia(n.context,r.type,Vr(t,n)):(r.type=Vr(t,n),Qo(e.valueDeclaration))}function $o(t){var n=e.getJSDocReturnTag(t);return n&&n.typeExpression?Pr(n.typeExpression.type):void 0}function Zo(e){var t=Fd();return t!==pd?(e=mc(e),Jn(t,[e])):ld}function es(t,n){var r=wi(t);if(!t.body)return ud;var a,i=e.isAsyncFunctionLike(t);if(195!==t.body.kind)a=Os(t.body,n),i&&(a=gc(a,t,e.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member));else{var o=void 0,c=!!t.asteriskToken;if(c){if(o=ts(t.body,n),0===o.length){var _=sr(nd);return Vl.noImplicitAny&&s(t.asteriskToken,e.Diagnostics.Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type,Ae(_)),_}}else if(o=ns(t.body,n,i),0===o.length){if(i){var u=Zo(sd);return u===ld?(s(t,e.Diagnostics.An_async_function_or_method_must_have_a_valid_awaitable_return_type),ud):u}return sd}if(a=r?vr(o):ha(o),!a)return c?(s(t,e.Diagnostics.No_best_common_type_exists_among_yield_expressions),sr(ud)):(s(t,e.Diagnostics.No_best_common_type_exists_among_return_expressions),vr(o));c&&(a=sr(a))}r||Pa(t,a);var l=Ea(a);if(i){var u=Zo(l);return u===ld?(s(t,e.Diagnostics.An_async_function_or_method_must_have_a_valid_awaitable_return_type),ud):u}return l}function ts(t,n){var r=[];return e.forEachYieldExpression(t,function(t){var a=t.expression;if(a){var i=Os(a,n);t.asteriskToken&&(i=$c(i,t.expression)),e.contains(r,i)||r.push(i)}}),r}function ns(t,n,r){var a=[];return e.forEachReturnStatement(t,function(i){var o=i.expression;if(o){var s=Os(o,n);r&&(s=gc(s,t.parent,e.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member)),e.contains(a,s)||a.push(s)}}),a}function rs(t,n){if(a&&!(n===sd||Ue(n)||n&&16384&n.flags&&fs(n,17))&&!e.nodeIsMissing(t.body)&&195===t.body.kind&&524288&t.flags){var r=1048576&t.flags;if(n&&!r)s(t.type,e.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value);else if(Vl.noImplicitReturns){if(!n){var i=r?wn(Sn(t)):sd;if(i===sd||Ue(i))return}s(t.type||t,e.Diagnostics.Not_all_code_paths_return_a_value)}}}function as(t,n){e.Debug.assert(144!==t.kind||e.isObjectLiteralMethod(t));var r=Yu(t);if(r||176!==t.kind||ul(t),n===zr&&Hr(t))return W_(t),fd;var i=h(t),o=_t(t.symbol),s=Hr(t),c=s&&Pi(n);if(c||!(1024&i.flags)){var _=Ai(t),u=!!(1024&i.flags);if(c||!u){if(i.flags|=1024,_){var l=yn(o,0)[0];if(s&&Xo(l,_,n||zr),c||!t.type&&!l.resolvedReturnType){var d=es(t,n);l.resolvedReturnType||(l.resolvedReturnType=d)}}u||(Vs(t),W_(t))}}return a&&144!==t.kind&&143!==t.kind&&(Oc(t,t.name),Pc(t,t.name)),o}function is(t){e.Debug.assert(144!==t.kind||e.isObjectLiteralMethod(t));var n=e.isAsyncFunctionLike(t),r=t.type&&(n?hc(t):Pr(t.type));if(t.asteriskToken||rs(t,r),t.body)if(t.type||wn(Sn(t)),195===t.body.kind)q_(t.body);else{var a=Ls(t.body);if(r)if(n){var i=gc(a,t.body,e.Diagnostics.Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member);na(i,r,t.body)}else na(a,r,t.body)}}function os(e,t,n){return Mi(t,132)?!0:(s(e,n),!1)}function ss(e,t,n){function r(e){var t=h(e).resolvedSymbol;return t&&oe(t)}function a(e){switch(e.kind){case 69:var t=r(e);return!t||t===ed||t===$l||0!==(3&t.flags);case 169:var t=r(e);return!t||t===ed||0!==(-9&t.flags);case 170:return!0;case 175:return a(e.expression);default:return!1}}function i(e){switch(e.kind){case 69:case 169:var t=r(e);return t&&0!==(3&t.flags)&&0!==(16384&io(t));case 170:var n=e.argumentExpression,t=r(e.expression);if(t&&n&&9===n.kind){var a=n.text,o=mn(_t(t),a);return o&&0!==(3&o.flags)&&0!==(16384&io(o))}return!1;case 175:return i(e.expression);default:return!1}}return a(e)?i(e)?(s(e,n),!1):!0:(s(e,t),!1)}function cs(e){return Ls(e.expression),id}function _s(e){return Ls(e.expression),rd}function us(e){return Ls(e.expression),cd}function ls(t){a&&(8&t.parserContextFlags||Tl(t,e.Diagnostics.await_expression_is_only_allowed_within_an_async_function),ci(t)&&s(t,e.Diagnostics.await_expressions_cannot_be_used_in_a_parameter_initializer));var n=Ls(t.expression);return gc(n,t)}function ds(t){var n=Ls(t.operand);switch(t.operator){case 35:case 36:case 50:return fs(n,16777216)&&s(t.operand,e.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol,e.tokenToString(t.operator)),ad;case 49:return id;case 41:case 42:var r=os(t.operand,n,e.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type);return r&&ss(t.operand,e.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer,e.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant),ad}return ud}function ps(t){var n=Ls(t.operand),r=os(t.operand,n,e.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type);return r&&ss(t.operand,e.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer,e.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant),ad}function fs(e,t){if(e.flags&t)return!0;if(49152&e.flags){for(var n=e.types,r=0,a=n;r<a.length;r++){var i=a[r];if(i.flags&t)return!0}return!1}return!1}function ms(e,t){if(e.flags&t)return!0;if(49152&e.flags){for(var n=e.types,r=0,a=n;r<a.length;r++){var i=a[r];if(!(i.flags&t))return!1}return!0}return!1}function gs(e){return 80896&e.flags&&e.symbol&&ys(e.symbol)}function ys(e){return 0!==(128&e.flags)}function hs(t,n,r,a){return ms(r,16777726)&&s(t,e.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter),Ue(a)||Zr(a,hd)||s(n,e.Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type),id}function vs(t,n,r,a){return Mi(r,16777606)||s(t,e.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol),Mi(a,81408)||s(n,e.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter),id}function ks(t,n,r){for(var a=t.properties,i=0,o=a;i<o.length;i++){var c=o[i];if(248===c.kind||249===c.kind){var _=c.name;if(137===_.kind&&zi(_),Ve(_))continue;var u=We(_),l=Ue(n)?n:Je(n,u)||Bi(u)&&vn(n,1)||vn(n,0);l?249===c.kind?xs(c,l):xs(c.initializer,l):s(_,e.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature,Ae(n),e.declarationNameToString(_))}else s(c,e.Diagnostics.Property_assignment_expected)}return n}function bs(t,n,r){for(var a=Yc(n,t,!1)||ud,i=t.elements,o=0;o<i.length;o++){var c=i[o];if(190!==c.kind)if(188!==c.kind){var _=""+o,u=Ue(n)?n:xa(n)?Je(n,_):a;u?xs(c,u,r):Da(n)?s(c,e.Diagnostics.Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2,Ae(n),n.elementTypes.length,i.length):s(c,e.Diagnostics.Type_0_has_no_property_1,Ae(n),_)}else if(o<i.length-1)s(c,e.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern);else{var l=c.expression;184===l.kind&&56===l.operatorToken.kind?s(l.operatorToken,e.Diagnostics.A_rest_element_cannot_have_an_initializer):xs(l,cr(a),r)}}return n}function xs(e,t,n){var r;if(249===e.kind){var a=e;a.objectAssignmentInitializer&&Ss(a.name,a.equalsToken,a.objectAssignmentInitializer,n),r=e.name}else r=e;return 184===r.kind&&56===r.operatorToken.kind&&(Ds(r,n),r=r.left),168===r.kind?ks(r,t,n):167===r.kind?bs(r,t,n):Cs(r,t,n)}function Cs(t,n,r){var a=Ls(t,r);return ss(t,e.Diagnostics.Invalid_left_hand_side_of_assignment_expression,e.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant)&&na(n,a,t,void 0),n}function Ds(e,t){return Ss(e.left,e.operatorToken,e.right,t,e)}function Ss(t,n,r,i,o){function c(n){var a=fs(p,16777216)?t:fs(f,16777216)?r:void 0;return a?(s(a,e.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol,e.tokenToString(n)),!1):!0}function _(e){switch(e){case 47:case 67:return 52;case 48:case 68:return 33;case 46:case 66:return 51;default:return}}function u(n){if(a&&d>=56&&68>=d){var r=ss(t,e.Diagnostics.Invalid_left_hand_side_of_assignment_expression,e.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant);r&&na(n,p,t,void 0)}}function l(){s(o||n,e.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2,e.tokenToString(n.kind),Ae(p),Ae(f))}var d=n.kind;if(56===d&&(168===t.kind||167===t.kind))return xs(t,Ls(r,i),i);var p=Ls(t,i),f=Ls(r,i);switch(d){case 37:case 38:case 59:case 60:case 39:case 61:case 40:case 62:case 36:case 58:case 43:case 63:case 44:case 64:case 45:case 65:case 47:case 67:case 48:case 68:case 46:case 66:96&p.flags&&(p=f),96&f.flags&&(f=p);var m=void 0;if(8&p.flags&&8&f.flags&&void 0!==(m=_(n.kind)))s(o||n,e.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead,e.tokenToString(n.kind),e.tokenToString(m));else{var g=os(t,p,e.Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type),y=os(r,f,e.Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type);g&&y&&u(ad)}return ad;case 35:case 57:96&p.flags&&(p=f),96&f.flags&&(f=p);var h=void 0;if(ms(p,132)&&ms(f,132))h=ad;else if(ms(p,258)||ms(f,258)?h=rd:(Ue(p)||Ue(f))&&(h=p===ud||f===ud?ud:nd),h&&!c(d))return h;return h?(57===d&&u(h),h):(l(),nd);case 25:case 27:case 28:case 29:if(!c(d))return id;case 30:case 31:case 32:case 33:return fs(p,258)&&fs(f,258)?id:(ea(p,f)||ea(f,p)||l(),id);case 91:return hs(t,r,p,f);case 90:return vs(t,r,p,f);case 51:return f;case 52:return vr([p,f]);case 56:return u(f),Sa(f);case 24:return f}}function Ts(t){for(var n=t,r=t.parent;r;){if(e.isFunctionLike(r)&&n===r.body)return!1;if(e.isClassLike(n))return!0;n=r,r=r.parent}return!1}function Es(t){if(a&&(2&t.parserContextFlags&&!Ts(t)||Tl(t,e.Diagnostics.A_yield_expression_is_only_allowed_in_a_generator_body),ci(t)&&s(t,e.Diagnostics.yield_expressions_cannot_be_used_in_a_parameter_initializer)),t.expression){var n=e.getContainingFunction(t);if(n&&n.asteriskToken){var r=Os(t.expression,void 0),i=void 0,o=!!t.asteriskToken;if(o&&(i=$c(r,t.expression)),n.type){var c=t_(Pr(n.type))||nd;o?na(i,c,t.expression,void 0):na(r,c,t.expression,void 0)}}}return nd}function ws(e,t){Ls(e.condition);var n=Ls(e.whenTrue,t),r=Ls(e.whenFalse,t);return vr([n,r])}function As(e){var t=Si(e);return t&&gi(t)?Dr(e.text):rd}function Ps(t){return e.forEach(t.templateSpans,function(e){Ls(e.expression)}),rd}function Ns(e,t,n){var r=e.contextualType;e.contextualType=t;var a=Ls(e,n);return e.contextualType=r,a}function Os(e,t){var n=h(e);return n.resolvedType||(n.resolvedType=Ls(e,t)),n.resolvedType}function Rs(e,t){return 137===e.name.kind&&zi(e.name),Ls(e.initializer,t)}function Is(e,t){yl(e),137===e.name.kind&&zi(e.name);var n=as(e,t);return Fs(e,n,t)}function Fs(e,t,n){if(Pi(n)){var r=Co(t);if(r&&r.typeParameters){var a=Di(e);if(a){var i=Co(a);if(i&&!i.typeParameters)return On(Do(r,i,n))}}}return t}function Ls(t,n){var r;if(136===t.kind)r=co(t);else{var a=Bs(t,n);r=Fs(t,a,n)}if(gs(r)){var i=169===t.parent.kind&&t.parent.expression===t||170===t.parent.kind&&t.parent.expression===t||(69===t.kind||136===t.kind)&&ou(t);i||s(t,e.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment)}return r}function Ms(e){return Ll(e),ad}function Bs(t,n){switch(t.kind){case 69:return Va(t);case 97:return ei(t);case 95:return ri(t);case 93:return _d;case 99:case 84:return id;case 8:return Ms(t);case 186:return Ps(t);case 9:return As(t);case 11:return rd;case 10:return Cd;case 167:return Ii(t,n);case 168:return Ki(t,n);case 169:return so(t);case 170:return mo(t);case 171:case 172:return Wo(t);case 173:return Vo(t);case 175:return Ls(t.expression,n);case 189:return f_(t);case 176:case 177:return as(t,n);case 179:return _s(t);case 174:case 192:return Ho(t);case 178:return cs(t);case 180:return us(t);case 181:return ls(t);case 182:return ds(t);case 183:return ps(t);case 184:return Ds(t,n);case 185:return ws(t,n);case 188:return Oi(t,n);case 190:return cd;case 187:return Es(t);case 243:return ro(t);case 236:return Ji(t);case 237:return ji(t);case 238:e.Debug.fail("Shouldn't ever directly check a JsxOpeningElement")}return ud}function zs(t){t.expression&&Tl(t.expression,e.Diagnostics.Type_expected),q_(t.constraint),Bn(Pt(ae(t))),a&&d_(t.name,e.Diagnostics.Type_parameter_name_cannot_be_0)}function Ks(t){Wu(t)||Vu(t),Mc(t);var n=e.getContainingFunction(t);56&t.flags&&(n=e.getContainingFunction(t),145===n.kind&&e.nodeIsPresent(n.body)||s(t,e.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation)),t.questionToken&&e.isBindingPattern(t.name)&&n.body&&s(t,e.Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature),!t.dotDotDotToken||e.isBindingPattern(t.name)||ka(_t(t.symbol))||s(t,e.Diagnostics.A_rest_parameter_must_be_of_an_array_type)}function js(e){return e.asteriskToken&&e.body?144===e.kind||216===e.kind||176===e.kind:!1}function Js(e,t){if(e)for(var n=0;n<e.length;n++){var r=e[n];if(69===r.name.kind&&r.name.text===t.text)return n}return-1}function Us(t){var n=qs(t);if(!n)return void s(t,e.Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods);var r=Sn(n).typePredicate;if(r){var a=t.parameterName;if(e.isThisTypePredicate(r))Ar(a);else if(r.parameterIndex>=0)n.parameters[r.parameterIndex].dotDotDotToken?s(a,e.Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter):na(r.type,lu(n.parameters[r.parameterIndex]),t.type);else if(a){for(var i=!1,o=0,c=n.parameters;o<c.length;o++){var _=c[o].name;if(e.isBindingPattern(_)&&Ws(_,a,r.parameterName)){i=!0;break}}i||s(t.parameterName,e.Diagnostics.Cannot_find_parameter_0,r.parameterName)}}}function qs(e){switch(e.parent.kind){case 177:case 148:case 216:case 176:case 153:case 144:case 143:var t=e.parent;if(e===t.type)return t}}function Ws(t,n,r){for(var a=0,i=t.elements;a<i.length;a++){var o=i[a].name;if(69===o.kind&&o.text===r)return s(n,e.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern,r),!0;if((165===o.kind||164===o.kind)&&Ws(o,n,r))return!0}}function Vs(t){if(150===t.kind?tl(t):153!==t.kind&&216!==t.kind&&154!==t.kind&&148!==t.kind&&145!==t.kind&&149!==t.kind||Yu(t),p_(t.typeParameters),e.forEach(t.parameters,Ks),t.type&&q_(t.type),a){if(wc(t),Vl.noImplicitAny&&!t.type)switch(t.kind){case 149:s(t,e.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);break;case 148:s(t,e.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type)}if(t.type)if(Hl>=2&&js(t)){var n=Pr(t.type);if(n===sd)s(t.type,e.Diagnostics.A_generator_cannot_have_a_void_type_annotation);else{var r=t_(n)||nd,i=sr(r);na(i,n,t.type)}}else e.isAsyncFunctionLike(t)&&hc(t)}cc(t)}function Hs(t){if(218===t.kind){var n=ae(t);if(n.declarations.length>0&&n.declarations[0]!==t)return}var r=Rn(ae(t));if(r)for(var a=!1,i=!1,o=0,c=r.declarations;o<c.length;o++){var _=c[o],u=_;if(1===u.parameters.length&&u.parameters[0].type)switch(u.parameters[0].type.kind){case 130:i?s(u,e.Diagnostics.Duplicate_string_index_signature):i=!0;break;case 128:a?s(u,e.Diagnostics.Duplicate_number_index_signature):a=!0}}}function Gs(e){Wu(e)||Vu(e)||Nl(e)||_l(e.name),Mc(e)}function Xs(t){yl(t)||_l(t.name),Tc(t),128&t.flags&&t.body&&s(t,e.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract,e.declarationNameToString(t.name))}function Qs(t){function n(e){return!(142!==e.kind||64&e.flags||!e.initializer)}Vs(t),Al(t)||Pl(t),q_(t.body);var r=ae(t),i=e.getDeclarationOfKind(r,t.kind);if(t===i&&uc(r),!e.nodeIsMissing(t.body)&&a){var o=t.parent;if(e.getClassExtendsHeritageClauseElement(o)){var c=Za(o),_=$a(t);if(_){c&&s(_,e.Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null);var u=e.forEach(t.parent.members,n)||e.forEach(t.parameters,function(e){return 56&e.flags});if(u){for(var l=t.body.statements,d=void 0,p=0,f=l;p<f.length;p++){var m=f[p];if(198===m.kind&&e.isSuperCallExpression(m.expression)){d=m;break}if(!e.isPrologueDirective(m))break}d||s(t,e.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties)}}else c||s(t,e.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call)}}}function Ys(t){if(a){if(Yu(t)||ml(t)||_l(t.name),Dc(t),Vs(t),146===t.kind&&!e.isInAmbientContext(t)&&e.nodeIsPresent(t.body)&&524288&t.flags&&(1048576&t.flags?Vl.noImplicitReturns&&s(t.name,e.Diagnostics.Not_all_code_paths_return_a_value):s(t.name,e.Diagnostics.A_get_accessor_must_return_a_value)),137===t.name.kind&&zi(t.name),!e.hasDynamicName(t)){var n=146===t.kind?147:146,r=e.getDeclarationOfKind(t.symbol,n);if(r){(56&t.flags)!==(56&r.flags)&&s(t.name,e.Diagnostics.Getter_and_setter_accessors_do_not_agree_in_visibility);var i=rt(t),o=rt(r);i&&o&&(Qr(i,o)||s(t,e.Diagnostics.get_and_set_accessor_must_have_the_same_type))}}at(ae(t))}168!==t.parent.kind?q_(t.body):W_(t)}function $s(e){q_(e.body)}function Zs(e){Dc(e)}function ec(t,n){for(var r,a,i=!0,o=0;o<t.length;o++){var s=Bn(t[o]);if(s){r||(r=e.map(n,Pr),a=Ir(t,r));var c=r[o];i=i&&na(c,Jt(Vr(s,a),c),n[o],e.Diagnostics.Type_0_does_not_satisfy_the_constraint_1)}}return i}function tc(t){rl(t,t.typeArguments);var n=Xn(t);if(n!==ud&&t.typeArguments&&(e.forEach(t.typeArguments,q_),a)){var r=h(t).resolvedSymbol,i=524288&r.flags?y(r).typeParameters:n.target.localTypeParameters;ec(i,t.typeArguments)}}function nc(e){Qn(e)}function rc(t){if(e.forEach(t.members,q_),a){var n=Cr(t);l_(n),Hs(t)}}function ac(e){q_(e.elementType)}function ic(t){var n=Gu(t.elementTypes);n||0!==t.elementTypes.length||wl(t,e.Diagnostics.A_tuple_type_element_list_cannot_be_empty),e.forEach(t.elementTypes,q_)}function oc(t){e.forEach(t.types,q_)}function sc(t){return 16&t.flags&&e.isInAmbientContext(t)}function cc(t){if(a){var n=Sn(t);if(n.hasStringLiterals){if(e.nodeIsPresent(t.body))return void s(t,e.Diagnostics.A_signature_with_an_implementation_cannot_use_a_string_literal_type);var r;if(!t.name&&t.parent&&218===t.parent.kind){e.Debug.assert(148===t.kind||149===t.kind);var i=148===t.kind?0:1,o=ae(t.parent),c=Ot(o);r=yn(c,i)}else r=Tn(ae(t));for(var _=0,u=r;_<u.length;_++){var l=u[_];if(!l.hasStringLiterals&&ra(n,l,!1))return}s(t,e.Diagnostics.Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature)}}}function _c(t,n){var r=e.getCombinedNodeFlags(t);return 218!==t.parent.kind&&217!==t.parent.kind&&189!==t.parent.kind&&e.isInAmbientContext(t)&&(4&r||(r|=2),r|=4),r&n}function uc(t){function n(e,t){var n=void 0!==t&&t.parent===e[0].parent;return n?t:e[0]}function r(t,r,a,i,o){var c=i^o;if(0!==c){var _=_c(n(t,r),a);e.forEach(t,function(t){var n=_c(t,a)^_;2&n?s(t.name,e.Diagnostics.Overload_signatures_must_all_be_exported_or_not_exported):4&n?s(t.name,e.Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient):48&n?s(t.name,e.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected):128&n&&s(t.name,e.Diagnostics.Overload_signatures_must_all_be_abstract_or_not_abstract)})}}function i(t,r,a,i){if(a!==i){var o=e.hasQuestionToken(n(t,r));e.forEach(t,function(t){var n=e.hasQuestionToken(t)!==o;n&&s(t.name,e.Diagnostics.Overload_signatures_must_all_be_optional_or_required)})}}function o(t){if(!t.name||!e.nodeIsMissing(t.name)){var n=!1,r=e.forEachChild(t.parent,function(e){return n?e:void(n=e===t)});if(r&&r.pos===t.end&&r.kind===t.kind){var a=r.name||r;if(t.name&&r.name&&t.name.text===r.name.text){var i=(144===t.kind||143===t.kind)&&(64&t.flags)!==(64&r.flags);if(i){var o=64&t.flags?e.Diagnostics.Function_overload_must_be_static:e.Diagnostics.Function_overload_must_not_be_static;s(a,o)}return}if(e.nodeIsPresent(r.body))return void s(a,e.Diagnostics.Function_implementation_name_must_be_0,e.declarationNameToString(t.name))}var c=t.name||t;h?s(c,e.Diagnostics.Constructor_implementation_is_missing):128&t.flags?s(c,e.Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive):s(c,e.Diagnostics.Function_implementation_is_missing_or_not_immediately_following_the_declaration)}}if(a){for(var c,_,u,l=182,d=0,p=l,f=!1,m=!0,g=!1,y=t.declarations,h=0!==(16384&t.flags),v=t.parent&&1536&t.parent.flags,k=!1,b=!1,x=0,C=y;x<C.length;x++){var D=C[x],S=D,T=e.isInAmbientContext(S),E=218===S.parent.kind||156===S.parent.kind||T;if(E&&(u=void 0),216===S.kind||144===S.kind||143===S.kind||145===S.kind){var w=_c(S,l);d|=w,p&=w,f=f||e.hasQuestionToken(S),m=m&&e.hasQuestionToken(S),e.nodeIsPresent(S.body)&&c?h?b=!0:k=!0:!v&&u&&u.parent===S.parent&&u.end!==S.pos&&o(u),e.nodeIsPresent(S.body)?c||(c=S):g=!0,u=S,E||(_=S)}}if(b&&e.forEach(y,function(t){s(t,e.Diagnostics.Multiple_constructor_implementations_are_not_allowed)}),k&&e.forEach(y,function(t){s(t.name,e.Diagnostics.Duplicate_function_implementation)}),v||!_||_.body||128&_.flags||o(_),g&&(r(y,c,l,d,p),i(y,c,f,m),c)){var A=Tn(t),P=Sn(c);if(!P.hasStringLiterals)for(var N=0,O=A;N<O.length;N++){var R=O[N];if(!R.hasStringLiterals&&!oa(P,R)){s(R.declaration,e.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation);break}}}}}function lc(t){function n(t){switch(t.kind){case 218:return 2097152;case 221:return e.isAmbientModule(t)||0!==e.getModuleInstanceState(t)?5242880:4194304;case 217:case 220:return 3145728;case 224:var r=0,a=j(ae(t));return e.forEach(a.declarations,function(e){r|=n(e)}),r;default:return 1048576}}if(a){var r=t.localSymbol;if((r||(r=ae(t),7340032&r.flags))&&e.getDeclarationOfKind(r,t.kind)===t){for(var i=0,o=0,c=0,_=0,u=r.declarations;_<u.length;_++){var l=u[_],d=n(l),p=_c(l,514);2&p?512&p?c|=d:i|=d:o|=d}var f=i|o,m=i&o,g=c&f;if(m||g)for(var y=0,h=r.declarations;y<h.length;y++){var l=h[y],d=n(l);d&g?s(l.name,e.Diagnostics.Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead,e.declarationNameToString(l.name)):d&m&&s(l.name,e.Diagnostics.Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local,e.declarationNameToString(l.name))}}}}function dc(t,n,r){return t=Ea(t),!Ue(t)&&ea(t,Kd())?(n&&(r||(r=e.Diagnostics.Operand_for_await_does_not_have_a_valid_callable_then_member),s(n,r)),ud):t}function pc(t){if(!(1&t.flags)){if(4096&t.flags&&t.target===Ld())return t.typeArguments[0];var n=Bd();if(n!==ld&&ea(t,n)){var r=Je(t,"then");if(!(r&&1&r.flags)){var a=r?yn(r,0):ql;if(0!==a.length){var i=vr(e.map(a,fc));if(!(1&i.flags)){var o=yn(i,0);if(0!==o.length){var s=vr(e.map(o,fc));return s}}}}}}}function fc(e){return Go(e,0)}function mc(e){return gc(e,void 0,void 0)}function gc(t,n,r){function a(t){if(16384&t.flags){for(var i=[],o=0,c=t.types;o<c.length;o++){var _=c[o];i.push(a(_))}return vr(i)}var u=pc(t);if(void 0===u)return dc(t,n,r);if(t.id===u.id||sp.indexOf(u.id)>=0)return n&&s(n,e.Diagnostics._0_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method,Ee(t.symbol)),ud;sp.push(t.id);var l=a(u);return sp.pop(),l}return a(t)}function yc(t,n){if(t===ud)return ud;var r=Fd();return r===pd||r===ut(t)?gc(t,n,e.Diagnostics.An_async_function_or_method_must_have_a_valid_awaitable_return_type):(s(n,e.Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type),ud)}function hc(t){if(Vl.noCustomAsyncPromise&&Hl>=2){var n=Pr(t.type);return yc(n,t.type)}var r=zd();if(r===ld)return ud;var a=Pr(t.type);if(a===ud&&Vl.isolatedModules)return ud;var i=h(t.type).resolvedSymbol;if(!i||!se(i)){var o=i?Ee(i):Ae(a);return s(t,e.Diagnostics.Type_0_is_not_a_valid_async_function_return_type,o),ud}xc(t);var c=_t(i);if(!na(c,r,t,e.Diagnostics.Type_0_is_not_a_valid_async_function_return_type))return ud;var _=e.getEntityNameFromTypeNode(t.type),u=O_(_),l=k(t.locals,u.text,107455);return l?(s(l.valueDeclaration,e.Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions,u.text,W(i)),ud):gc(a,t,e.Diagnostics.An_async_function_or_method_must_have_a_valid_awaitable_return_type)}function vc(t){var n=Uo(t),r=wn(n);if(!(1&r.flags)){var a,i,o=jo(t);switch(t.parent.kind){case 217:var s=ae(t.parent),c=_t(s);a=vr([c,sd]);break;case 139:a=sd,i=e.chainDiagnosticMessages(i,e.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any);break;case 142:a=sd,i=e.chainDiagnosticMessages(i,e.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any);break;case 144:case 146:case 147:var _=lu(t.parent),u=ar(_);a=vr([u,sd])}na(r,a,t,o,i)}}function kc(e){if(e&&152===e.kind){var t=O_(e.typeName),n=152===t.parent.kind?793056:1536,r=C(t,t.text,8388608|n,void 0,void 0);if(r&&8388608&r.flags){var a=j(r);107455&a.flags&&!Tu(j(r))&&U(r)}}}function bc(e){kc(e.type)}function xc(e){kc(e.type)}function Cc(e){for(var t=0,n=e.parameters;t<n.length;t++){var r=n[t];bc(r)}}function Dc(t){if(t.decorators&&e.nodeCanBeDecorated(t)){if(Vl.experimentalDecorators||s(t,e.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning),Vl.emitDecoratorMetadata)switch(t.kind){case 217:var n=e.getFirstConstructorWithBody(t);n&&Cc(n);break;case 144:case 146:case 147:Cc(t),xc(t);break;case 142:case 139:bc(t)}e.forEach(t.decorators,vc)}}function Sc(e){a&&(Tc(e)||ul(e),Oc(e,e.name),Pc(e,e.name),Rc(e,e.name),Ic(e,e.name))}function Tc(t){Dc(t),Vs(t);var n=e.isAsyncFunctionLike(t);if(t.name&&137===t.name.kind&&zi(t.name),!e.hasDynamicName(t)){var r=ae(t),i=t.localSymbol||r,o=e.forEach(i.declarations,function(n){return n.kind!==t.kind||e.isSourceFileJavaScript(e.getSourceFileOfNode(n))?void 0:n});t===o&&uc(i),r.parent&&e.getDeclarationOfKind(r,t.kind)===t&&uc(r)}if(q_(t.body),!t.asteriskToken){var s=t.type&&(n?hc(t):Pr(t.type));rs(t,s)}a&&!t.type&&(Vl.noImplicitAny&&e.nodeIsMissing(t.body)&&!sc(t)&&Aa(t,nd),t.asteriskToken&&e.nodeIsPresent(t.body)&&wn(Sn(t)))}function Ec(t){195===t.kind&&Fl(t),e.forEach(t.statements,q_)}function wc(t){!e.hasRestParameter(t)||e.isInAmbientContext(t)||e.nodeIsMissing(t.body)||e.forEach(t.parameters,function(t){t.name&&!e.isBindingPattern(t.name)&&t.name.text===$l.name&&s(t,e.Diagnostics.Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters)})}function Ac(t,n,r){if(!n||n.text!==r)return!1;if(142===t.kind||141===t.kind||144===t.kind||143===t.kind||146===t.kind||147===t.kind)return!1;if(e.isInAmbientContext(t))return!1;var a=e.getRootDeclaration(t);return 139!==a.kind||!e.nodeIsMissing(a.parent.body);
}function Pc(e,t){Ac(e,t,"_this")&&op.push(e)}function Nc(t){for(var n=t;n;){if(4&Au(n)){var r=69!==t.kind;return void(r?s(t.name,e.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference):s(t,e.Diagnostics.Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference))}n=n.parent}}function Oc(t,n){if(Ac(t,n,"_super")){var r=e.getContainingClass(t);if(r&&!e.isInAmbientContext(r)&&e.getClassExtendsHeritageClauseElement(r)){var a=69!==t.kind;a?s(t,e.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference):s(t,e.Diagnostics.Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference)}}}function Rc(t,n){if((Ac(t,n,"require")||Ac(t,n,"exports"))&&(221!==t.kind||1===e.getModuleInstanceState(t))){var r=Ke(t);251===r.kind&&e.isExternalOrCommonJsModule(r)&&s(n,e.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module,e.declarationNameToString(n),e.declarationNameToString(n))}}function Ic(t,n){if(Vl.noCustomAsyncPromise&&Ac(t,n,"Promise")&&(221!==t.kind||1===e.getModuleInstanceState(t))){var r=Ke(t);251===r.kind&&e.isExternalOrCommonJsModule(r)&&33554432&r.flags&&s(n,e.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions,e.declarationNameToString(n),e.declarationNameToString(n))}}function Fc(t){if(0===(24576&e.getCombinedNodeFlags(t))&&!e.isParameterDeclaration(t)&&(214!==t.kind||t.initializer)){var n=ae(t);if(1&n.flags){var r=C(t,t.name.text,3,void 0,void 0);if(r&&r!==n&&2&r.flags&&24576&io(r)){var a=e.getAncestor(r.valueDeclaration,215),i=196===a.parent.kind&&a.parent.parent?a.parent.parent:void 0,o=i&&(195===i.kind&&e.isFunctionLike(i.parent)||222===i.kind||221===i.kind||251===i.kind);if(!o){var c=Ee(r);s(t,e.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1,c,c)}}}}}function Lc(t){function n(a){if(69===a.kind){var i=h(a).resolvedSymbol;if(i&&i!==ed&&k(r.locals,i.name,107455)===i){if(139===i.valueDeclaration.kind){if(i.valueDeclaration===t)return void s(a,e.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer,e.declarationNameToString(t.name));if(i.valueDeclaration.pos<t.pos)return}s(a,e.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it,e.declarationNameToString(t.name),e.declarationNameToString(a))}}else e.forEachChild(a,n)}if(139===e.getRootDeclaration(t).kind){var r=e.getContainingFunction(t);n(t.initializer)}}function Mc(t){if(Dc(t),q_(t.type),137===t.name.kind&&(zi(t.name),t.initializer&&Os(t.initializer)),166===t.kind&&t.propertyName&&137===t.propertyName.kind&&zi(t.propertyName),e.isBindingPattern(t.name)&&e.forEach(t.name.elements,q_),t.initializer&&139===e.getRootDeclaration(t).kind&&e.nodeIsMissing(e.getContainingFunction(t).body))return void s(t,e.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation);if(e.isBindingPattern(t.name))return void(t.initializer&&203!==t.parent.parent.kind&&(na(Os(t.initializer),tt(t),t,void 0),Lc(t)));var n=ae(t),r=nt(n);if(t===n.valueDeclaration)t.initializer&&203!==t.parent.parent.kind&&(na(Os(t.initializer),r,t,void 0),Lc(t));else{var a=tt(t);r===ud||a===ud||Qr(r,a)||s(t.name,e.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2,e.declarationNameToString(t.name),Ae(r),Ae(a)),t.initializer&&na(Os(t.initializer),a,t,void 0)}142!==t.kind&&141!==t.kind&&(lc(t),214!==t.kind&&166!==t.kind||Fc(t),Oc(t,t.name),Pc(t,t.name),Rc(t,t.name),Ic(t,t.name))}function Bc(e){return kl(e),Mc(e)}function zc(e){return vl(e),Mc(e)}function Kc(t){Wu(t)||Vu(t)||xl(t.declarationList)||Dl(t),e.forEach(t.declarationList.declarations,q_)}function jc(t){if(t.modifiers&&168===t.parent.kind){if(!e.isAsyncFunctionLike(t))return Tl(t,e.Diagnostics.Modifiers_cannot_appear_here);if(t.modifiers.length>1)return Tl(t,e.Diagnostics.Modifiers_cannot_appear_here)}}function Jc(e){Fl(e),Ls(e.expression)}function Uc(t){Fl(t),Ls(t.expression),q_(t.thenStatement),197===t.thenStatement.kind&&s(t.thenStatement,e.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement),q_(t.elseStatement)}function qc(e){Fl(e),q_(e.statement),Ls(e.expression)}function Wc(e){Fl(e),Ls(e.expression),q_(e.statement)}function Vc(t){Fl(t)||t.initializer&&215===t.initializer.kind&&xl(t.initializer),t.initializer&&(215===t.initializer.kind?e.forEach(t.initializer.declarations,Bc):Ls(t.initializer)),t.condition&&Ls(t.condition),t.incrementor&&Ls(t.incrementor),q_(t.statement)}function Hc(t){if(fl(t),215===t.initializer.kind)Xc(t);else{var n=t.initializer,r=Qc(t.expression);if(167===n.kind||168===n.kind)xs(n,r||ud);else{var a=Ls(n);ss(n,e.Diagnostics.Invalid_left_hand_side_in_for_of_statement,e.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant),r&&na(r,a,n,void 0)}}q_(t.statement)}function Gc(t){if(fl(t),215===t.initializer.kind){var n=t.initializer.declarations[0];n&&e.isBindingPattern(n.name)&&s(n.name,e.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern),Xc(t)}else{var r=t.initializer,a=Ls(r);167===r.kind||168===r.kind?s(r,e.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern):Mi(a,258)?ss(r,e.Diagnostics.Invalid_left_hand_side_in_for_in_statement,e.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_previously_defined_constant):s(r,e.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any)}var i=Ls(t.expression);Mi(i,81408)||s(t.expression,e.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter),q_(t.statement)}function Xc(e){var t=e.initializer;if(t.declarations.length>=1){var n=t.declarations[0];Bc(n)}}function Qc(e){var t=du(e);return Yc(t,e,!0)}function Yc(t,n,r){if(Ue(t))return t;if(Hl>=2)return $c(t,n);if(r)return n_(t,n);if(ba(t)){var a=vn(t,1);if(a)return a}return s(n,e.Diagnostics.Type_0_is_not_an_array_type,Ae(t)),ud}function $c(e,t){var n=Zc(e,t);return t&&n&&na(e,or(n),t),n||nd}function Zc(t,n){if(!Ue(t)){var r=t;if(!r.iterableElementType)if(4096&t.flags&&t.target===Td)r.iterableElementType=t.typeArguments[0];else{var a=Je(t,e.getPropertyNameForKnownSymbolName("iterator"));if(Ue(a))return;var i=a?yn(a,0):ql;if(0===i.length)return void(n&&s(n,e.Diagnostics.Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator));r.iterableElementType=e_(vr(e.map(i,wn)),n)}return r.iterableElementType}}function e_(t,n){if(!Ue(t)){var r=t;if(!r.iteratorElementType)if(4096&t.flags&&t.target===Ed)r.iteratorElementType=t.typeArguments[0];else{var a=Je(t,"next");if(Ue(a))return;var i=a?yn(a,0):ql;if(0===i.length)return void(n&&s(n,e.Diagnostics.An_iterator_must_have_a_next_method));var o=vr(e.map(i,wn));if(Ue(o))return;var c=Je(o,"value");if(!c)return void(n&&s(n,e.Diagnostics.The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property));r.iteratorElementType=c}return r.iteratorElementType}}function t_(e){return Ue(e)?void 0:4096&e.flags&&e.target===wd?e.typeArguments[0]:Zc(e,void 0)||e_(e,void 0)}function n_(t,n){e.Debug.assert(2>Hl);var r=t;16384&t.flags?r=vr(e.filter(t.types,function(e){return!(258&e.flags)})):258&t.flags&&(r=dd);var a=t!==r,i=!1;if(a&&(1>Hl&&(s(n,e.Diagnostics.Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher),i=!0),r===ld))return rd;if(!ba(r)){if(!i){var o=a?e.Diagnostics.Type_0_is_not_an_array_type:e.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type;s(n,o,Ae(r))}return a?rd:ud}var c=vn(r,1)||ud;return a?258&c.flags?rd:vr([c,rd]):c}function r_(e){Fl(e)||hl(e)}function a_(t){return!(146!==t.kind||!e.getSetAccessorTypeAnnotationNode(e.getDeclarationOfKind(t.symbol,147)))}function i_(t){if(!Fl(t)){var n=e.getContainingFunction(t);n||Tl(t,e.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body)}if(t.expression){var r=e.getContainingFunction(t);if(r){var a=Sn(r),i=wn(a),o=Os(t.expression);if(r.asteriskToken)return;if(147===r.kind)s(t.expression,e.Diagnostics.Setters_cannot_return_a_value);else if(145===r.kind)na(o,i,t.expression)||s(t.expression,e.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class);else if(r.type||a_(r))if(e.isAsyncFunctionLike(r)){var c=pc(i),_=gc(o,t.expression,e.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member);c&&na(_,c,t.expression)}else na(o,i,t.expression)}}}function o_(t){Fl(t)||8&t.parserContextFlags&&Tl(t,e.Diagnostics.with_statements_are_not_allowed_in_an_async_function_block),Ls(t.expression),s(t.expression,e.Diagnostics.All_symbols_within_a_with_block_will_be_resolved_to_any)}function s_(t){Fl(t);var n,r=!1,i=Ls(t.expression),o=fs(i,258);e.forEach(t.caseBlock.clauses,function(s){if(245===s.kind&&!r)if(void 0===n)n=s;else{var c=e.getSourceFileOfNode(t),_=e.skipTrivia(c.text,s.pos),u=s.statements.length>0?s.statements[0].pos:s.end;El(c,_,u-_,e.Diagnostics.A_default_clause_cannot_appear_more_than_once_in_a_switch_statement),r=!0}if(a&&244===s.kind){var l=s,d=Ls(l.expression),p=o&&fs(d,258)||ea(i,d);p||na(d,i,l.expression,void 0)}e.forEach(s.statements,q_)})}function c_(t){if(!Fl(t))for(var n=t.parent;n&&!e.isFunctionLike(n);){if(210===n.kind&&n.label.text===t.label.text){var r=e.getSourceFileOfNode(t);wl(t.label,e.Diagnostics.Duplicate_label_0,e.getTextOfNodeFromSourceText(r.text,t.label));break}n=n.parent}q_(t.statement)}function __(t){Fl(t)||void 0===t.expression&&Ml(t,e.Diagnostics.Line_break_not_permitted_here),t.expression&&Ls(t.expression)}function u_(t){Fl(t),Ec(t.tryBlock);var n=t.catchClause;if(n){if(n.variableDeclaration)if(69!==n.variableDeclaration.name.kind)Tl(n.variableDeclaration.name,e.Diagnostics.Catch_clause_variable_name_must_be_an_identifier);else if(n.variableDeclaration.type)Tl(n.variableDeclaration.type,e.Diagnostics.Catch_clause_variable_cannot_have_a_type_annotation);else if(n.variableDeclaration.initializer)Tl(n.variableDeclaration.initializer,e.Diagnostics.Catch_clause_variable_cannot_have_an_initializer);else{var r=n.variableDeclaration.name.text,a=n.block.locals;if(a&&e.hasProperty(a,r)){var i=a[r];i&&0!==(2&i.flags)&&wl(i.valueDeclaration,e.Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause,r)}}Ec(n.block)}t.finallyBlock&&Ec(t.finallyBlock)}function l_(t){function n(t,n,r,a,i,o){if(i&&(1!==o||Fi(t.valueDeclaration.name))){var c;if(137===t.valueDeclaration.name.kind||t.parent===r.symbol)c=t.valueDeclaration;else if(a)c=a;else if(2048&r.flags){var _=e.forEach(xt(r),function(e){return cn(e,t.name)&&vn(e,o)});c=_?void 0:r.symbol.declarations[0]}if(c&&!ea(n,i)){var u=0===o?e.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2:e.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2;s(c,u,Ee(t),Ae(n),Ae(i))}}}var r=In(t.symbol,1),a=In(t.symbol,0),i=vn(t,0),o=vn(t,1);if((i||o)&&(e.forEach(sn(t),function(e){var s=_t(e);n(e,s,t,a,i,0),n(e,s,t,r,o,1)}),1024&t.flags&&e.isClassLike(t.symbol.valueDeclaration)))for(var c=t.symbol.valueDeclaration,_=0,u=c.members;_<u.length;_++){var l=u[_];if(!(64&l.flags)&&e.hasDynamicName(l)){var d=_t(l.symbol);n(l.symbol,d,t,a,i,0),n(l.symbol,d,t,r,o,1)}}var p;if(i&&o&&(p=r||a,!p&&2048&t.flags)){var f=e.forEach(xt(t),function(e){return vn(e,0)&&vn(e,1)});p=f?void 0:t.symbol.declarations[0]}p&&!ea(o,i)&&s(p,e.Diagnostics.Numeric_index_type_0_is_not_assignable_to_string_index_type_1,Ae(o),Ae(i))}function d_(e,t){switch(e.text){case"any":case"number":case"boolean":case"string":case"symbol":case"void":s(e,t,e.text)}}function p_(t){if(t)for(var n=0,r=t.length;r>n;n++){var i=t[n];if(zs(i),a)for(var o=0;n>o;o++)t[o].symbol===i.symbol&&s(i.name,e.Diagnostics.Duplicate_identifier_0,e.declarationNameToString(i.name))}}function f_(e){return y_(e),W_(e),_t(ae(e))}function m_(t){e.forEach(t.members,q_)}function g_(t){t.name||512&t.flags||Tl(t,e.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name),y_(t),e.forEach(t.members,q_)}function y_(t){sl(t),Dc(t),t.name&&(d_(t.name,e.Diagnostics.Class_name_cannot_be_0),Pc(t,t.name),Rc(t,t.name),Ic(t,t.name)),p_(t.typeParameters),lc(t);var n=ae(t),r=Ot(n),i=Jt(r),o=_t(n),c=e.getClassExtendsHeritageClauseElement(t);if(c){var _=xt(r);if(_.length&&a){var u=_[0],l=bt(r);if(q_(c.expression),c.typeArguments){e.forEach(c.typeArguments,q_);for(var d=0,p=vt(l,c.typeArguments);d<p.length;d++){var f=p[d];if(!ec(f.typeParameters,c.typeArguments))break}}if(na(i,Jt(u,r.thisType),t.name||t,e.Diagnostics.Class_0_incorrectly_extends_base_class_1),na(o,Xr(l),t.name||t,e.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1),!(l.symbol&&32&l.symbol.flags)){var m=kt(l,c.typeArguments);e.forEach(m,function(e){return wn(e)!==u})&&s(c.expression,e.Diagnostics.Base_constructors_must_all_have_the_same_return_type)}k_(r,u)}}var g=e.getClassImplementsHeritageClauseElements(t);if(g)for(var y=0,h=g;y<h.length;y++){var v=h[y];if(e.isSupportedExpressionWithTypeArguments(v)||s(v.expression,e.Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments),tc(v),a){var k=Pr(v);if(k!==ud){var b=4096&k.flags?k.target:k;3072&b.flags?na(i,Jt(k,r.thisType),t.name||t,e.Diagnostics.Class_0_incorrectly_implements_interface_1):s(v,e.Diagnostics.A_class_may_only_implement_another_class_or_interface)}}}a&&(l_(r),Hs(t))}function h_(e){return 16777216&e.flags?y(e).target:e}function v_(t){return e.forEach(t.declarations,function(t){return e.isClassLike(t)?t:void 0})}function k_(t,n){for(var r=sn(n),a=0,i=r;a<i.length;a++){var o=i[a],c=h_(o);if(!(134217728&c.flags)){var _=h_(cn(t,c.name)),u=io(c);if(e.Debug.assert(!!_,"derived should point to something, even if it is the base class' declaration."),_)if(_===c){var l=v_(t.symbol);!(128&u)||l&&128&l.flags||(189===l.kind?s(l,e.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1,Ee(o),Ae(n)):s(l,e.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2,Ae(t),Ee(o),Ae(n)))}else{var d=io(_);if(16&u||16&d)continue;if((64&u)!==(64&d))continue;if(c.flags&_.flags&8192||98308&c.flags&&98308&_.flags)continue;var p=void 0;8192&c.flags?98304&_.flags?p=e.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor:(e.Debug.assert(0!==(4&_.flags)),p=e.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property):4&c.flags?(e.Debug.assert(0!==(8192&_.flags)),p=e.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function):(e.Debug.assert(0!==(98304&c.flags)),e.Debug.assert(0!==(8192&_.flags)),p=e.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function),s(_.valueDeclaration.name,p,Ae(n),Ee(c),Ae(t))}}}}function b_(e){return 146===e||147===e}function x_(e,t){if(!e&&!t)return!0;if(!e||!t||e.length!==t.length)return!1;for(var n=0,r=e.length;r>n;n++){var a=e[n],i=t[n];if(a.name.text!==i.name.text)return!1;if(a.constraint||i.constraint){if(!a.constraint||!i.constraint)return!1;if(!Qr(Pr(a.constraint),Pr(i.constraint)))return!1}}return!0}function C_(t,n){var r=xt(t);if(r.length<2)return!0;var a={};e.forEach(jt(t).declaredProperties,function(e){a[e.name]={prop:e,containingType:t}});for(var i=!0,o=0,s=r;o<s.length;o++)for(var c=s[o],_=sn(Jt(c,t.thisType)),u=0,l=_;u<l.length;u++){var d=l[u];if(e.hasProperty(a,d.name)){var p=a[d.name],f=p.containingType!==t;if(f&&!da(p.prop,d)){i=!1;var m=Ae(p.containingType),g=Ae(c),y=e.chainDiagnosticMessages(void 0,e.Diagnostics.Named_property_0_of_types_1_and_2_are_not_identical,Ee(d),m,g);y=e.chainDiagnosticMessages(y,e.Diagnostics.Interface_0_cannot_simultaneously_extend_types_1_and_2,Ae(t),m,g),cp.add(e.createDiagnosticForNodeFromMessageChain(n,y))}}else a[d.name]={prop:d,containingType:c}}return i}function D_(t){if(Wu(t)||Vu(t)||cl(t),p_(t.typeParameters),a){d_(t.name,e.Diagnostics.Interface_name_cannot_be_0),lc(t);var n=ae(t),r=e.getDeclarationOfKind(n,218);if(n.declarations.length>1&&(t===r||x_(r.typeParameters,t.typeParameters)||s(t.name,e.Diagnostics.All_declarations_of_an_interface_must_have_identical_type_parameters)),t===r){var i=Ot(n),o=Jt(i);if(C_(i,t.name)){for(var c=0,_=xt(i);c<_.length;c++){var u=_[c];na(o,Jt(u,i.thisType),t.name,e.Diagnostics.Interface_0_incorrectly_extends_interface_1)}l_(i)}}}e.forEach(e.getInterfaceBaseTypeNodes(t),function(t){e.isSupportedExpressionWithTypeArguments(t)||s(t.expression,e.Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments),tc(t)}),e.forEach(t.members,q_),a&&Hs(t)}function S_(t){Wu(t)||Vu(t),d_(t.name,e.Diagnostics.Type_alias_name_cannot_be_0),q_(t.type)}function T_(t){function n(t,n,r,a){function i(n){switch(n.kind){case 182:var r=i(n.operand);if(void 0===r)return;switch(n.operator){case 35:return r;case 36:return-r;case 50:return~r}return;case 184:var a=i(n.left);if(void 0===a)return;var c=i(n.right);if(void 0===c)return;switch(n.operatorToken.kind){case 47:return a|c;case 46:return a&c;case 44:return a>>c;case 45:return a>>>c;case 43:return a<<c;case 48:return a^c;case 37:return a*c;case 39:return a/c;case 35:return a+c;case 36:return a-c;case 40:return a%c}return;case 8:return+n.text;case 175:return i(n.expression);case 69:case 170:case 169:var _,u=t.parent,l=_t(ae(u.parent)),d=void 0;if(69===n.kind)_=l,d=n.text;else{var p=void 0;if(170===n.kind){if(void 0===n.argumentExpression||9!==n.argumentExpression.kind)return;p=n.expression,d=n.argumentExpression.text}else p=n.expression,d=n.name.text;for(var f=p;f&&69!==f.kind;){if(169!==f.kind)return;f=f.expression}if(_=Ls(p),!(_.symbol&&384&_.symbol.flags))return}if(void 0===d)return;var m=cn(_,d);if(!(m&&8&m.flags))return;var g=m.valueDeclaration;if(u===g)return;return x(g,u)?h(g).enumMemberValue:(o=!1,void s(n,e.Diagnostics.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums))}}var o=!0,c=i(t);return o&&(void 0===c?r?s(t,e.Diagnostics.In_const_enum_declarations_member_initializer_must_be_constant_expression):a?s(t,e.Diagnostics.In_ambient_enum_declarations_member_initializer_must_be_constant_expression):na(Ls(t),n,t,void 0):r&&(isNaN(c)?s(t,e.Diagnostics.const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN):isFinite(c)||s(t,e.Diagnostics.const_enum_member_initializer_was_evaluated_to_a_non_finite_value))),c}var r=h(t);if(!(16384&r.flags)){for(var a=ae(t),i=Ot(a),o=0,c=e.isInAmbientContext(t),_=e.isConst(t),u=0,l=t.members;u<l.length;u++){var d=l[u];if(Ve(d.name))s(d.name,e.Diagnostics.Computed_property_names_are_not_allowed_in_enums);else{var p=We(d.name);Bi(p)&&s(d.name,e.Diagnostics.An_enum_member_cannot_have_a_numeric_name)}var f=void 0===o,m=d.initializer;m?o=n(m,i,_,c):c&&!_?o=void 0:f&&s(d.name,e.Diagnostics.Enum_member_must_have_initializer),void 0!==o&&(h(d).enumMemberValue=o,o++)}r.flags|=16384}}function E_(t){if(a){Wu(t)||Vu(t),d_(t.name,e.Diagnostics.Enum_name_cannot_be_0),Pc(t,t.name),Rc(t,t.name),Ic(t,t.name),lc(t),T_(t);var n=e.isConst(t);Vl.isolatedModules&&n&&e.isInAmbientContext(t)&&s(t.name,e.Diagnostics.Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided);var r=ae(t),i=e.getDeclarationOfKind(r,t.kind);if(t===i){r.declarations.length>1&&e.forEach(r.declarations,function(t){e.isConstEnumDeclaration(t)!==n&&s(t.name,e.Diagnostics.Enum_declarations_must_all_be_const_or_non_const)});var o=!1;e.forEach(r.declarations,function(t){if(220!==t.kind)return!1;var n=t;if(!n.members.length)return!1;var r=n.members[0];r.initializer||(o?s(r.name,e.Diagnostics.In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element):o=!0)})}}}function w_(t){for(var n=t.declarations,r=0,a=n;r<a.length;r++){var i=a[r];if((217===i.kind||216===i.kind&&e.nodeIsPresent(i.body))&&!e.isInAmbientContext(i))return i}}function A_(t,n){var r=e.getEnclosingBlockScopeContainer(t),a=e.getEnclosingBlockScopeContainer(n);return v(r)?v(a):v(a)?!1:r===a}function P_(t){if(a){var n=e.isGlobalScopeAugmentation(t),r=e.isInAmbientContext(t);n&&!r&&s(t.name,e.Diagnostics.Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context);var i=e.isAmbientModule(t),o=i?e.Diagnostics.An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file:e.Diagnostics.A_namespace_declaration_is_only_allowed_in_a_namespace_or_module;if(z_(t,o))return;Wu(t)||Vu(t)||r||9!==t.name.kind||wl(t.name,e.Diagnostics.Only_ambient_modules_can_use_quoted_names),Pc(t,t.name),Rc(t,t.name),Ic(t,t.name),lc(t);var c=ae(t);if(512&c.flags&&c.declarations.length>1&&!r&&e.isInstantiatedModule(t,Vl.preserveConstEnums||Vl.isolatedModules)){var _=w_(c);_&&(e.getSourceFileOfNode(t)!==e.getSourceFileOfNode(_)?s(t.name,e.Diagnostics.A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged):t.pos<_.pos&&s(t.name,e.Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged));var u=e.getDeclarationOfKind(c,217);u&&A_(t,u)&&(h(t).flags|=32768)}if(i)if(e.isExternalModuleAugmentation(t)){var l=n||33554432&ae(t).flags;if(l)for(var d=0,p=t.body.statements;d<p.length;d++){var f=p[d];N_(f,n)}}else v(t.parent)?n?s(t.name,e.Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations):e.isExternalModuleNameRelative(t.name.text)&&s(t.name,e.Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name):n?s(t.name,e.Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations):s(t.name,e.Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces)}q_(t.body)}function N_(t,n){switch(t.kind){case 196:for(var r=0,a=t.declarationList.declarations;r<a.length;r++){var i=a[r];N_(i,n)}break;case 230:case 231:Tl(t,e.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations);break;case 224:if(9!==t.moduleReference.kind){s(t.name,e.Diagnostics.Module_augmentation_cannot_introduce_new_names_in_the_top_level_scope);break}case 225:Tl(t,e.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module);break;case 166:case 214:var o=t.name;if(e.isBindingPattern(o)){for(var c=0,_=o.elements;c<_.length;c++){var u=_[c];N_(u,n)}break}case 217:case 220:case 216:case 218:case 221:case 219:var l=ae(t);if(l){var d=!(33554432&l.flags);d||(d=n?void 0!==l.parent:e.isExternalModuleAugmentation(l.parent.valueDeclaration)),d&&s(t,e.Diagnostics.Module_augmentation_cannot_introduce_new_names_in_the_top_level_scope)}}}function O_(t){for(;;)if(136===t.kind)t=t.left;else{if(169!==t.kind)break;t=t.expression}return e.Debug.assert(69===t.kind),t}function R_(t){var n=e.getExternalModuleName(t);if(!e.nodeIsMissing(n)&&9!==n.kind)return s(n,e.Diagnostics.String_literal_expected),!1;var r=222===t.parent.kind&&e.isAmbientModule(t.parent.parent);return 251===t.parent.kind||r?r&&e.isExternalModuleNameRelative(n.text)&&!Oe(t)?(s(t,e.Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name),!1):!0:(s(n,231===t.kind?e.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace:e.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module),!1)}function I_(t){var n=ae(t),r=j(n);if(r!==ed){var a=(107455&n.flags?107455:0)|(793056&n.flags?793056:0)|(1536&n.flags?1536:0);if(r.flags&a){var i=233===t.kind?e.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0:e.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0;s(t,i,Ee(n))}}}function F_(e){Pc(e,e.name),Rc(e,e.name),Ic(e,e.name),I_(e)}function L_(t){if(!z_(t,e.Diagnostics.An_import_declaration_can_only_be_used_in_a_namespace_or_module)&&(!Wu(t)&&!Vu(t)&&1022&t.flags&&Tl(t,e.Diagnostics.An_import_declaration_cannot_have_modifiers),R_(t))){var n=t.importClause;n&&(n.name&&F_(n),n.namedBindings&&(227===n.namedBindings.kind?F_(n.namedBindings):e.forEach(n.namedBindings.elements,F_)))}}function M_(t){if(!z_(t,e.Diagnostics.An_import_declaration_can_only_be_used_in_a_namespace_or_module)&&(Wu(t)||Vu(t),e.isInternalModuleImportEqualsDeclaration(t)||R_(t)))if(F_(t),2&t.flags&&J(t),e.isInternalModuleImportEqualsDeclaration(t)){var n=j(ae(t));if(n!==ed){if(107455&n.flags){var r=O_(t.moduleReference);1536&V(r,108479).flags||s(r,e.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name,e.declarationNameToString(r))}793056&n.flags&&d_(t.name,e.Diagnostics.Import_name_cannot_be_0)}}else 5!==Gl||e.isInAmbientContext(t)||wl(t,e.Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead)}function B_(t){if(!z_(t,e.Diagnostics.An_export_declaration_can_only_be_used_in_a_module)&&(!Wu(t)&&!Vu(t)&&1022&t.flags&&Tl(t,e.Diagnostics.An_export_declaration_cannot_have_modifiers),!t.moduleSpecifier||R_(t)))if(t.exportClause){e.forEach(t.exportClause.elements,K_);var n=222===t.parent.kind&&e.isAmbientModule(t.parent.parent);251===t.parent.kind||n||s(t,e.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace)}else{var r=H(t,t.moduleSpecifier);r&&Y(r)&&s(t.moduleSpecifier,e.Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk,Ee(r))}}function z_(e,t){return 251!==e.parent.kind&&222!==e.parent.kind&&221!==e.parent.kind?Tl(e,t):void 0}function K_(t){if(I_(t),!t.parent.parent.moduleSpecifier){var n=t.propertyName||t.name,r=C(n,n.text,9289727,void 0,void 0);r&&(r===Yl||v(Ke(r.declarations[0])))?s(n,e.Diagnostics.Cannot_re_export_name_that_is_not_defined_in_the_module):J(t)}}function j_(t){if(!z_(t,e.Diagnostics.An_export_assignment_can_only_be_used_in_a_module)){var n=251===t.parent.kind?t.parent:t.parent.parent;if(221===n.kind&&!e.isAmbientModule(n))return void s(t,e.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace);!Wu(t)&&!Vu(t)&&1022&t.flags&&Tl(t,e.Diagnostics.An_export_assignment_cannot_have_modifiers),69===t.expression.kind?J(t):Os(t.expression),U_(n),t.isExportEquals&&!e.isInAmbientContext(t)&&(5===Gl?wl(t,e.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_modules_Consider_using_export_default_or_another_module_format_instead):4===Gl&&wl(t,e.Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system))}}function J_(e){for(var t in e.exports)if("export="!==t)return!0;return!1}function U_(t){function n(e){return 216!==e.kind||!!e.body}var r=ae(t),a=y(r);if(!a.exportsChecked){var i=r.exports["export="];if(i&&J_(r)){var o=w(i)||i.valueDeclaration;Oe(o)||s(o,e.Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements)}var c=ee(r);for(var _ in c)if("__export"!==_){var u=c[_],l=u.declarations,d=u.flags;if(!(1984&d)&&(524288&d?l.length-1:l.length)>1){var p=e.filter(l,n);if(p.length>1)for(var f=0,m=p;f<m.length;f++){var o=m[f];cp.add(e.createDiagnosticForNode(o,e.Diagnostics.Cannot_redeclare_exported_variable_0,_))}}}a.exportsChecked=!0}}function q_(e){if(e){var t=e.kind;if(Bl)switch(t){case 221:case 217:case 218:case 216:Bl.throwIfCancellationRequested()}switch(t){case 138:return zs(e);case 139:return Ks(e);case 142:case 141:return Gs(e);case 153:case 154:case 148:case 149:return Vs(e);case 150:return Vs(e);case 144:case 143:return Xs(e);case 145:return Qs(e);case 146:case 147:return Ys(e);case 152:return tc(e);case 151:return Us(e);case 155:return nc(e);case 156:return rc(e);case 157:return ac(e);case 158:return ic(e);case 159:case 160:return oc(e);case 161:return q_(e.type);case 216:return Sc(e);case 195:case 222:return Ec(e);case 196:return Kc(e);case 198:return Jc(e);case 199:return Uc(e);case 200:return qc(e);case 201:return Wc(e);case 202:return Vc(e);case 203:return Gc(e);case 204:return Hc(e);case 205:case 206:return r_(e);case 207:return i_(e);case 208:return o_(e);case 209:return s_(e);case 210:return c_(e);case 211:return __(e);case 212:return u_(e);case 214:return Bc(e);case 166:return zc(e);case 217:return g_(e);case 218:return D_(e);case 219:return S_(e);case 220:return E_(e);case 221:return P_(e);case 225:return L_(e);case 224:return M_(e);case 231:return B_(e);case 230:return j_(e);case 197:return void Fl(e);case 213:return void Fl(e);case 234:return Zs(e)}}}function W_(e){Jd&&Jd.push(e)}function V_(){for(var e=0,t=Jd;e<t.length;e++){var n=t[e];switch(n.kind){case 176:case 177:case 144:case 143:is(n);break;case 146:case 147:$s(n);break;case 189:m_(n)}}}function H_(t){var n=(new Date).getTime();G_(t),e.checkTime+=(new Date).getTime()-n}function G_(t){var n=h(t);if(!(1&n.flags)){if(Vl.skipDefaultLibCheck&&t.hasNoDefaultLib)return;Il(t),op.length=0,Jd=[],e.forEach(t.statements,q_),V_(),Jd=void 0,e.isExternalOrCommonJsModule(t)&&U_(t),op.length&&(e.forEach(op,Nc),op.length=0),n.flags|=1}}function X_(e,t){try{return Bl=t,Q_(e)}finally{Bl=void 0}}function Q_(t){return $_(),t?(H_(t),cp.getDiagnostics(t.fileName)):(e.forEach(r.getSourceFiles(),H_),cp.getDiagnostics())}function Y_(){return $_(),cp.getGlobalDiagnostics()}function $_(){if(!a)throw new Error("Trying to get diagnostics from a type checker that does not produce them.")}function Z_(e){if(e)for(;e.parent;){if(208===e.parent.kind&&e.parent.statement===e)return!0;e=e.parent}return!1}function eu(t,n){function r(){for(;t;){switch(t.locals&&!v(t)&&i(t.locals,n),t.kind){case 251:if(!e.isExternalOrCommonJsModule(t))break;case 221:i(ae(t).exports,8914931&n);break;case 220:i(ae(t).exports,8&n);break;case 189:var r=t.name;r&&a(t.symbol,n);case 217:case 218:64&s||i(ae(t).members,793056&n);break;case 176:var o=t.name;o&&a(t.symbol,n)}e.introducesArgumentsExoticObject(t)&&a($l,n),s=t.flags,t=t.parent}i(Xd,n)}function a(t,n){if(t.flags&n){var r=t.name;e.hasProperty(o,r)||(o[r]=t)}}function i(e,t){if(t)for(var n in e){var r=e[n];a(r,t)}}var o={},s=0;return Z_(t)?[]:(r(),xn(o))}function tu(e){return 69===e.kind&&nu(e.parent)&&e.parent.name===e}function nu(e){switch(e.kind){case 138:case 217:case 218:case 219:case 220:return!0}}function ru(e){for(var t=e;t.parent&&136===t.parent.kind;)t=t.parent;return t.parent&&152===t.parent.kind}function au(e){for(var t=e;t.parent&&169===t.parent.kind;)t=t.parent;return t.parent&&191===t.parent.kind}function iu(e){for(;136===e.parent.kind;)e=e.parent;return 224===e.parent.kind?e.parent.moduleReference===e&&e.parent:230===e.parent.kind?e.parent.expression===e&&e.parent:void 0}function ou(e){return void 0!==iu(e)}function su(t){if(e.isDeclarationName(t))return ae(t.parent);if(e.isInJavaScriptFile(t)&&169===t.parent.kind){var n=e.getSpecialPropertyAssignmentKind(t.parent.parent);switch(n){case 1:case 3:return ae(t.parent);case 4:case 2:return ae(t.parent.parent)}}if(230===t.parent.kind)return V(t,9289727);if(169!==t.kind&&ou(t))return q(t);if(e.isRightSideOfQualifiedNameOrPropertyAccess(t)&&(t=t.parent),au(t)){var r=0;return 191===t.parent.kind?(r=793056,e.isExpressionWithTypeArgumentsInClassExtendsClause(t.parent)&&(r|=107455)):r=1536,r|=8388608,V(t,r)}if(238===t.parent.kind||237===t.parent.kind||240===t.parent.kind)return Gi(t.parent);if(e.isExpression(t)){if(e.nodeIsMissing(t))return;if(69===t.kind){var r=8496063;return V(t,r)}if(169===t.kind){var a=h(t).resolvedSymbol;return a||so(t),h(t).resolvedSymbol}if(136===t.kind){var a=h(t).resolvedSymbol;return a||co(t),h(t).resolvedSymbol}}else{if(ru(t)){var r=152===t.parent.kind?793056:1536;return r|=8388608,V(t,r)}if(241===t.parent.kind)return $i(t.parent);
}return 151===t.parent.kind?V(t,1):void 0}function cu(t){if(!Z_(t)){if(e.isDeclarationName(t))return ae(t.parent);if(69===t.kind){if(ou(t))return 230===t.parent.kind?su(t):q(t);if(166===t.parent.kind&&164===t.parent.parent.kind&&t===t.parent.propertyName){var n=lu(t.parent.parent),r=n&&mn(n,t.text);if(r)return r}}switch(t.kind){case 69:case 169:case 136:return su(t);case 97:case 95:var a=e.isExpression(t)?Ls(t):Pr(t);return a.symbol;case 162:return Pr(t).symbol;case 121:var i=t.parent;if(i&&145===i.kind)return i.parent.symbol;return;case 9:if(e.isExternalModuleImportEqualsDeclaration(t.parent.parent)&&e.getExternalModuleImportEqualsDeclarationExpression(t.parent.parent)===t||(225===t.parent.kind||231===t.parent.kind)&&t.parent.moduleSpecifier===t)return H(t,t);case 8:if(170===t.parent.kind&&t.parent.argumentExpression===t){var o=Ls(t.parent.expression);if(o===ud)return;var s=dn(o);if(s===ud)return;return mn(s,t.text)}}}}function _u(e){return e&&249===e.kind?V(e.name,8496063):void 0}function uu(e){return e.parent.parent.moduleSpecifier?F(e.parent.parent,e):V(e.propertyName||e.name,9289727)}function lu(t){if(Z_(t))return ud;if(e.isTypeNode(t))return Pr(t);if(e.isExpression(t))return du(t);if(e.isExpressionWithTypeArgumentsInClassExtendsClause(t))return xt(Ot(ae(t.parent.parent)))[0];if(nu(t)){var n=ae(t);return Ot(n)}if(tu(t)){var n=cu(t);return n&&Ot(n)}if(e.isDeclaration(t)){var n=ae(t);return _t(n)}if(e.isDeclarationName(t)){var n=cu(t);return n&&_t(n)}if(e.isBindingPattern(t))return Qe(t.parent);if(ou(t)){var n=cu(t),r=n&&Ot(n);return r!==ud?r:_t(n)}return ud}function du(t){return e.isRightSideOfQualifiedNameOrPropertyAccess(t)&&(t=t.parent),Ls(t)}function pu(e){var t=ae(e.parent);return 64&e.flags?_t(t):Ot(t)}function fu(t){t=dn(t);var n=Bt(un(t));return(yn(t,0).length||yn(t,1).length)&&e.forEach(un(hd),function(t){e.hasProperty(n,t.name)||(n[t.name]=t)}),pe(n)}function mu(t){if(268435456&t.flags){var n=[],r=t.name;return e.forEach(y(t).containingType.types,function(e){var t=mn(e,r);t&&n.push(t)}),n}if(67108864&t.flags){var a=y(t).target;if(a)return[a]}return[t]}function gu(e){return Bu(e)===$l}function yu(t){function n(e){return e=K(e),e&&!!(107455&e.flags)}var r=H(t.parent,t);if(!r)return!0;var a=Y(r);r=X(r);var i=y(r);return void 0===i.exportsSomeValue&&(i.exportsSomeValue=a?!!(107455&r.flags):e.forEachValue(ee(r),n)),i.exportsSomeValue}function hu(e){var t=Bu(e);if(t){if(1048576&t.flags){var n=re(t.exportSymbol);if(944&n.flags)return;t=n}var r=ie(t);if(r){if(512&r.flags&&251===r.valueDeclaration.kind)return r.valueDeclaration;for(var a=e.parent;a;a=a.parent)if((221===a.kind||220===a.kind)&&ae(a)===r)return a}}}function vu(e){var t=Bu(e);return t&&8388608&t.flags?w(t):void 0}function ku(t){if(418&t.flags){var n=y(t);if(void 0===n.isDeclaratonWithCollidingName){var r=e.getEnclosingBlockScopeContainer(t.valueDeclaration);if(e.isStatementWithLocals(r)){var a=h(t.valueDeclaration);if(C(r.parent,t.name,107455,void 0,void 0))n.isDeclaratonWithCollidingName=!0;else if(131072&a.flags){var i=262144&a.flags,o=e.isIterationStatement(r,!1),s=195===r.kind&&e.isIterationStatement(r.parent,!1);n.isDeclaratonWithCollidingName=!(e.isBlockScopedContainerTopLevel(r)||i&&(o||s))}else n.isDeclaratonWithCollidingName=!1}}return n.isDeclaratonWithCollidingName}return!1}function bu(e){var t=Bu(e);return t&&ku(t)?t.valueDeclaration:void 0}function xu(e){return ku(ae(e))}function Cu(t){switch(t.kind){case 224:case 226:case 227:case 229:case 233:return Su(ae(t));case 231:var n=t.exportClause;return n&&e.forEach(n.elements,Cu);case 230:return t.expression&&69===t.expression.kind?Su(ae(t)):!0}return!1}function Du(t){if(251!==t.parent.kind||!e.isInternalModuleImportEqualsDeclaration(t))return!1;var n=Su(ae(t));return n&&t.moduleReference&&!e.nodeIsMissing(t.moduleReference)}function Su(e){var t=j(e);return t===ed&&Vl.isolatedModules?!0:t!==ed&&t&&107455&t.flags&&(Vl.preserveConstEnums||!Tu(t))}function Tu(e){return ys(e)||e.constEnumOnlyModule}function Eu(t,n){if(e.isAliasSymbolDeclaration(t)){var r=ae(t);if(y(r).referenced)return!0}return n?e.forEachChild(t,function(e){return Eu(e,n)}):!1}function wu(t){if(e.nodeIsPresent(t.body)){var n=ae(t),r=Tn(n);return r.length>1||1===r.length&&r[0].declaration!==t}return!1}function Au(e){return h(e).flags}function Pu(e){return T_(e.parent),h(e).enumMemberValue}function Nu(t){if(250===t.kind)return Pu(t);var n=h(t).resolvedSymbol;return n&&8&n.flags&&e.isConstEnumDeclaration(n.valueDeclaration.parent)?Pu(n.valueDeclaration):void 0}function Ou(e){return 80896&e.flags&&yn(e,0).length>0}function Ru(t){var n=V(t,107455,!0),r=n?_t(n):void 0;if(r&&yt(r))return e.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue;var a=V(t,793056,!0);if(!a)return e.TypeReferenceSerializationKind.ObjectType;var i=Ot(a);return i===ud?e.TypeReferenceSerializationKind.Unknown:1&i.flags?e.TypeReferenceSerializationKind.ObjectType:ms(i,16)?e.TypeReferenceSerializationKind.VoidType:ms(i,8)?e.TypeReferenceSerializationKind.BooleanType:ms(i,132)?e.TypeReferenceSerializationKind.NumberLikeType:ms(i,258)?e.TypeReferenceSerializationKind.StringLikeType:ms(i,8192)?e.TypeReferenceSerializationKind.ArrayLikeType:ms(i,16777216)?e.TypeReferenceSerializationKind.ESSymbolType:Ou(i)?e.TypeReferenceSerializationKind.TypeWithCallSignature:ka(i)?e.TypeReferenceSerializationKind.ArrayLikeType:e.TypeReferenceSerializationKind.ObjectType}function Iu(e,t,n,r){var a=ae(e),i=!a||133120&a.flags?ud:_t(a);Re().buildTypeDisplay(i,r,t,n)}function Fu(e,t,n,r){var a=Sn(e);Re().buildTypeDisplay(wn(a),r,t,n)}function Lu(e,t,n,r){var a=du(e);Re().buildTypeDisplay(a,r,t,n)}function Mu(t){return e.hasProperty(Xd,t)}function Bu(e){return h(e).resolvedSymbol||C(e,e.text,9544639,void 0,void 0)}function zu(t){e.Debug.assert(!e.nodeIsSynthesized(t));var n=Bu(t);return n&&oe(n).valueDeclaration}function Ku(){return{getReferencedExportContainer:hu,getReferencedImportDeclaration:vu,getReferencedDeclarationWithCollidingName:bu,isDeclarationWithCollidingName:xu,isValueAliasDeclaration:Cu,hasGlobalName:Mu,isReferencedAliasDeclaration:Eu,getNodeCheckFlags:Au,isTopLevelValueImportEqualsWithEntityName:Du,isDeclarationVisible:Ie,isImplementationOfOverload:wu,writeTypeOfDeclaration:Iu,writeReturnTypeOfSignatureDeclaration:Fu,writeTypeOfExpression:Lu,isSymbolAccessible:ke,isEntityNameVisible:Ce,getConstantValue:Nu,collectLinkedAliases:Fe,getReferencedValueDeclaration:zu,getTypeReferenceSerializationKind:Ru,isOptionalParameter:Cn,moduleExportsSomeValue:yu,isArgumentsLocalBinding:gu,getExternalModuleFileFromDeclaration:ju}}function ju(t){var n=e.getExternalModuleName(t),r=G(n,n,void 0);return r?e.getDeclarationOfKind(r,251):void 0}function Ju(){e.forEach(r.getSourceFiles(),function(t){e.bindSourceFile(t,Vl)});var t;if(e.forEach(r.getSourceFiles(),function(n){e.isExternalOrCommonJsModule(n)||f(Xd,n.locals),n.moduleAugmentations.length&&(t||(t=[])).push(n.moduleAugmentations)}),t)for(var n=0,a=t;n<a.length;n++)for(var i=a[n],o=0,s=i;o<s.length;o++){var c=s[o];m(c)}g(Xd,mp,e.Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0),y(Yl).type=cd,y($l).type=tr("IArguments"),y(ed).type=ud,vd=tr("Array",1),yd=tr("Object"),hd=tr("Function"),kd=tr("String"),bd=tr("Number"),xd=tr("Boolean"),Cd=tr("RegExp"),Ud=nr("JSX",lp.Element),Pd=e.memoize(function(){return tr("ClassDecorator")}),Od=e.memoize(function(){return tr("PropertyDecorator")}),Rd=e.memoize(function(){return tr("MethodDecorator")}),Nd=e.memoize(function(){return tr("ParameterDecorator")}),Id=e.memoize(function(){return tr("TypedPropertyDescriptor",1)}),Fd=e.memoize(function(){return tr("Promise",1)}),Ld=e.memoize(function(){return er("Promise",793056,void 0)&&Fd()}),Md=e.memoize(function(){return tr("PromiseLike",1)}),Bd=e.memoize(Uu),gd=e.memoize(function(){return $n("Promise")}),zd=e.memoize(function(){return tr("PromiseConstructorLike")}),Kd=e.memoize(qu),Hl>=2?(Dd=tr("TemplateStringsArray"),Sd=tr("Symbol"),md=$n("Symbol"),Td=tr("Iterable",1),Ed=tr("Iterator",1),wd=tr("IterableIterator",1)):(Dd=ud,Sd=me(void 0,Wl,ql,ql,void 0,void 0),md=void 0,Td=pd,Ed=pd,wd=pd),Ad=cr(nd)}function Uu(){var e=Md();return e!==pd?Jn(e,[nd]):ld}function qu(){var e=c(67108868,"then");y(e).type=hd;var t=le(65536);return t.properties=[e],t.members=Bt(t.properties),t.callSignatures=[],t.constructSignatures=[],t}function Wu(t){if(!t.decorators)return!1;if(!e.nodeCanBeDecorated(t))return 144!==t.kind||e.nodeIsPresent(t.body)?Tl(t,e.Diagnostics.Decorators_are_not_valid_here):Tl(t,e.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload);if(146===t.kind||147===t.kind){var n=e.getAllAccessorDeclarations(t.parent.members,t);if(n.firstAccessor.decorators&&t===n.secondAccessor)return Tl(t,e.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name)}return!1}function Vu(t){switch(t.kind){case 146:case 147:case 145:case 142:case 141:case 144:case 143:case 150:case 221:case 225:case 224:case 231:case 230:case 139:break;case 216:if(t.modifiers&&(t.modifiers.length>1||118!==t.modifiers[0].kind)&&222!==t.parent.kind&&251!==t.parent.kind)return Tl(t,e.Diagnostics.Modifiers_cannot_appear_here);break;case 217:case 218:case 196:case 219:if(t.modifiers&&222!==t.parent.kind&&251!==t.parent.kind)return Tl(t,e.Diagnostics.Modifiers_cannot_appear_here);break;case 220:if(t.modifiers&&(t.modifiers.length>1||74!==t.modifiers[0].kind)&&222!==t.parent.kind&&251!==t.parent.kind)return Tl(t,e.Diagnostics.Modifiers_cannot_appear_here);break;default:return!1}if(t.modifiers){for(var n,r,a,i,o,s=0,c=0,_=t.modifiers;c<_.length;c++){var u=_[c];switch(u.kind){case 74:if(220!==t.kind&&217===t.parent.kind)return wl(t,e.Diagnostics.A_class_member_cannot_have_the_0_keyword,e.tokenToString(74));break;case 112:case 111:case 110:var l=void 0;if(112===u.kind?l="public":111===u.kind?(l="protected",a=u):(l="private",r=u),56&s)return wl(u,e.Diagnostics.Accessibility_modifier_already_seen);if(64&s)return wl(u,e.Diagnostics._0_modifier_must_precede_1_modifier,l,"static");if(256&s)return wl(u,e.Diagnostics._0_modifier_must_precede_1_modifier,l,"async");if(222===t.parent.kind||251===t.parent.kind)return wl(u,e.Diagnostics._0_modifier_cannot_appear_on_a_module_element,l);if(128&s)return 110===u.kind?wl(u,e.Diagnostics._0_modifier_cannot_be_used_with_1_modifier,l,"abstract"):wl(u,e.Diagnostics._0_modifier_must_precede_1_modifier,l,"abstract");s|=e.modifierToFlag(u.kind);break;case 113:if(64&s)return wl(u,e.Diagnostics._0_modifier_already_seen,"static");if(256&s)return wl(u,e.Diagnostics._0_modifier_must_precede_1_modifier,"static","async");if(222===t.parent.kind||251===t.parent.kind)return wl(u,e.Diagnostics._0_modifier_cannot_appear_on_a_module_element,"static");if(139===t.kind)return wl(u,e.Diagnostics._0_modifier_cannot_appear_on_a_parameter,"static");if(128&s)return wl(u,e.Diagnostics._0_modifier_cannot_be_used_with_1_modifier,"static","abstract");s|=64,n=u;break;case 82:if(2&s)return wl(u,e.Diagnostics._0_modifier_already_seen,"export");if(4&s)return wl(u,e.Diagnostics._0_modifier_must_precede_1_modifier,"export","declare");if(128&s)return wl(u,e.Diagnostics._0_modifier_must_precede_1_modifier,"export","abstract");if(256&s)return wl(u,e.Diagnostics._0_modifier_must_precede_1_modifier,"export","async");if(217===t.parent.kind)return wl(u,e.Diagnostics._0_modifier_cannot_appear_on_a_class_element,"export");if(139===t.kind)return wl(u,e.Diagnostics._0_modifier_cannot_appear_on_a_parameter,"export");s|=2;break;case 122:if(4&s)return wl(u,e.Diagnostics._0_modifier_already_seen,"declare");if(256&s)return wl(u,e.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context,"async");if(217===t.parent.kind)return wl(u,e.Diagnostics._0_modifier_cannot_appear_on_a_class_element,"declare");if(139===t.kind)return wl(u,e.Diagnostics._0_modifier_cannot_appear_on_a_parameter,"declare");if(e.isInAmbientContext(t.parent)&&222===t.parent.kind)return wl(u,e.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context);s|=4,i=u;break;case 115:if(128&s)return wl(u,e.Diagnostics._0_modifier_already_seen,"abstract");if(217!==t.kind){if(144!==t.kind)return wl(u,e.Diagnostics.abstract_modifier_can_only_appear_on_a_class_or_method_declaration);if(!(217===t.parent.kind&&128&t.parent.flags))return wl(u,e.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class);if(64&s)return wl(u,e.Diagnostics._0_modifier_cannot_be_used_with_1_modifier,"static","abstract");if(16&s)return wl(u,e.Diagnostics._0_modifier_cannot_be_used_with_1_modifier,"private","abstract")}s|=128;break;case 118:if(256&s)return wl(u,e.Diagnostics._0_modifier_already_seen,"async");if(4&s||e.isInAmbientContext(t.parent))return wl(u,e.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context,"async");if(139===t.kind)return wl(u,e.Diagnostics._0_modifier_cannot_appear_on_a_parameter,"async");s|=256,o=u}}if(145!==t.kind)return(225===t.kind||224===t.kind)&&4&s?wl(i,e.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration,"declare"):139===t.kind&&56&s&&e.isBindingPattern(t.name)?wl(t,e.Diagnostics.A_parameter_property_may_not_be_a_binding_pattern):256&s?Hu(t,o):void 0;if(64&s)return wl(n,e.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration,"static");if(128&s)return wl(n,e.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration,"abstract");if(32&s)return wl(a,e.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration,"protected");if(16&s)return wl(r,e.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration,"private");if(256&s)return wl(o,e.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration,"async")}}function Hu(t,n){if(2>Hl)return wl(n,e.Diagnostics.Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher);switch(t.kind){case 144:case 216:case 176:case 177:if(!t.asteriskToken)return!1}return wl(n,e.Diagnostics._0_modifier_cannot_be_used_here,"async")}function Gu(t){if(t&&t.hasTrailingComma){var n=t.end-",".length,r=t.end,a=e.getSourceFileOfNode(t[0]);return El(a,n,r-n,e.Diagnostics.Trailing_comma_not_allowed)}}function Xu(t,n,r){if(Gu(n))return!0;if(n&&0===n.length){var a=n.pos-"<".length,i=e.skipTrivia(r.text,n.end)+">".length;return El(r,a,i-a,e.Diagnostics.Type_parameter_list_cannot_be_empty)}}function Qu(t){if(Gu(t))return!0;for(var n=!1,r=t.length,a=0;r>a;a++){var i=t[a];if(i.dotDotDotToken){if(a!==r-1)return wl(i.dotDotDotToken,e.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list);if(e.isBindingPattern(i.name))return wl(i.name,e.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern);if(i.questionToken)return wl(i.questionToken,e.Diagnostics.A_rest_parameter_cannot_be_optional);if(i.initializer)return wl(i.name,e.Diagnostics.A_rest_parameter_cannot_have_an_initializer)}else if(i.questionToken){if(n=!0,i.initializer)return wl(i.name,e.Diagnostics.Parameter_cannot_have_question_mark_and_initializer)}else if(n&&!i.initializer)return wl(i.name,e.Diagnostics.A_required_parameter_cannot_follow_an_optional_parameter)}}function Yu(t){var n=e.getSourceFileOfNode(t);return Wu(t)||Vu(t)||Xu(t,t.typeParameters,n)||Qu(t.parameters)||$u(t,n)}function $u(t,n){if(177===t.kind){var r=t,a=e.getLineAndCharacterOfPosition(n,r.equalsGreaterThanToken.pos).line,i=e.getLineAndCharacterOfPosition(n,r.equalsGreaterThanToken.end).line;if(a!==i)return wl(r.equalsGreaterThanToken,e.Diagnostics.Line_terminator_not_permitted_before_arrow)}return!1}function Zu(t){var n=t.parameters[0];return 1!==t.parameters.length?n?wl(n.name,e.Diagnostics.An_index_signature_must_have_exactly_one_parameter):wl(t,e.Diagnostics.An_index_signature_must_have_exactly_one_parameter):n.dotDotDotToken?wl(n.dotDotDotToken,e.Diagnostics.An_index_signature_cannot_have_a_rest_parameter):1022&n.flags?wl(n.name,e.Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier):n.questionToken?wl(n.questionToken,e.Diagnostics.An_index_signature_parameter_cannot_have_a_question_mark):n.initializer?wl(n.name,e.Diagnostics.An_index_signature_parameter_cannot_have_an_initializer):n.type?130!==n.type.kind&&128!==n.type.kind?wl(n.name,e.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number):t.type?void 0:wl(t,e.Diagnostics.An_index_signature_must_have_a_type_annotation):wl(n.name,e.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation)}function el(t){1022&t.flags&&Tl(t,e.Diagnostics.Modifiers_not_permitted_on_index_signature_members)}function tl(e){return Wu(e)||Vu(e)||Zu(e)||el(e)}function nl(t,n){if(n&&0===n.length){var r=e.getSourceFileOfNode(t),a=n.pos-"<".length,i=e.skipTrivia(r.text,n.end)+">".length;return El(r,a,i-a,e.Diagnostics.Type_argument_list_cannot_be_empty)}}function rl(e,t){return Gu(t)||nl(e,t)}function al(t,n){if(n)for(var r=e.getSourceFileOfNode(t),a=0,i=n;a<i.length;a++){var o=i[a];if(190===o.kind)return El(r,o.pos,0,e.Diagnostics.Argument_expression_expected)}}function il(e,t){return Gu(t)||al(e,t)}function ol(t){var n=t.types;if(Gu(n))return!0;if(n&&0===n.length){var r=e.tokenToString(t.token),a=e.getSourceFileOfNode(t);return El(a,n.pos,0,e.Diagnostics._0_list_cannot_be_empty,r)}}function sl(t){var n=!1,r=!1;if(!Wu(t)&&!Vu(t)&&t.heritageClauses)for(var a=0,i=t.heritageClauses;a<i.length;a++){var o=i[a];if(83===o.token){if(n)return Tl(o,e.Diagnostics.extends_clause_already_seen);if(r)return Tl(o,e.Diagnostics.extends_clause_must_precede_implements_clause);if(o.types.length>1)return Tl(o.types[1],e.Diagnostics.Classes_can_only_extend_a_single_class);n=!0}else{if(e.Debug.assert(106===o.token),r)return Tl(o,e.Diagnostics.implements_clause_already_seen);r=!0}ol(o)}}function cl(t){var n=!1;if(t.heritageClauses)for(var r=0,a=t.heritageClauses;r<a.length;r++){var i=a[r];if(83!==i.token)return e.Debug.assert(106===i.token),Tl(i,e.Diagnostics.Interface_declaration_cannot_have_implements_clause);if(n)return Tl(i,e.Diagnostics.extends_clause_already_seen);n=!0,ol(i)}return!1}function _l(t){if(137!==t.kind)return!1;var n=t;return 184===n.expression.kind&&24===n.expression.operatorToken.kind?wl(n.expression,e.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name):void 0}function ul(t){if(t.asteriskToken){if(e.Debug.assert(216===t.kind||176===t.kind||144===t.kind),e.isInAmbientContext(t))return wl(t.asteriskToken,e.Diagnostics.Generators_are_not_allowed_in_an_ambient_context);if(!t.body)return wl(t.asteriskToken,e.Diagnostics.An_overload_signature_cannot_be_declared_as_a_generator);if(2>Hl)return wl(t.asteriskToken,e.Diagnostics.Generators_are_only_available_when_targeting_ECMAScript_6_or_higher)}}function ll(e,t,n){return t?wl(t,n):void 0}function dl(t,n){for(var r={},a=1,i=2,o=4,s=i|o,c=function(t){var c=t.name;if(190===t.kind||137===c.kind)return _l(c),"continue";if(249===t.kind&&!n&&t.objectAssignmentInitializer)return{value:wl(t.equalsToken,e.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment)};e.forEach(t.modifiers,function(n){118===n.kind&&144===t.kind||wl(n,e.Diagnostics._0_modifier_cannot_be_used_here,e.getTextOfNode(n))});var _=void 0;if(248===t.kind||249===t.kind?(ll(t,t.questionToken,e.Diagnostics.An_object_member_cannot_be_declared_optional),8===c.kind&&Ll(c),_=a):144===t.kind?_=a:146===t.kind?_=i:147===t.kind?_=o:e.Debug.fail("Unexpected syntax kind:"+t.kind),e.hasProperty(r,c.text)){var u=r[c.text];if(_===a&&u===a)return"continue";if(!(_&s&&u&s))return{value:wl(c,e.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name)};if(u===s||_===u)return{value:wl(c,e.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name)};r[c.text]=_|u}else r[c.text]=_},_=0,u=t.properties;_<u.length;_++){var l=u[_],d=c(l);if("object"==typeof d)return d.value}}function pl(t){for(var n={},r=0,a=t.attributes;r<a.length;r++){var i=a[r];if(242!==i.kind){var o=i,s=o.name;if(e.hasProperty(n,s.text))return wl(s,e.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name);n[s.text]=!0;var c=o.initializer;if(c&&243===c.kind&&!c.expression)return wl(o.initializer,e.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression)}}}function fl(t){if(Fl(t))return!0;if(215===t.initializer.kind){var n=t.initializer;if(!xl(n)){var r=n.declarations;if(!r.length)return!1;if(r.length>1){var a=203===t.kind?e.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement:e.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement;return Tl(n.declarations[1],a)}var i=r[0];if(i.initializer){var a=203===t.kind?e.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer:e.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer;return wl(i.name,a)}if(i.type){var a=203===t.kind?e.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation:e.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation;return wl(i,a)}}}return!1}function ml(t){var n=t.kind;if(1>Hl)return wl(t.name,e.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher);if(e.isInAmbientContext(t))return wl(t.name,e.Diagnostics.An_accessor_cannot_be_declared_in_an_ambient_context);if(void 0===t.body)return El(e.getSourceFileOfNode(t),t.end-1,";".length,e.Diagnostics._0_expected,"{");if(t.typeParameters)return wl(t.name,e.Diagnostics.An_accessor_cannot_have_type_parameters);if(146===n&&t.parameters.length)return wl(t.name,e.Diagnostics.A_get_accessor_cannot_have_parameters);if(147===n){if(t.type)return wl(t.name,e.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation);if(1!==t.parameters.length)return wl(t.name,e.Diagnostics.A_set_accessor_must_have_exactly_one_parameter);var r=t.parameters[0];if(r.dotDotDotToken)return wl(r.dotDotDotToken,e.Diagnostics.A_set_accessor_cannot_have_rest_parameter);if(1022&r.flags)return wl(t.name,e.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation);if(r.questionToken)return wl(r.questionToken,e.Diagnostics.A_set_accessor_cannot_have_an_optional_parameter);if(r.initializer)return wl(t.name,e.Diagnostics.A_set_accessor_parameter_cannot_have_an_initializer)}}function gl(t,n){return e.isDynamicName(t)?wl(t,n):void 0}function yl(t){if(jc(t)||Yu(t)||ul(t))return!0;if(168===t.parent.kind){if(ll(t,t.questionToken,e.Diagnostics.A_class_member_cannot_be_declared_optional))return!0;if(void 0===t.body)return El(e.getSourceFileOfNode(t),t.end-1,";".length,e.Diagnostics._0_expected,"{")}if(e.isClassLike(t.parent)){if(ll(t,t.questionToken,e.Diagnostics.A_class_member_cannot_be_declared_optional))return!0;if(e.isInAmbientContext(t))return gl(t.name,e.Diagnostics.A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol);if(!t.body)return gl(t.name,e.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol)}else{if(218===t.parent.kind)return gl(t.name,e.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol);if(156===t.parent.kind)return gl(t.name,e.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)}}function hl(t){for(var n=t;n;){if(e.isFunctionLike(n))return wl(t,e.Diagnostics.Jump_target_cannot_cross_function_boundary);switch(n.kind){case 210:if(t.label&&n.label.text===t.label.text){var r=205===t.kind&&!e.isIterationStatement(n.statement,!0);return r?wl(t,e.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement):!1}break;case 209:if(206===t.kind&&!t.label)return!1;break;default:if(e.isIterationStatement(n,!1)&&!t.label)return!1}n=n.parent}if(t.label){var a=206===t.kind?e.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement:e.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement;return wl(t,a)}var a=206===t.kind?e.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement:e.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement;return wl(t,a)}function vl(t){if(t.dotDotDotToken){var n=t.parent.elements;if(t!==e.lastOrUndefined(n))return wl(t,e.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern);if(165===t.name.kind||164===t.name.kind)return wl(t.name,e.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern);if(t.initializer)return El(e.getSourceFileOfNode(t),t.initializer.pos-1,1,e.Diagnostics.A_rest_element_cannot_have_an_initializer)}}function kl(t){if(203!==t.parent.parent.kind&&204!==t.parent.parent.kind)if(e.isInAmbientContext(t)){if(t.initializer){var n="=".length;return El(e.getSourceFileOfNode(t),t.initializer.pos-n,n,e.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts)}}else if(!t.initializer){if(e.isBindingPattern(t.name)&&!e.isBindingPattern(t.parent))return wl(t,e.Diagnostics.A_destructuring_declaration_must_have_an_initializer);if(e.isConst(t))return wl(t,e.Diagnostics.const_declarations_must_be_initialized)}var r=e.isLet(t)||e.isConst(t);return r&&bl(t.name)}function bl(t){if(69===t.kind){if(108===t.originalKeywordKind)return wl(t,e.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations)}else for(var n=t.elements,r=0,a=n;r<a.length;r++){var i=a[r];190!==i.kind&&bl(i.name)}}function xl(t){var n=t.declarations;return Gu(t.declarations)?!0:t.declarations.length?void 0:El(e.getSourceFileOfNode(t),n.pos,n.end-n.pos,e.Diagnostics.Variable_declaration_list_cannot_be_empty)}function Cl(e){switch(e.kind){case 199:case 200:case 201:case 208:case 202:case 203:case 204:return!1;case 210:return Cl(e.parent)}return!0}function Dl(t){if(!Cl(t.parent)){if(e.isLet(t.declarationList))return wl(t,e.Diagnostics.let_declarations_can_only_be_declared_inside_a_block);if(e.isConst(t.declarationList))return wl(t,e.Diagnostics.const_declarations_can_only_be_declared_inside_a_block)}}function Sl(e){return e.parseDiagnostics.length>0}function Tl(t,n,r,a,i){var o=e.getSourceFileOfNode(t);if(!Sl(o)){var s=e.getSpanOfTokenAtPosition(o,t.pos);return cp.add(e.createFileDiagnostic(o,s.start,s.length,n,r,a,i)),!0}}function El(t,n,r,a,i,o,s){return Sl(t)?void 0:(cp.add(e.createFileDiagnostic(t,n,r,a,i,o,s)),!0)}function wl(t,n,r,a,i){var o=e.getSourceFileOfNode(t);return Sl(o)?void 0:(cp.add(e.createDiagnosticForNode(t,n,r,a,i)),!0)}function Al(t){return t.typeParameters?El(e.getSourceFileOfNode(t),t.typeParameters.pos,t.typeParameters.end-t.typeParameters.pos,e.Diagnostics.Type_parameters_cannot_appear_on_a_constructor_declaration):void 0}function Pl(t){return t.type?wl(t.type,e.Diagnostics.Type_annotation_cannot_appear_on_a_constructor_declaration):void 0}function Nl(t){if(e.isClassLike(t.parent)){if(ll(t,t.questionToken,e.Diagnostics.A_class_member_cannot_be_declared_optional)||gl(t.name,e.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol))return!0}else if(218===t.parent.kind){if(gl(t.name,e.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol))return!0;if(t.initializer)return wl(t.initializer,e.Diagnostics.An_interface_property_cannot_have_an_initializer)}else if(156===t.parent.kind){if(gl(t.name,e.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol))return!0;if(t.initializer)return wl(t.initializer,e.Diagnostics.A_type_literal_property_cannot_have_an_initializer)}return e.isInAmbientContext(t)&&t.initializer?Tl(t.initializer,e.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts):void 0}function Ol(t){return 218===t.kind||219===t.kind||225===t.kind||224===t.kind||231===t.kind||230===t.kind||4&t.flags||514&t.flags?!1:Tl(t,e.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file)}function Rl(t){for(var n=0,r=t.statements;n<r.length;n++){var a=r[n];if((e.isDeclaration(a)||196===a.kind)&&Ol(a))return!0}}function Il(t){return e.isInAmbientContext(t)&&Rl(t)}function Fl(t){if(e.isInAmbientContext(t)){if(b_(t.parent.kind))return h(t).hasReportedStatementInAmbientContext=!0;var n=h(t);if(!n.hasReportedStatementInAmbientContext&&e.isFunctionLike(t.parent))return h(t).hasReportedStatementInAmbientContext=Tl(t,e.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts);if(195===t.parent.kind||222===t.parent.kind||251===t.parent.kind){var r=h(t.parent);if(!r.hasReportedStatementInAmbientContext)return r.hasReportedStatementInAmbientContext=Tl(t,e.Diagnostics.Statements_are_not_allowed_in_ambient_contexts)}}}function Ll(t){return 32768&t.flags&&Hl>=1?wl(t,e.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher):void 0}function Ml(t,n,r,a,i){var o=e.getSourceFileOfNode(t);if(!Sl(o)){var s=e.getSpanOfTokenAtPosition(o,t.pos);return cp.add(e.createFileDiagnostic(o,e.textSpanEnd(s),0,n,r,a,i)),!0}}var Bl,zl=e.objectAllocator.getSymbolConstructor(),Kl=e.objectAllocator.getTypeConstructor(),jl=e.objectAllocator.getSignatureConstructor(),Jl=0,Ul=0,ql=[],Wl={},Vl=r.getCompilerOptions(),Hl=Vl.target||0,Gl=e.getEmitModuleKind(Vl),Xl="undefined"!=typeof Vl.allowSyntheticDefaultImports?Vl.allowSyntheticDefaultImports:4===Gl,Ql=Ku(),Yl=c(67108868,"undefined");Yl.declarations=[];var $l=c(67108868,"arguments"),Zl={getNodeCount:function(){return e.sum(r.getSourceFiles(),"nodeCount")},getIdentifierCount:function(){return e.sum(r.getSourceFiles(),"identifierCount")},getSymbolCount:function(){return e.sum(r.getSourceFiles(),"symbolCount")+Ul},getTypeCount:function(){return Jl},isUndefinedSymbol:function(e){return e===Yl},isArgumentsSymbol:function(e){return e===$l},isUnknownSymbol:function(e){return e===ed},getDiagnostics:X_,getGlobalDiagnostics:Y_,getTypeOfSymbolAtLocation:qa,getSymbolsOfParameterPropertyDeclaration:b,getDeclaredTypeOfSymbol:Ot,getPropertiesOfType:un,getPropertyOfType:mn,getSignaturesOfType:yn,getIndexTypeOfType:vn,getBaseTypes:xt,getReturnTypeOfSignature:wn,getSymbolsInScope:eu,getSymbolAtLocation:cu,getShorthandAssignmentValueSymbol:_u,getExportSpecifierLocalTargetSymbol:uu,getTypeAtLocation:lu,typeToString:Ae,getSymbolDisplayBuilder:Re,symbolToString:Ee,getAugmentedPropertiesOfType:fu,getRootSymbols:mu,getContextualType:Si,getFullyQualifiedName:W,getResolvedSignature:Uo,getConstantValue:Nu,isValidPropertyAccess:uo,getSignatureFromDeclaration:Sn,isImplementationOfOverload:wu,getAliasedSymbol:j,getEmitResolver:i,getExportsOfModule:$,getJsxElementAttributesType:Yi,getJsxIntrinsicTagNames:eo,isOptionalParameter:Cn},ed=c(67108868,"unknown"),td=c(67108864,"__resolving__"),nd=ue(1,"any"),rd=ue(2,"string"),ad=ue(4,"number"),id=ue(8,"boolean"),od=ue(16777216,"symbol"),sd=ue(16,"void"),cd=ue(2097184,"undefined"),_d=ue(2097216,"null"),ud=ue(1,"unknown"),ld=me(void 0,Wl,ql,ql,void 0,void 0),dd=ld,pd=me(void 0,Wl,ql,ql,void 0,void 0);pd.instantiations={};var fd=me(void 0,Wl,ql,ql,void 0,void 0);fd.flags|=8388608;var md,gd,yd,hd,vd,kd,bd,xd,Cd,Dd,Sd,Td,Ed,wd,Ad,Pd,Nd,Od,Rd,Id,Fd,Ld,Md,Bd,zd,Kd,jd,Jd,Ud,qd,Wd,Vd=me(void 0,Wl,ql,ql,void 0,void 0),Hd=Vt(void 0,void 0,ql,nd,void 0,0,!1,!1),Gd=Vt(void 0,void 0,ql,ud,void 0,0,!1,!1),Xd={},Qd={},Yd={},$d={},Zd={},ep=[],tp=[],np=[],rp=[],ap=[],ip=[],op=[],sp=[],cp=e.createDiagnosticCollection(),_p={string:{type:rd,flags:258},number:{type:ad,flags:132},"boolean":{type:id,flags:8},symbol:{type:od,flags:16777216},undefined:{type:cd,flags:2097152}},up={},lp={JSX:"JSX",IntrinsicElements:"IntrinsicElements",ElementClass:"ElementClass",ElementAttributesPropertyNameContainer:"ElementAttributesProperty",Element:"Element",IntrinsicAttributes:"IntrinsicAttributes",IntrinsicClassAttributes:"IntrinsicClassAttributes"},dp={},pp={},fp={};!function(e){e[e.Type=0]="Type",e[e.ResolvedBaseConstructorType=1]="ResolvedBaseConstructorType",e[e.DeclaredType=2]="DeclaredType",e[e.ResolvedReturnType=3]="ResolvedReturnType"}(Wd||(Wd={}));
var mp=(gp={},gp[Yl.name]=Yl,gp);return Ju(),Zl;var gp}var a=1,i=1,o=1;e.getNodeId=t,e.checkTime=0,e.getSymbolId=n,e.createTypeChecker=r}(ts||(ts={}));var ts;!function(e){function t(){return void 0===i&&(i={getSourceMapData:function(){},setSourceFile:function(e){},emitStart:function(e){},emitEnd:function(e,t){},emitPos:function(e){},changeEmitSourcePos:function(){},getText:function(){},getSourceMappingURL:function(){},initialize:function(e,t,n,r){},reset:function(){}}),i}function n(t,n){function r(n,r,a,s){C&&i(),y=void 0,v=-1,k=void 0,b=o,x=0,C={sourceMapFilePath:r,jsSourceMappingURL:D.inlineSourceMap?void 0:e.getBaseFileName(e.normalizeSlashes(r)),sourceMapFile:e.getBaseFileName(e.normalizeSlashes(n)),sourceMapSourceRoot:D.sourceRoot||"",sourceMapSources:[],inputSourceFileNames:[],sourceMapNames:[],sourceMapMappings:"",sourceMapSourcesContent:D.inlineSources?[]:void 0,sourceMapDecodedMappings:[]},C.sourceMapSourceRoot=e.normalizeSlashes(C.sourceMapSourceRoot),C.sourceMapSourceRoot.length&&47!==C.sourceMapSourceRoot.charCodeAt(C.sourceMapSourceRoot.length-1)&&(C.sourceMapSourceRoot+=e.directorySeparator),D.mapRoot?(h=e.normalizeSlashes(D.mapRoot),s||(e.Debug.assert(1===a.length),h=e.getDirectoryPath(e.getSourceFilePathInNewDir(a[0],t,h))),e.isRootedDiskPath(h)||e.isUrl(h)?C.jsSourceMappingURL=e.combinePaths(h,C.jsSourceMappingURL):(h=e.combinePaths(t.getCommonSourceDirectory(),h),C.jsSourceMappingURL=e.getRelativePathToDirectoryOrUrl(e.getDirectoryPath(e.normalizePath(n)),e.combinePaths(h,C.jsSourceMappingURL),t.getCurrentDirectory(),t.getCanonicalFileName,!0))):h=e.getDirectoryPath(e.normalizePath(n))}function i(){y=void 0,h=void 0,v=void 0,k=void 0,b=void 0,x=void 0,C=void 0}function s(){if(T){T=!1,k.emittedLine=b.emittedLine,k.emittedColumn=b.emittedColumn,C.sourceMapDecodedMappings.pop(),b=C.sourceMapDecodedMappings.length?C.sourceMapDecodedMappings[C.sourceMapDecodedMappings.length-1]:o;for(var e=C.sourceMapMappings,t=e.length-1;t>=0;t--){var n=e.charAt(t);if(","===n)break;if(";"===n&&0!==t&&";"!==e.charAt(t-1))break}C.sourceMapMappings=e.substr(0,Math.max(0,t))}}function c(){if(k&&k!==b){var t=b.emittedColumn;if(b.emittedLine===k.emittedLine)C.sourceMapMappings&&(C.sourceMapMappings+=",");else{for(var n=b.emittedLine;n<k.emittedLine;n++)C.sourceMapMappings+=";";t=1}C.sourceMapMappings+=a(k.emittedColumn-t),C.sourceMapMappings+=a(k.sourceIndex-b.sourceIndex),C.sourceMapMappings+=a(k.sourceLine-b.sourceLine),C.sourceMapMappings+=a(k.sourceColumn-b.sourceColumn),k.nameIndex>=0&&(e.Debug.assert(!1,"We do not support name index right now, Make sure to update updateLastEncodedAndRecordedSpans when we start using this"),C.sourceMapMappings+=a(k.nameIndex-x),x=k.nameIndex),b=k,C.sourceMapDecodedMappings.push(b)}}function _(t){if(-1!==t){var r=e.getLineAndCharacterOfPosition(y,t);r.line++,r.character++;var a=n.getLine(),i=n.getColumn();!k||k.emittedLine!==a||k.emittedColumn!==i||k.sourceIndex===v&&(k.sourceLine>r.line||k.sourceLine===r.line&&k.sourceColumn>r.character)?(c(),k={emittedLine:a,emittedColumn:i,sourceLine:r.line,sourceColumn:r.character,sourceIndex:v},S=!1):S||(k.sourceLine=r.line,k.sourceColumn=r.character,k.sourceIndex=v),s()}}function u(t){var n=!!t.decorators;return-1!==t.pos?e.skipTrivia(y.text,n?t.decorators.end:t.pos):-1}function l(e){_(u(e))}function d(e,t){_(e.end),S=t}function p(){e.Debug.assert(!T),T=!0}function f(n){y=n;var r=D.sourceRoot?t.getCommonSourceDirectory():h,a=e.getRelativePathToDirectoryOrUrl(r,y.fileName,t.getCurrentDirectory(),t.getCanonicalFileName,!0);v=e.indexOf(C.sourceMapSources,a),-1===v&&(v=C.sourceMapSources.length,C.sourceMapSources.push(a),C.inputSourceFileNames.push(n.fileName),D.inlineSources&&C.sourceMapSourcesContent.push(n.text))}function m(){return c(),e.stringify({version:3,file:C.sourceMapFile,sourceRoot:C.sourceMapSourceRoot,sources:C.sourceMapSources,names:C.sourceMapNames,mappings:C.sourceMapMappings,sourcesContent:C.sourceMapSourcesContent})}function g(){if(D.inlineSourceMap){var t=e.convertToBase64(m());return C.jsSourceMappingURL="data:application/json;base64,"+t}return C.jsSourceMappingURL}var y,h,v,k,b,x,C,D=t.getCompilerOptions(),S=!1,T=!1;return{getSourceMapData:function(){return C},setSourceFile:f,emitPos:_,emitStart:l,emitEnd:d,changeEmitSourcePos:p,getText:m,getSourceMappingURL:g,initialize:r,reset:i}}function r(e){if(64>e)return s.charAt(e);throw TypeError(e+": not a 64 based value")}function a(e){0>e?e=(-e<<1)+1:e<<=1;var t="";do{var n=31&e;e>>=5,e>0&&(n=32|n),t+=r(n)}while(e>0);return t}var i,o={emittedLine:1,emittedColumn:1,sourceLine:1,sourceColumn:1,sourceIndex:0};e.getNullSourceMapWriter=t,e.createSourceMapWriter=n;var s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"}(ts||(ts={}));var ts;!function(e){function t(t,r,a){function i(e,a,i){var s=e.declarationFilePath;n(t,r,o,s,a,i)}var o=e.createDiagnosticCollection();return e.forEachExpectedEmitFile(t,i,a),o.getDiagnostics(a?a.fileName:void 0)}function n(t,n,r,a,i,o){function s(e){var t=de.substring(e.pos,e.end);return t.indexOf("@internal")>=0}function c(t){if(t){var n=e.getLeadingCommentRanges(de,t.pos);if(e.forEach(n,s))return;re(t)}}function _(){var t=e.createTextWriter(ve);return t.trackSymbol=p,t.reportInaccessibleThisError=f,t.writeKeyword=t.write,t.writeOperator=t.write,t.writePunctuation=t.write,t.writeSpace=t.write,t.writeStringLiteral=t.writeLiteral,t.writeParameter=t.write,t.writeSymbol=t.write,u(t),t}function u(e){be=e,ie=e.write,_e=e.writeTextOfNode,oe=e.writeLine,se=e.increaseIndent,ce=e.decreaseIndent}function l(t){var n=be;e.forEach(t,function(t){var n;214===t.kind?n=t.parent.parent:228===t.kind||229===t.kind||226===t.kind?e.Debug.fail("We should be getting ImportDeclaration instead to write"):n=t;var r=e.forEach(Se,function(e){return e.node===n?e:void 0});if(!r&&he&&(r=e.forEach(he,function(e){return e.node===n?e:void 0})),r)if(225===r.node.kind)r.isVisible=!0;else{_();for(var a=r.indent;a;a--)se();221===n.kind&&(e.Debug.assert(void 0===he),he=[]),w(n),221===n.kind&&(r.subModuleElementDeclarationEmitInfo=he,he=void 0),r.asynchronousOutput=be.getText()}}),u(n)}function d(t){if(0===t.accessibility)t&&t.aliasesToMakeVisible&&l(t.aliasesToMakeVisible);else{xe=!0;var n=be.getSymbolAccessibilityDiagnostic(t);n&&(n.typeName?r.add(e.createDiagnosticForNode(t.errorNode||n.errorNode,n.diagnosticMessage,e.getTextOfNodeFromSourceText(de,n.typeName),t.errorSymbolName,t.errorModuleName)):r.add(e.createDiagnosticForNode(t.errorNode||n.errorNode,n.diagnosticMessage,t.errorSymbolName,t.errorModuleName)))}}function p(e,t,r){d(n.isSymbolAccessible(e,t,r))}function f(){ge&&(xe=!0,r.add(e.createDiagnosticForNode(ge,e.Diagnostics.The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary,e.declarationNameToString(ge))))}function m(e,t,r){be.getSymbolAccessibilityDiagnostic=r,ie(": "),t?x(t):(ge=e.name,n.writeTypeOfDeclaration(e,ue,2,be),ge=void 0)}function g(e,t){be.getSymbolAccessibilityDiagnostic=t,ie(": "),e.type?x(e.type):(ge=e.name,n.writeReturnTypeOfSignatureDeclaration(e,ue,2,be),ge=void 0)}function y(e){for(var t=0,n=e;t<n.length;t++){var r=n[t];De(r)}}function h(e,t,n,r){for(var a=be.getTextPos(),i=0,o=e;i<o.length;i++){var s=o[i];r&&!r(s)||(a!==be.getTextPos()&&ie(t),a=be.getTextPos(),n(s))}}function v(e,t,n){h(e,", ",t,n)}function k(t){if(t){var n=e.getJsDocCommentsFromText(t,de);e.emitNewLineBeforeLeadingComments(pe,be,t,n),e.emitComments(de,pe,be,n,!0,ve,e.writeCommentRange)}}function b(e,t){be.getSymbolAccessibilityDiagnostic=t,x(e)}function x(t){function r(e){if(69===e.kind)_e(de,e);else{var t=136===e.kind?e.left:e.expression,n=136===e.kind?e.right:e.name;r(t),ie("."),_e(de,n)}}function a(e){var t=n.isEntityNameVisible(e,224===e.parent.kind?e.parent:ue);d(t),r(e)}function i(t){e.isSupportedExpressionWithTypeArguments(t)&&(e.Debug.assert(69===t.expression.kind||169===t.expression.kind),a(t.expression),t.typeArguments&&(ie("<"),v(t.typeArguments,x),ie(">")))}function o(e){a(e.typeName),e.typeArguments&&(ie("<"),v(e.typeArguments,x),ie(">"))}function s(e){_e(de,e.parameterName),ie(" is "),x(e.type)}function c(e){ie("typeof "),a(e.exprName)}function _(e){x(e.elementType),ie("[]")}function u(e){ie("["),v(e.elementTypes,x),ie("]")}function l(e){h(e.types," | ",x)}function p(e){h(e.types," & ",x)}function f(e){ie("("),x(e.type),ie(")")}function m(e){ie("{"),e.members.length&&(oe(),se(),y(e.members),ce()),ie("}")}switch(t.kind){case 117:case 130:case 128:case 120:case 131:case 103:case 162:case 163:return _e(de,t);case 191:return i(t);case 152:return o(t);case 155:return c(t);case 157:return _(t);case 158:return u(t);case 159:return l(t);case 160:return p(t);case 161:return f(t);case 153:case 154:return ee(t);case 156:return m(t);case 69:return a(t);case 136:return a(t);case 151:return s(t)}}function C(t){de=t.text,pe=e.getLineStarts(t),fe=t.identifiers,me=e.isExternalModule(t),ue=t,e.emitDetachedComments(de,pe,be,e.writeCommentRange,t,ve,!0),y(t.statements)}function D(){var t="_default";if(!e.hasProperty(fe,t))return t;for(var n=0;;){n++;var r=t+"_"+n;if(!e.hasProperty(fe,r))return r}}function S(t){function r(n){return{diagnosticMessage:e.Diagnostics.Default_export_of_the_module_has_or_is_using_private_name_0,errorNode:t}}if(69===t.expression.kind)ie(t.isExportEquals?"export = ":"export default "),_e(de,t.expression);else{var a=D();ie("declare var "),ie(a),ie(": "),be.getSymbolAccessibilityDiagnostic=r,n.writeTypeOfExpression(t.expression,ue,2,be),ie(";"),oe(),ie(t.isExportEquals?"export = ":"export default "),ie(a)}if(ie(";"),oe(),69===t.expression.kind){var i=n.collectLinkedAliases(t.expression);l(i)}}function T(e){return n.isDeclarationVisible(e)}function E(e,t){if(t)w(e);else if(224===e.kind||251===e.parent.kind&&me){var r=void 0;if(he&&251!==e.parent.kind)he.push({node:e,outputPos:be.getTextPos(),indent:be.getIndent(),isVisible:r});else{if(225===e.kind){var a=e;a.importClause&&(r=a.importClause.name&&n.isDeclarationVisible(a.importClause)||O(a.importClause.namedBindings))}Se.push({node:e,outputPos:be.getTextPos(),indent:be.getIndent(),isVisible:r})}}}function w(t){switch(t.kind){case 216:return Z(t);case 196:return Y(t);case 218:return V(t);case 217:return W(t);case 219:return z(t);case 220:return K(t);case 221:return B(t);case 224:return N(t);case 225:return R(t);default:e.Debug.fail("Unknown symbol kind")}}function A(e){251===e.parent.kind&&(2&e.flags&&ie("export "),512&e.flags?ie("default "):218===e.kind||ye||ie("declare "))}function P(e){16&e.flags?ie("private "):32&e.flags&&ie("protected "),64&e.flags&&ie("static "),128&e.flags&&ie("abstract ")}function N(t){function n(n){return{diagnosticMessage:e.Diagnostics.Import_declaration_0_is_using_private_name_1,errorNode:t,typeName:t.name}}Ce(t),2&t.flags&&ie("export "),ie("import "),_e(de,t.name),ie(" = "),e.isInternalModuleImportEqualsDeclaration(t)?(b(t.moduleReference,n),ie(";")):(ie("require("),I(t),ie(");")),be.writeLine()}function O(t){return t?227===t.kind?n.isDeclarationVisible(t):e.forEach(t.elements,function(e){return n.isDeclarationVisible(e)}):void 0}function R(e){if(Ce(e),2&e.flags&&ie("export "),ie("import "),e.importClause){var t=be.getTextPos();e.importClause.name&&n.isDeclarationVisible(e.importClause)&&_e(de,e.importClause.name),e.importClause.namedBindings&&O(e.importClause.namedBindings)&&(t!==be.getTextPos()&&ie(", "),227===e.importClause.namedBindings.kind?(ie("* as "),_e(de,e.importClause.namedBindings.name)):(ie("{ "),v(e.importClause.namedBindings.elements,F,n.isDeclarationVisible),ie(" }"))),ie(" from ")}I(e),ie(";"),be.writeLine()}function I(r){le=le||221!==r.kind;var a;if(224===r.kind){var i=r;a=e.getExternalModuleImportEqualsDeclarationExpression(i)}else if(221===r.kind)a=r.name;else{var i=r;a=i.moduleSpecifier}if(9===a.kind&&o&&(ke.out||ke.outFile)){var s=e.getExternalModuleNameFromDeclaration(t,n,r);if(s)return ie('"'),ie(s),void ie('"')}_e(de,a)}function F(e){e.propertyName&&(_e(de,e.propertyName),ie(" as ")),_e(de,e.name)}function L(e){F(e);var t=n.collectLinkedAliases(e.propertyName||e.name);l(t)}function M(e){Ce(e),ie("export "),e.exportClause?(ie("{ "),v(e.exportClause.elements,L),ie(" }")):ie("*"),e.moduleSpecifier&&(ie(" from "),I(e)),ie(";"),be.writeLine()}function B(t){for(Ce(t),A(t),e.isGlobalScopeAugmentation(t)?ie("global "):(ie(65536&t.flags?"namespace ":"module "),e.isExternalModuleAugmentation(t)?I(t):_e(de,t.name));222!==t.body.kind;)t=t.body,ie("."),_e(de,t.name);var n=ue;ue=t,ie(" {"),oe(),se(),y(t.body.statements),ce(),ie("}"),oe(),ue=n}function z(t){function n(n){return{diagnosticMessage:e.Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1,errorNode:t.type,typeName:t.name}}var r=ue;ue=t,Ce(t),A(t),ie("type "),_e(de,t.name),U(t.typeParameters),ie(" = "),b(t.type,n),ie(";"),oe(),ue=r}function K(t){Ce(t),A(t),e.isConst(t)&&ie("const "),ie("enum "),_e(de,t.name),ie(" {"),oe(),se(),y(t.members),ce(),ie("}"),oe()}function j(e){Ce(e),_e(de,e.name);var t=n.getConstantValue(e);void 0!==t&&(ie(" = "),ie(t.toString())),ie(","),oe()}function J(e){return 144===e.parent.kind&&16&e.parent.flags}function U(t){function n(t){function n(n){var r;switch(t.parent.kind){case 217:r=e.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1;break;case 218:r=e.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1;break;case 149:r=e.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;break;case 148:r=e.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;break;case 144:case 143:r=64&t.parent.flags?e.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1:217===t.parent.parent.kind?e.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1:e.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;break;case 216:r=e.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1;break;default:e.Debug.fail("This is unknown parent for type parameter: "+t.parent.kind)}return{diagnosticMessage:r,errorNode:t,typeName:t.name}}se(),Ce(t),ce(),_e(de,t.name),t.constraint&&!J(t)&&(ie(" extends "),153===t.parent.kind||154===t.parent.kind||t.parent.parent&&156===t.parent.parent.kind?(e.Debug.assert(144===t.parent.kind||143===t.parent.kind||153===t.parent.kind||154===t.parent.kind||148===t.parent.kind||149===t.parent.kind),x(t.constraint)):b(t.constraint,n))}t&&(ie("<"),v(t,n),ie(">"))}function q(t,n){function r(t){function r(r){var a;return a=217===t.parent.parent.kind?n?e.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1:e.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1:e.Diagnostics.Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1,{diagnosticMessage:a,errorNode:t,typeName:t.parent.parent.name}}e.isSupportedExpressionWithTypeArguments(t)?b(t,r):n||93!==t.expression.kind||ie("null")}t&&(ie(n?" implements ":" extends "),v(t,r))}function W(t){function n(t){t&&e.forEach(t.parameters,function(e){56&e.flags&&H(e)})}Ce(t),A(t),128&t.flags&&ie("abstract "),ie("class "),_e(de,t.name);var r=ue;ue=t,U(t.typeParameters);var a=e.getClassExtendsHeritageClauseElement(t);a&&q([a],!1),q(e.getClassImplementsHeritageClauseElements(t),!0),ie(" {"),oe(),se(),n(e.getFirstConstructorWithBody(t)),y(t.members),ce(),ie("}"),oe(),ue=r}function V(t){Ce(t),A(t),ie("interface "),_e(de,t.name);var n=ue;ue=t,U(t.typeParameters),q(e.getInterfaceBaseTypeNodes(t),!1),ie(" {"),oe(),se(),y(t.members),ce(),ie("}"),oe(),ue=n}function H(t){e.hasDynamicName(t)||(Ce(t),P(t),G(t),ie(";"),oe())}function G(t){function r(n){return 214===t.kind?n.errorModuleName?2===n.accessibility?e.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:e.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2:e.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1:142===t.kind||141===t.kind?64&t.flags?n.errorModuleName?2===n.accessibility?e.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:e.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2:e.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1:217===t.parent.kind?n.errorModuleName?2===n.accessibility?e.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:e.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2:e.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1:n.errorModuleName?e.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2:e.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1:void 0}function a(e){var n=r(e);return void 0!==n?{diagnosticMessage:n,errorNode:t,typeName:t.name}:void 0}function i(e){for(var t=[],n=0,r=e.elements;n<r.length;n++){var a=r[n];190!==a.kind&&t.push(a)}v(t,o)}function o(t){function n(e){var n=r(e);return void 0!==n?{diagnosticMessage:n,errorNode:t,typeName:t.name}:void 0}t.name&&(e.isBindingPattern(t.name)?i(t.name):(_e(de,t.name),m(t,void 0,n)))}(214!==t.kind||n.isDeclarationVisible(t))&&(e.isBindingPattern(t.name)?i(t.name):(_e(de,t.name),142!==t.kind&&141!==t.kind||!e.hasQuestionToken(t)||ie("?"),142!==t.kind&&141!==t.kind||156!==t.parent.kind?16&t.flags||m(t,t.type,a):X(t)))}function X(e){e.type&&(ie(": "),x(e.type))}function Q(t){return e.forEach(t.declarationList.declarations,function(e){return n.isDeclarationVisible(e)})}function Y(t){Ce(t),A(t),ie(e.isLet(t.declarationList)?"let ":e.isConst(t.declarationList)?"const ":"var "),v(t.declarationList.declarations,G,n.isDeclarationVisible),ie(";"),oe()}function $(t){function n(e){return e?146===e.kind?e.type:e.parameters.length>0?e.parameters[0].type:void 0:void 0}function r(t){var n;return 147===a.kind?(n=64&a.parent.flags?t.errorModuleName?e.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2:e.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1:t.errorModuleName?e.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2:e.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1,{diagnosticMessage:n,errorNode:a.parameters[0],typeName:a.name}):(n=64&a.flags?t.errorModuleName?2===t.accessibility?e.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named:e.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1:e.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0:t.errorModuleName?2===t.accessibility?e.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named:e.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1:e.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0,{diagnosticMessage:n,errorNode:a.name,typeName:void 0})}if(!e.hasDynamicName(t)){var a,i=e.getAllAccessorDeclarations(t.parent.members,t);if(t===i.firstAccessor){if(Ce(i.getAccessor),Ce(i.setAccessor),P(t),_e(de,t.name),!(16&t.flags)){a=t;var o=n(t);if(!o){var s=146===t.kind?i.setAccessor:i.getAccessor;o=n(s),o&&(a=s)}m(t,o,r)}ie(";"),oe()}}}function Z(t){e.hasDynamicName(t)||n.isImplementationOfOverload(t)||(Ce(t),216===t.kind?A(t):144===t.kind&&P(t),216===t.kind?(ie("function "),_e(de,t.name)):145===t.kind?ie("constructor"):(_e(de,t.name),e.hasQuestionToken(t)&&ie("?")),te(t))}function ee(e){Ce(e),te(e)}function te(t){function n(n){var r;switch(t.kind){case 149:r=n.errorModuleName?e.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1:e.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0;break;case 148:r=n.errorModuleName?e.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1:e.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0;break;case 150:r=n.errorModuleName?e.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1:e.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0;break;case 144:case 143:r=64&t.flags?n.errorModuleName?2===n.accessibility?e.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named:e.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1:e.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0:217===t.parent.kind?n.errorModuleName?2===n.accessibility?e.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named:e.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1:e.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0:n.errorModuleName?e.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1:e.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0;break;case 216:r=n.errorModuleName?2===n.accessibility?e.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named:e.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1:e.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0;break;default:e.Debug.fail("This is unknown kind for signature: "+t.kind)}return{diagnosticMessage:r,errorNode:t.name||t}}var r=ue;ue=t,149!==t.kind&&154!==t.kind||ie("new "),U(t.typeParameters),ie(150===t.kind?"[":"("),v(t.parameters,ne),ie(150===t.kind?"]":")");var a=153===t.kind||154===t.kind;a||156===t.parent.kind?t.type&&(ie(a?" => ":": "),x(t.type)):145===t.kind||16&t.flags||g(t,n),ue=r,a||(ie(";"),oe())}function ne(t){function r(e){var n=a(e);return void 0!==n?{diagnosticMessage:n,errorNode:t,typeName:t.name}:void 0}function a(n){switch(t.parent.kind){case 145:return n.errorModuleName?2===n.accessibility?e.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:e.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2:e.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1;case 149:return n.errorModuleName?e.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2:e.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;case 148:return n.errorModuleName?e.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2:e.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;case 144:case 143:return 64&t.parent.flags?n.errorModuleName?2===n.accessibility?e.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:e.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2:e.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1:217===t.parent.parent.kind?n.errorModuleName?2===n.accessibility?e.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:e.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2:e.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1:n.errorModuleName?e.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2:e.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;case 216:return n.errorModuleName?2===n.accessibility?e.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named:e.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2:e.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1;default:e.Debug.fail("This is unknown parent for parameter: "+t.parent.kind)}}function i(e){if(164===e.kind)ie("{"),v(e.elements,o),ie("}");else if(165===e.kind){ie("[");var t=e.elements;v(t,o),t&&t.hasTrailingComma&&ie(", "),ie("]")}}function o(t){190===t.kind?ie(" "):166===t.kind&&(t.propertyName&&(_e(de,t.propertyName),ie(": ")),t.name&&(e.isBindingPattern(t.name)?i(t.name):(e.Debug.assert(69===t.name.kind),t.dotDotDotToken&&ie("..."),_e(de,t.name))))}se(),Ce(t),t.dotDotDotToken&&ie("..."),e.isBindingPattern(t.name)?i(t.name):_e(de,t.name),n.isOptionalParameter(t)&&ie("?"),ce(),153===t.parent.kind||154===t.parent.kind||156===t.parent.parent.kind?X(t):16&t.parent.flags||m(t,t.type,r)}function re(e){switch(e.kind){case 216:case 221:case 224:case 218:case 217:case 219:case 220:return E(e,T(e));case 196:return E(e,Q(e));case 225:return E(e,!e.importClause);case 231:return M(e);case 145:case 144:case 143:return Z(e);case 149:case 148:case 150:return ee(e);case 146:case 147:return $(e);case 142:case 141:return H(e);case 250:return j(e);case 230:return S(e);case 251:return C(e)}}function ae(n,r){function i(t,a,i){i&&!r||(e.Debug.assert(!!t.declarationFilePath||e.isSourceFileJavaScript(n),"Declaration file is not present only for javascript files"),o=t.declarationFilePath||t.jsFilePath,s=i)}var o,s=!1;return e.isDeclarationFile(n)?o=n.fileName:e.forEachExpectedEmitFile(t,i,n),o&&(o=e.getRelativePathToDirectoryOrUrl(e.getDirectoryPath(e.normalizeSlashes(a)),o,t.getCurrentDirectory(),t.getCanonicalFileName,!1),Te+='/// <reference path="'+o+'" />'+ve),s}var ie,oe,se,ce,_e,ue,le,de,pe,fe,me,ge,ye,he,ve=t.getNewLine(),ke=t.getCompilerOptions(),be=_(),xe=!1,Ce=ke.removeComments?function(e){}:k,De=ke.stripInternal?c:re,Se=[],Te="",Ee=[],we=!1,Ae=[];return e.forEach(i,function(n){if(!e.isSourceFileJavaScript(n)){if(ke.noResolve||e.forEach(n.referencedFiles,function(r){var a=e.tryResolveScriptReference(t,n,r);a&&!e.contains(Ee,a)&&(ae(a,!o&&!we)&&(we=!0),Ee.push(a))}),le=!1,o&&e.isExternalModule(n)?e.isExternalModule(n)&&(ye=!0,ie('declare module "'+e.getResolvedExternalModuleName(t,n)+'" {'),oe(),se(),C(n),ce(),ie("}"),oe()):(ye=!1,C(n)),Se.length){var r=be;e.forEach(Se,function(t){if(t.isVisible&&!t.asynchronousOutput){e.Debug.assert(225===t.node.kind),_(),e.Debug.assert(0===t.indent||1===t.indent&&o);for(var n=0;n<t.indent;n++)se();R(t.node),t.asynchronousOutput=be.getText();for(var n=0;n<t.indent;n++)ce()}}),u(r),Ae=Ae.concat(Se),Se=[]}!o&&e.isExternalModule(n)&&n.moduleAugmentations.length&&!le&&(ie("export {};"),oe())}}),{reportedDeclarationError:xe,moduleElementDeclarationEmitInfo:Ae,synchronousDeclarationOutput:be.getText(),referencePathsOutput:Te}}function r(t,r,a,i,o,s){function c(t,n){var r=0,a="";return e.forEach(n,function(e){e.asynchronousOutput&&(a+=t.substring(r,e.outputPos),a+=c(e.asynchronousOutput,e.subModuleElementDeclarationEmitInfo),r=e.outputPos)}),a+=t.substring(r)}var _=n(i,o,s,t,r,a),u=_.reportedDeclarationError||i.isEmitBlocked(t)||i.getCompilerOptions().noEmit;if(!u){var l=_.referencePathsOutput+c(_.synchronousDeclarationOutput,_.moduleElementDeclarationEmitInfo);e.writeFile(i,s,t,l,i.getCompilerOptions().emitBOM)}return u}e.getDeclarationDiagnostics=t,e.writeDeclarationFile=r}(ts||(ts={}));var ts;!function(e){function t(t,n){return n.moduleName||e.getExternalModuleNameFromPath(t,n.fileName)}function n(n,r,a){var i=r.getExternalModuleFileFromDeclaration(a);if(i&&!e.isDeclarationFile(i))return t(n,i)}function r(r,a,i){function s(t,n){for(var r=n;e.isNodeDescendentOf(r,n);r=r.nextContainer)if(r.locals&&e.hasProperty(r.locals,t)&&9544639&r.locals[t].flags)return!1;return!0}function c(e,t,n,r){t?(e.labeledNonLocalBreaks||(e.labeledNonLocalBreaks={}),e.labeledNonLocalBreaks[n]=r):(e.labeledNonLocalContinues||(e.labeledNonLocalContinues={}),e.labeledNonLocalContinues[n]=r)}function _(e,t){function n(t){if(69===t.kind)e.hoistedLocalVariables.push(t);else for(var r=0,a=t.elements;r<a.length;r++){var i=a[r];n(i.name)}}e.hoistedLocalVariables||(e.hoistedLocalVariables=[]),n(t.name)}function u(){function i(t,n,r,a){ci.initialize(t,n,r,a),Ma={},Ba=[],Ka=[],ti=!a,a&&k&&e.forEach(r,na),e.forEach(r,u),ii();var i=ci.getSourceMappingURL();i&&ri("//# sourceMappingURL="+i),O(ni.getText(),t,n,h.emitBOM),ci.reset(),ni.reset(),wa=void 0,Aa=void 0,Pa=void 0,Fa=void 0,La=void 0,Ma=void 0,Ba=void 0,Ka=void 0,za=void 0,ja=void 0,Ja=!1,qa=!1,Wa=!1,Va=!1,Ua=!1,pi=0,Ha=void 0,Ga=void 0,Xa=void 0,Qa=void 0,Ya=void 0,$a=void 0,Za=void 0,ei=void 0,Ra=!1,Oa=void 0,Ia=!1}function u(t){wa=t,Aa=t.text,Pa=e.getLineStarts(t),Fa=void 0,La=void 0,Ra=t.symbol&&t.symbol.exports&&!!t.symbol.exports.___esModule,Oa=t.renamedDependencies,Na=t.identifiers,Ia=e.isExternalModule(t),_i(t),ia(t)}function l(t){return!r.hasGlobalName(t)&&!e.hasProperty(Na,t)&&!e.hasProperty(Ma,t)}function C(e){if(e&&!(pi&e)){var t=268435456===e?"_i":"_n";if(l(t))return pi|=e,t}for(;;){var n=268435455πif(pi++,8!==n&&13!==n){var r=26>n?"_"+String.fromCharCode(97+n):"_"+(n-26);if(l(r))return r}}}function S(e){95!==e.charCodeAt(e.length-1)&&(e+="_");for(var t=1;;){var n=e+t;if(l(n))return Ma[n]=n;t++}}function T(e){var t=e.name.text;return s(t,e)?t:S(t)}function E(t){var n=e.getExternalModuleName(t),r=9===n.kind?e.escapeIdentifier(e.makeIdentifierFromModuleName(n.text)):"module";return S(r)}function w(){return S("default")}function A(){return S("class")}function P(e){switch(e.kind){case 69:return S(e.text);case 221:case 220:return T(e);case 225:case 231:return E(e);case 216:case 217:case 230:return w();case 189:return A()}}function N(t){var n=e.getNodeId(t);return Ba[n]||(Ba[n]=e.unescapeIdentifier(P(t)))}function O(t,n,r,i){h.sourceMap&&!h.inlineSourceMap&&e.writeFile(a,x,r,ci.getText(),!1),b&&b.push(ci.getSourceMapData()),e.writeFile(a,x,n,t,i)}function R(t){var n=e.createSynthesizedNode(69);return n.text=C(t),n}function I(e){Ha||(Ha=[]),Ha.push(e)}function F(e){var t=R(e);return I(t),t}function L(e){Ha&&(e?ii():ri(" "),ri("var "),J(Ha),ri(";"))}function M(t,n,r){var a=e.skipTrivia(Aa,n);di(a);var i=e.tokenToString(t);r?r():ri(i);var o=a+i.length;return di(o),o}function B(e,t){t&&(ri(e),aa(t))}function z(e,t){t&&ri("("),aa(e),t&&ri(")")}function K(t,n,r,a){e.Debug.assert(n.length>0),oi(),Lt(t,n[0])?a&&ri(" "):ii();for(var i=0,o=n.length;o>i;i++)i&&(Bt(n[i-1],n[i])?ri(", "):(ri(","),ii())),aa(n[i]);n.hasTrailingComma&&r&&ri(","),si(),Mt(t,e.lastOrUndefined(n))?a&&ri(" "):ii()}function j(e,t,n,r,a,i,o,s){s||(s=aa);for(var c=0;n>c;c++){r?((c||i)&&ri(","),ii()):(c||i)&&ri(", ");var _=e[t+c];Ca(_.pos),s(_),i=!0}return a&&ri(","),r&&!o&&ii(),n}function J(e){e&&j(e,0,e.length,!1,!1)}function U(e){q(e,0)}function q(e,t){for(var n=t;n<e.length;n++)ii(),aa(e[n])}function W(e,t){if(8===e.kind&&t.length>1)switch(t.charCodeAt(1)){case 98:case 66:case 111:case 79:
return!0}return!1}function V(t){var n=H(t);!h.sourceMap&&!h.inlineSourceMap||9!==t.kind&&!e.isTemplateLiteralKind(t.kind)?ri(2>v&&W(t,n)?t.text:n):ni.writeLiteral(n)}function H(t){if(2>v&&(e.isTemplateLiteralKind(t.kind)||t.hasExtendedUnicodeEscape))return G('"',t.text,'"');if(t.parent)return e.getTextOfNodeFromSourceText(Aa,t);switch(t.kind){case 9:return G('"',t.text,'"');case 11:return G("`",t.text,"`");case 12:return G("`",t.text,"${");case 13:return G("}",t.text,"${");case 14:return G("}",t.text,"`");case 8:return t.text}e.Debug.fail("Literal kind '"+t.kind+"' not accounted for.")}function G(t,n,r){return t+e.escapeNonAsciiCharacters(e.escapeString(n))+r}function X(t){var n=e.getTextOfNodeFromSourceText(Aa,t),r=11===t.kind||14===t.kind;n=n.substring(1,n.length-(r?1:2)),n=n.replace(/\r\n?/g,"\n"),n=e.escapeString(n),ri('"'+n+'"')}function Q(t,n){ri("["),11===t.template.kind?n(t.template):(n(t.template.head),e.forEach(t.template.templateSpans,function(e){ri(", "),n(e.literal)})),ri("]")}function Y(t){var n=F(0);ri("("),aa(n),ri(" = "),Q(t,aa),ri(", "),aa(n),ri(".raw = "),Q(t,X),ri(", "),z(t.tag,ge(t.tag)),ri("("),aa(n),186===t.template.kind&&e.forEach(t.template.templateSpans,function(e){ri(", ");var t=184===e.expression.kind&&24===e.expression.operatorToken.kind;z(e.expression,t)}),ri("))")}function $(t){function n(){return e.Debug.assert(0!==t.templateSpans.length),0!==t.head.text.length||0===t.templateSpans[0].literal.text.length}function r(e,t){switch(t.kind){case 171:case 172:return t.expression===e;case 173:case 175:return!1;default:return-1!==a(t)}}function a(e){switch(e.kind){case 184:switch(e.operatorToken.kind){case 37:case 39:case 40:return 1;case 35:case 36:return 0;default:return-1}case 187:case 185:return-1;default:return 1}}if(v>=2)return void e.forEachChild(t,aa);var i=e.isExpression(t.parent)&&r(t,t.parent);i&&ri("(");var o=!1;n()&&(V(t.head),o=!0);for(var s=0,c=t.templateSpans.length;c>s;s++){var _=t.templateSpans[s],u=175!==_.expression.kind&&1!==a(_.expression);(s>0||o)&&ri(" + "),z(_.expression,u),0!==_.literal.text.length&&(ri(" + "),V(_.literal))}i&&ri(")")}function Z(e){aa(e.expression),aa(e.literal)}function ee(t){function n(t){69===t.kind&&e.isIntrinsicJsxName(t.text)?(ri('"'),aa(t),ri('"')):aa(t)}function r(e){/^[A-Za-z_]\w*$/.test(e.text)?aa(e):(ri('"'),aa(e),ri('"'))}function a(e){r(e.name),ri(": "),e.initializer?aa(e.initializer):ri("true")}function i(t,r){var i=e.createSynthesizedNode(69);if(i.text=h.reactNamespace?h.reactNamespace:"React",i.parent=t,ka(t),ae(i),ri(".createElement("),n(t.tagName),ri(", "),0===t.attributes.length)ri("null");else{var o=t.attributes;if(e.forEach(o,function(e){return 242===e.kind})){ri("__assign(");for(var s=!1,c=0;c<o.length;c++)242===o[c].kind?(0===c&&ri("{}, "),s&&(ri("}"),s=!1),c>0&&ri(", "),aa(o[c].expression)):(e.Debug.assert(241===o[c].kind),s?ri(", "):(s=!0,c>0&&ri(", "),ri("{")),a(o[c]));s&&ri("}"),ri(")")}else{ri("{");for(var c=0,_=o.length;_>c;c++)c>0&&ri(", "),a(o[c]);ri("}")}}if(r)for(var c=0;c<r.length;c++)if(243!==r[c].kind||r[c].expression)if(239===r[c].kind){var u=Xr(r[c]);void 0!==u&&(ri(', "'),ri(u),ri('"'))}else ri(", "),aa(r[c]);ri(")"),xa(t)}236===t.kind?i(t.openingElement,t.children):(e.Debug.assert(237===t.kind),i(t))}function te(t){function n(e){aa(e.name),e.initializer&&(ri("="),aa(e.initializer))}function r(e){ri("{..."),aa(e.expression),ri("}")}function a(t){for(var a=0,i=t.length;i>a;a++)a>0&&ri(" "),242===t[a].kind?r(t[a]):(e.Debug.assert(241===t[a].kind),n(t[a]))}function i(e){ri("<"),aa(e.tagName),(e.attributes.length>0||237===e.kind)&&ri(" "),a(e.attributes),ri(237===e.kind?"/>":">")}function o(e){ri("</"),aa(e.tagName),ri(">")}function s(e){i(e.openingElement);for(var t=0,n=e.children.length;n>t;t++)aa(e.children[t]);o(e.closingElement)}236===t.kind?s(t):(e.Debug.assert(237===t.kind),i(t))}function ne(t){if(e.Debug.assert(166!==t.kind),9===t.kind)V(t);else if(137===t.kind){if(e.nodeIsDecorated(t.parent)){za||(za=[]);var n=za[e.getNodeId(t)];if(n)return void ri(n);n=F(0).text,za[e.getNodeId(t)]=n,ri(n),ri(" = ")}aa(t.expression)}else ri('"'),8===t.kind?ri(t.text):ai(Aa,t),ri('"')}function re(e){var t=e.parent;switch(t.kind){case 167:case 192:case 184:case 171:case 244:case 137:case 185:case 140:case 178:case 200:case 170:case 230:case 198:case 191:case 202:case 203:case 204:case 199:case 240:case 237:case 238:case 242:case 243:case 172:case 175:case 183:case 182:case 207:case 249:case 188:case 209:case 173:case 193:case 211:case 174:case 179:case 180:case 201:case 208:case 187:return!0;case 166:case 250:case 139:case 248:case 142:case 214:return t.initializer===e;case 169:return t.expression===e;case 177:case 176:return t.body===e;case 224:return t.moduleReference===e;case 136:return t.left===e}return!1}function ae(t){var n=r.getReferencedExportContainer(t);if(n)251===n.kind?5!==k&&4!==k&&ri("exports."):(ri(N(n)),ri("."));else{if(5!==k){var a=r.getReferencedImportDeclaration(t);if(a){if(226===a.kind)return ri(N(a.parent)),void ri(0===v?'["default"]':".default");if(229===a.kind){ri(N(a.parent.parent.parent));var i=a.propertyName||a.name,o=e.getTextOfNodeFromSourceText(Aa,i);return void(0===v&&"default"===o?ri('["default"]'):(ri("."),ri(o)))}}}if(2>v){var a=r.getReferencedDeclarationWithCollidingName(t);if(a)return void ri(N(a.name))}else if(1048576&r.getNodeCheckFlags(t)){var a=r.getReferencedValueDeclaration(t);if(a){var s=Ka[e.getNodeId(a)];if(void 0!==s)return void ri(s)}}}e.nodeIsSynthesized(t)?ri(t.text):ai(Aa,t)}function ie(e){if(2>v){var t=e.parent;switch(t.kind){case 166:case 217:case 220:case 214:return t.name===e&&r.isDeclarationWithCollidingName(t)}}return!1}function oe(t){if(ja&&"arguments"==t.text&&r.isArgumentsLocalBinding(t)){var n=ja.argumentsName||(ja.argumentsName=S("arguments"));return void ri(n)}t.parent?re(t)?ae(t):ie(t)?ri(N(t)):e.nodeIsSynthesized(t)?ri(t.text):ai(Aa,t):ri(t.text)}function se(e){ri(2&r.getNodeCheckFlags(e)?"_this":ja?ja.thisName||(ja.thisName=S("this")):"this")}function ce(e){if(v>=2)ri("super");else{var t=r.getNodeCheckFlags(e);ri(256&t?"_super.prototype":"_super")}}function _e(e){ri("{ ");var t=e.elements;j(t,0,t.length,!1,t.hasTrailingComma),ri(" }")}function ue(e){ri("[");var t=e.elements;j(t,0,t.length,!1,t.hasTrailingComma),ri("]")}function le(t){t.propertyName&&(aa(t.propertyName),ri(": ")),t.dotDotDotToken&&ri("..."),e.isBindingPattern(t.name)?aa(t.name):Gt(t),B(" = ",t.initializer)}function de(e){ri("..."),aa(e.expression)}function pe(t){ri(e.tokenToString(114)),t.asteriskToken&&ri("*"),t.expression&&(ri(" "),aa(t.expression))}function fe(t){var n=me(t);n&&ri("("),ri(e.tokenToString(114)),ri(" "),aa(t.expression),n&&ri(")")}function me(t){return 184!==t.parent.kind||e.isAssignmentOperator(t.parent.operatorToken.kind)?185===t.parent.kind&&t.parent.condition===t:!0}function ge(e){switch(e.kind){case 69:case 167:case 169:case 170:case 171:case 175:return!1}return!0}function ye(e,t,n,r,a){for(var i=0,o=0,s=e.length;s>i;){1===o&&a?ri(".concat("):o>0&&ri(", ");var c=e[i];if(188===c.kind)c=c.expression,z(c,0===o&&ge(c)),i++,i===s&&0===o&&t&&167!==c.kind&&ri(".slice()");else{for(var _=i;s>_&&188!==e[_].kind;)_++;ri("["),n&&oi(),j(e,i,_-i,n,r&&_===s),n&&si(),ri("]"),i=_}o++}o>1&&a&&ri(")")}function he(e){return 188===e.kind}function ve(t){var n=t.elements;0===n.length?ri("[]"):v>=2||!e.forEach(n,he)?(ri("["),K(t,t.elements,n.hasTrailingComma,!1),ri("]")):ye(n,!0,0!==(1024&t.flags),n.hasTrailingComma,!0)}function ke(e,t){if(0===t)return void ri("{}");if(ri("{"),t>0){var n=e.properties;if(t===n.length)K(e,n,v>=1,!0);else{var r=0!==(1024&e.flags);r?oi():ri(" "),j(n,0,t,r,!1),r?si():ri(" ")}}ri("}")}function be(t,n){function r(){a?(ri(","),ii()):ri(", ")}var a=0!==(1024&t.flags),i=t.properties;ri("("),a&&oi();var o=F(0);aa(o),ri(" = "),ke(t,n);for(var s=n,c=i.length;c>s;s++){r();var _=i[s];if(ui(_),146===_.kind||147===_.kind){var u=e.getAllAccessorDeclarations(t.properties,_);if(_!==u.firstAccessor)continue;ri("Object.defineProperty("),aa(o),ri(", "),ui(t.name),ne(_.name),li(_.name),ri(", {"),oi(),u.getAccessor&&(ii(),ka(u.getAccessor),ri("get: "),ui(u.getAccessor),ri("function "),Cn(u.getAccessor),li(u.getAccessor),xa(u.getAccessor),ri(",")),u.setAccessor&&(ii(),ka(u.setAccessor),ri("set: "),ui(u.setAccessor),ri("function "),Cn(u.setAccessor),li(u.setAccessor),xa(u.setAccessor),ri(",")),ii(),ri("enumerable: true,"),ii(),ri("configurable: true"),si(),ii(),ri("})"),li(_)}else ka(_),ui(_.name),aa(o),Pn(_.name),li(_.name),ri(" = "),248===_.kind?aa(_.initializer):249===_.kind?ae(_.name):144===_.kind?yn(_):e.Debug.fail("ObjectLiteralElement type not accounted for: "+_.kind);li(_)}r(),aa(o),a&&(si(),ii()),ri(")")}function xe(e){var t=e.properties;if(2>v){for(var n=t.length,r=n,a=0,i=t.length;i>a;a++)if(137===t[a].name.kind){r=a;break}var o=r!==t.length;if(o)return void be(e,r)}ke(e,t.length)}function Ce(t,n,r,a){var i=e.createSynthesizedNode(184,a);return i.operatorToken=e.createSynthesizedNode(n),i.left=t,i.right=r,i}function De(t,n){var r=e.createSynthesizedNode(169);return r.expression=Te(t),r.dotToken=e.createSynthesizedNode(21),r.name=n,r}function Se(t,n){var r=e.createSynthesizedNode(170);return r.expression=Te(t),r.argumentExpression=n,r}function Te(t){for(;174===t.kind||192===t.kind;)t=t.expression;if(e.isLeftHandSideExpression(t)&&172!==t.kind&&8!==t.kind)return t;var n=e.createSynthesizedNode(175);return n.expression=t,n}function Ee(e){ri("["),ne(e),ri("]")}function we(e){v>=2&&e.asteriskToken&&ri("*"),aa(e.name),2>v&&ri(": function "),Cn(e)}function Ae(e){aa(e.name),ri(": "),Ca(e.initializer.pos),aa(e.initializer)}function Pe(e){var t=r.getReferencedExportContainer(e);return t&&251!==t.kind}function Ne(e){ai(Aa,e.name),(5!==k||Pe(e.name))&&(ri(": "),aa(e.name)),v>=2&&e.objectAssignmentInitializer&&(ri(" = "),aa(e.objectAssignmentInitializer))}function Oe(t){var n=Re(t);if(void 0!==n){if(ri(n.toString()),!h.removeComments){var r=169===t.kind?e.declarationNameToString(t.name):e.getTextOfNode(t.argumentExpression);ri(" /* "+r+" */")}return!0}return!1}function Re(e){return h.isolatedModules?void 0:169===e.kind||170===e.kind?r.getConstantValue(e):void 0}function Ie(t,n,r,a){var i=!e.nodeIsSynthesized(t)&&!Bt(n,r),o=ot(r);return i||o?(oi(),ii(),!0):(a&&ri(a),!1)}function Fe(t){if(!Oe(t)){if(2===v&&95===t.expression.kind&&qe(t)){var n=e.createSynthesizedNode(9);return n.text=t.name.text,void We(t.expression,n)}aa(t.expression);var r=Ie(t,t.expression,t.dotToken),a=!1;if(!r)if(8===t.expression.kind){var i=e.getTextOfNodeFromSourceText(Aa,t.expression);a=i.indexOf(e.tokenToString(21))<0}else{var o=Re(t.expression);a=isFinite(o)&&Math.floor(o)===o}ri(a?" .":".");var s=Ie(t,t.dotToken,t.name);aa(t.name),ct(r,s)}}function Le(e){aa(e.left),ri("."),aa(e.right)}function Me(e,t){if(69===e.left.kind)Be(e.left,t);else if(t){var n=F(0);ri("("),ca(n),ri(" = "),Be(e.left,!0),ri(") && "),ca(n)}else Be(e.left,!1);ri("."),aa(e.right)}function Be(e,t){switch(e.kind){case 69:t&&(ri("typeof "),ae(e),ri(" !== 'undefined' && ")),ae(e);break;case 136:Me(e,t);break;default:ca(e)}}function ze(e){if(!Oe(e)){if(2===v&&95===e.expression.kind&&qe(e))return void We(e.expression,e.argumentExpression);aa(e.expression),ri("["),aa(e.argumentExpression),ri("]")}}function Ke(t){return e.forEach(t,function(e){return 188===e.kind})}function je(e){for(;175===e.kind||174===e.kind||192===e.kind;)e=e.expression;return e}function Je(e){if(69===e.kind||97===e.kind||95===e.kind)return aa(e),e;var t=F(0);return ri("("),aa(t),ri(" = "),aa(e),ri(")"),t}function Ue(e){var t,n=je(e.expression);169===n.kind?(t=Je(n.expression),ri("."),aa(n.name)):170===n.kind?(t=Je(n.expression),ri("["),aa(n.argumentExpression),ri("]")):95===n.kind?(t=n,ri("_super")):aa(e.expression),ri(".apply("),t?95===t.kind?se(t):aa(t):ri("void 0"),ri(", "),ye(e.arguments,!1,!1,!1,!0),ri(")")}function qe(t){if(2===v){var n=e.getSuperContainer(t,!1);if(n&&6144&r.getNodeCheckFlags(n))return!0}return!1}function We(t,n){var a=e.getSuperContainer(t,!1),i=4096&r.getNodeCheckFlags(a);ri("_super("),aa(n),ri(i?").value":")")}function Ve(t){if(2>v&&Ke(t.arguments))return void Ue(t);var n=t.expression,r=!1,a=!1;95===n.kind?(ce(n),r=!0):(r=e.isSuperPropertyOrElementAccess(n),a=r&&qe(t),aa(n)),r&&(2>v||a)?(ri(".call("),se(n),t.arguments.length&&(ri(", "),J(t.arguments)),ri(")")):(ri("("),J(t.arguments),ri(")"))}function He(e){if(ri("new "),1===v&&e.arguments&&Ke(e.arguments)){ri("(");var t=Je(e.expression);ri(".bind.apply("),aa(t),ri(", [void 0].concat("),ye(e.arguments,!1,!1,!1,!1),ri(")))"),ri("()")}else aa(e.expression),e.arguments&&(ri("("),J(e.arguments),ri(")"))}function Ge(e){v>=2?(aa(e.tag),ri(" "),aa(e.template)):Y(e)}function Xe(t){if(!e.nodeIsSynthesized(t)&&177!==t.parent.kind&&(174===t.expression.kind||192===t.expression.kind)){for(var n=t.expression.expression;174===n.kind||192===n.kind;)n=n.expression;if(!(182===n.kind||180===n.kind||179===n.kind||178===n.kind||183===n.kind||172===n.kind||171===n.kind&&172===t.parent.kind||176===n.kind&&171===t.parent.kind||8===n.kind&&169===t.parent.kind))return void aa(n)}ri("("),aa(t.expression),ri(")")}function Qe(t){ri(e.tokenToString(78)),ri(" "),aa(t.expression)}function Ye(t){ri(e.tokenToString(103)),ri(" "),aa(t.expression)}function $e(t){ri(e.tokenToString(101)),ri(" "),aa(t.expression)}function Ze(t){if(!Or()||69!==t.kind||e.nodeIsSynthesized(t))return!1;var n=t.parent&&(214===t.parent.kind||166===t.parent.kind),a=n?t.parent:r.getReferencedValueDeclaration(t);return rt(a,!0)}function et(t){var n=(41===t.operator||42===t.operator)&&Ze(t.operand);if(n&&(ri(Fa+'("'),ca(t.operand),ri('", ')),ri(e.tokenToString(t.operator)),182===t.operand.kind){var r=t.operand;35!==t.operator||35!==r.operator&&41!==r.operator?36!==t.operator||36!==r.operator&&42!==r.operator||ri(" "):ri(" ")}aa(t.operand),n&&ri(")")}function tt(t){var n=Ze(t.operand);n?(ri("("+Fa+'("'),ca(t.operand),ri('", '),ri(e.tokenToString(t.operator)),aa(t.operand),ri(41===t.operator?") - 1)":") + 1)")):(aa(t.operand),ri(e.tokenToString(t.operator)))}function nt(e){return rt(e,!1)}function rt(t,n){if(!t||!Or())return!1;for(var r=e.getRootDeclaration(t).parent;r;){if(251===r.kind)return!n||0!==(2&e.getCombinedNodeFlags(t));if(e.isDeclaration(r))return!1;r=r.parent}}function at(t){var n=t.left;if(60===t.operatorToken.kind){var r=void 0,a=!1;if(e.isElementAccessExpression(n)){a=!0,ri("("),r=e.createSynthesizedNode(170,!1);var i=tn(n.expression,!1,!1);if(r.expression=i,8!==n.argumentExpression.kind&&9!==n.argumentExpression.kind){var o=F(268435456);r.argumentExpression=o,en(o,n.argumentExpression,!0,n.expression)}else r.argumentExpression=n.argumentExpression;ri(", ")}else if(e.isPropertyAccessExpression(n)){a=!0,ri("("),r=e.createSynthesizedNode(169,!1);var i=tn(n.expression,!1,!1);r.expression=i,r.dotToken=n.dotToken,r.name=n.name,ri(", ")}aa(r||n),ri(" = "),ri("Math.pow("),aa(r||n),ri(", "),aa(t.right),ri(")"),a&&ri(")")}else ri("Math.pow("),aa(n),ri(", "),aa(t.right),ri(")")}function it(t){if(2>v&&56===t.operatorToken.kind&&(168===t.left.kind||167===t.left.kind))rn(t,198===t.parent.kind);else{var n=t.operatorToken.kind>=56&&t.operatorToken.kind<=68&&Ze(t.left);if(n&&(ri(Fa+'("'),ca(t.left),ri('", ')),38===t.operatorToken.kind||60===t.operatorToken.kind)at(t);else{aa(t.left);var r=Ie(t,t.left,t.operatorToken,24!==t.operatorToken.kind?" ":void 0);ri(e.tokenToString(t.operatorToken.kind));var a=Ie(t,t.operatorToken,t.right," ");aa(t.right),ct(r,a)}n&&ri(")")}}function ot(t){return e.nodeIsSynthesized(t)&&t.startsOnNewLine}function st(e){aa(e.condition);var t=Ie(e,e.condition,e.questionToken," ");ri("?");var n=Ie(e,e.questionToken,e.whenTrue," ");aa(e.whenTrue),ct(t,n);var r=Ie(e,e.whenTrue,e.colonToken," ");ri(":");var a=Ie(e,e.colonToken,e.whenFalse," ");aa(e.whenFalse),ct(r,a)}function ct(e,t){e&&si(),t&&si()}function _t(e){if(e&&195===e.kind){var t=e;return 0===t.statements.length&&Bt(t,t)}}function ut(t){return _t(t)?(M(15,t.pos),ri(" "),void M(16,t.statements.end)):(M(15,t.pos),oi(),222===t.kind&&(e.Debug.assert(221===t.parent.kind),hn(t.parent)),U(t.statements),222===t.kind&&L(!0),si(),ii(),void M(16,t.statements.end))}function lt(e){195===e.kind?(ri(" "),aa(e)):(oi(),ii(),aa(e),si())}function dt(e){z(e.expression,177===e.expression.kind),ri(";")}function pt(e){var t=M(88,e.pos);ri(" "),t=M(17,t),aa(e.expression),M(18,e.expression.end),lt(e.thenStatement),e.elseStatement&&(ii(),M(80,e.thenStatement.end),199===e.elseStatement.kind?(ri(" "),aa(e.elseStatement)):lt(e.elseStatement))}function ft(e){bt(e,mt)}function mt(e,t){ri("do"),t?St(t,!0):Ct(e,!0),195===e.statement.kind?ri(" "):ii(),ri("while ("),aa(e.expression),ri(");")}function gt(e){bt(e,yt)}function yt(e,t){ri("while ("),aa(e.expression),ri(")"),t?St(t,!0):Ct(e,!0)}function ht(t){if(Nr(t,!0))return!1;if(ja&&0===(24576&e.getCombinedNodeFlags(t))){for(var n=0,r=t.declarations;n<r.length;n++){var a=r[n];_(ja,a)}return!1}return ui(t),ri(t&&v>=2?e.isLet(t)?"let ":e.isConst(t)?"const ":"var ":"var "),!0}function vt(e){for(var t=!1,n=0,r=e.declarations;n<r.length;n++){var a=r[n];a.initializer&&(t?ri(", "):t=!0,aa(a))}return t}function kt(e){return 2>v&&0!==(65536&r.getNodeCheckFlags(e))}function bt(e,t){var n=kt(e);if(n){var r=xt(e);210===e.parent.kind&&qt(e.parent),t(e,r)}else t(e,void 0)}function xt(t){function n(e){if(69===e.kind){var t=ie(e)?N(e):e.text;if(s.push(t),2097152&r.getNodeCheckFlags(e.parent)){var a={originalName:e,outParamName:S("out_"+t)};(c||(c=[])).push(a)}}else for(var i=0,o=e.elements;i<o.length;i++){var _=o[i];n(_.name)}}var a,i=S("_loop");switch(t.kind){case 202:case 203:case 204:var o=t.initializer;o&&215===o.kind&&(a=t.initializer)}var s,c;if(a&&24576&e.getCombinedNodeFlags(a)){s=[];for(var _=0,u=a.declarations;_<u.length;_++){var l=u[_];n(l.name)}}var d=195===t.statement.kind,p=s?s.join(", "):"";ii(),ri("var "+i+" = function("+p+")");var f=ja;if(ja={loopOutParameters:c},f&&(f.argumentsName&&(ja.argumentsName=f.argumentsName),f.thisName&&(ja.thisName=f.thisName),f.hoistedLocalVariables&&(ja.hoistedLocalVariables=f.hoistedLocalVariables)),ri(" {"),ii(),oi(),d?U(t.statement.statements):aa(t.statement),ii(),Dt(ja,1,!0),si(),ii(),ri("};"),ii(),c){ri("var ");for(var m=0;m<c.length;m++)0!==m&&ri(", "),ri(c[m].outParamName);ri(";"),ii()}if(ja.argumentsName&&(f?f.argumentsName=ja.argumentsName:(ri("var "+ja.argumentsName+" = arguments;"),ii())),ja.thisName&&(f?f.thisName=ja.thisName:(ri("var "+ja.thisName+" = this;"),ii())),ja.hoistedLocalVariables)if(f)f.hoistedLocalVariables=ja.hoistedLocalVariables;else{ri("var ");for(var g=void 0,y=0,h=ja.hoistedLocalVariables;y<h.length;y++){var v=h[y];g?ri(", "):g={},e.hasProperty(g,v.text)||(aa(v),g[v.text]=v.text)}ri(";"),ii()}var k=ja;return ja=f,{functionName:i,paramList:p,state:k}}function Ct(e,t){var n;ja&&(n=ja.allowedNonLabeledJumps,ja.allowedNonLabeledJumps=6),t?lt(e.statement):195===e.statement.kind?U(e.statement.statements):(ii(),aa(e.statement)),ja&&(ja.allowedNonLabeledJumps=n)}function Dt(e,t,n){if(e.loopOutParameters)for(var r=0,a=e.loopOutParameters;r<a.length;r++){var i=a[r];0===t?(oe(i.originalName),ri(" = "+i.outParamName)):(ri(i.outParamName+" = "),oe(i.originalName)),n?(ri(";"),ii()):ri(", ")}}function St(e,t){function n(e,t,n){(t.labeledNonLocalBreaks||t.labeledNonLocalContinues)&&(ri("switch("+e+") {"),oi(),r(t.labeledNonLocalBreaks,!0,e,n),r(t.labeledNonLocalContinues,!1,e,n),si(),ii(),ri("}"))}function r(e,t,n,r){if(e)for(var a in e){var i=e[a];ii(),ri('case "'+i+'": '),!r||r.labels&&r.labels[a]?(ri(t?"break ":"continue "),ri(a+";")):(c(r,t,a,i),ri("return "+n+";"))}}t&&(ri(" {"),ii(),oi());var a=!e.state.nonLocalJumps&&!e.state.labeledNonLocalBreaks&&!e.state.labeledNonLocalContinues,i=S("state");a||ri("var "+i+" = "),ri(e.functionName+"("+e.paramList+");"),ii(),Dt(e.state,0,!0),a||(ii(),8&e.state.nonLocalJumps&&(ri("if (typeof "+i+' === "object") '),ja?(ri("return "+i+";"),ja.nonLocalJumps|=8):ri("return "+i+".value;"),ii()),2&e.state.nonLocalJumps&&(ri("if ("+i+' === "break") break;'),ii()),4&e.state.nonLocalJumps&&(ri("if ("+i+' === "continue") continue;'),ii()),n(i,e.state,ja)),t&&(ii(),si(),ri("}"))}function Tt(e){bt(e,Et)}function Et(e,t){var n=M(86,e.pos);if(ri(" "),n=M(17,n),e.initializer&&215===e.initializer.kind){var r=e.initializer,a=ht(r);a?J(r.declarations):vt(r)}else e.initializer&&aa(e.initializer);ri(";"),B(" ",e.condition),ri(";"),B(" ",e.incrementor),ri(")"),t?St(t,!0):Ct(e,!0)}function wt(e){2>v&&204===e.kind?bt(e,Pt):bt(e,At)}function At(e,t){var n=M(86,e.pos);if(ri(" "),n=M(17,n),215===e.initializer.kind){var r=e.initializer;r.declarations.length>=1&&(ht(r),aa(r.declarations[0]))}else aa(e.initializer);ri(203===e.kind?" in ":" of "),aa(e.expression),M(18,e.expression.end),t?St(t,!0):Ct(e,!0)}function Pt(t,n){var r=M(86,t.pos);ri(" "),r=M(17,r);var a=R(268435456),i=e.createSynthesizedNode(69);i.text=69===t.expression.kind?S(t.expression.text):C(0),ui(t.expression),ri("var "),ca(a),ri(" = 0"),li(t.expression),ri(", "),ui(t.expression),ca(i),ri(" = "),ca(t.expression),li(t.expression),ri("; "),ui(t.expression),ca(a),ri(" < "),ia(i),ri(".length"),li(t.expression),ri("; "),ui(t.expression),ca(a),ri("++"),li(t.expression),M(18,t.expression.end),ri(" {"),ii(),oi();var o=Se(i,a);if(ui(t.initializer),215===t.initializer.kind){ri("var ");var s=t.initializer;if(s.declarations.length>0){var c=s.declarations[0];e.isBindingPattern(c.name)?rn(c,!1,o):(ia(c),ri(" = "),ca(o))}else ca(R(0)),ri(" = "),ca(o)}else{var _=Ce(t.initializer,56,o,!1);167===t.initializer.kind||168===t.initializer.kind?rn(_,!0,void 0):ia(_)}li(t.initializer),ri(";"),n?(ii(),St(n,!1)):Ct(t,!1),ii(),si(),ri("}")}function Nt(e){if(ja){var t=206===e.kind?2:4,n=e.label&&ja.labels&&ja.labels[e.label.text]||!e.label&&ja.allowedNonLabeledJumps&t;if(!n){if(ri("return "),Dt(ja,1,!1),e.label){var r=void 0;206===e.kind?(r="break-"+e.label.text,c(ja,!0,e.label.text,r)):(r="continue-"+e.label.text,c(ja,!1,e.label.text,r)),ri('"'+r+'";')}else 206===e.kind?(ja.nonLocalJumps|=2,ri('"break";')):(ja.nonLocalJumps|=4,ri('"continue";'));return}}M(206===e.kind?70:75,e.pos),B(" ",e.label),ri(";")}function Ot(e){return ja?(ja.nonLocalJumps|=8,ri("return { value: "),e.expression?aa(e.expression):ri("void 0"),void ri(" };")):(M(94,e.pos),B(" ",e.expression),void ri(";"))}function Rt(e){ri("with ("),aa(e.expression),ri(")"),lt(e.statement)}function It(e){var t=M(96,e.pos);ri(" "),M(17,t),aa(e.expression),t=M(18,e.expression.end),ri(" ");var n;ja&&(n=ja.allowedNonLabeledJumps,ja.allowedNonLabeledJumps|=2),Ft(e.caseBlock,t),ja&&(ja.allowedNonLabeledJumps=n)}function Ft(e,t){M(15,t),oi(),U(e.clauses),si(),ii(),M(16,e.clauses.end)}function Lt(t,n){return e.getLineOfLocalPositionFromLineMap(Pa,e.skipTrivia(Aa,t.pos))===e.getLineOfLocalPositionFromLineMap(Pa,e.skipTrivia(Aa,n.pos))}function Mt(t,n){return e.getLineOfLocalPositionFromLineMap(Pa,t.end)===e.getLineOfLocalPositionFromLineMap(Pa,n.end)}function Bt(t,n){return e.getLineOfLocalPositionFromLineMap(Pa,t.end)===e.getLineOfLocalPositionFromLineMap(Pa,e.skipTrivia(Aa,n.pos))}function zt(e){244===e.kind?(ri("case "),aa(e.expression),ri(":")):ri("default:"),1===e.statements.length&&Lt(e,e.statements[0])?(ri(" "),aa(e.statements[0])):(oi(),U(e.statements),si())}function Kt(e){ri("throw "),aa(e.expression),ri(";")}function jt(e){ri("try "),aa(e.tryBlock),aa(e.catchClause),e.finallyBlock&&(ii(),ri("finally "),aa(e.finallyBlock))}function Jt(e){ii();var t=M(72,e.pos);ri(" "),M(17,t),aa(e.variableDeclaration),M(18,e.variableDeclaration?e.variableDeclaration.end:t),ri(" "),ut(e.block)}function Ut(e){M(76,e.pos),ri(";")}function qt(e){aa(e.label),ri(": ")}function Wt(t){e.isIterationStatement(t.statement,!1)&&kt(t.statement)||qt(t),ja&&(ja.labels||(ja.labels={}),ja.labels[t.label.text]=t.label.text),aa(t.statement),ja&&(ja.labels[t.label.text]=void 0)}function Vt(e){do e=e.parent;while(e&&221!==e.kind);return e}function Ht(e){var t=Vt(e);ri(t?N(t):"exports")}function Gt(t){if(ui(t.name),2&e.getCombinedNodeFlags(t)){var n=Vt(t);n?(ri(N(n)),ri(".")):5!==k&&4!==k&&ri("exports.")}ia(t.name),li(t.name)}function Xt(){var t=e.createSynthesizedNode(8);t.text="0";var n=e.createSynthesizedNode(180);return n.expression=t,n}function Qt(t){251===t.parent.kind&&(e.Debug.assert(!!(512&t.flags)||230===t.kind),1!==k&&2!==k&&3!==k||Ra||(0!==v?(ri('Object.defineProperty(exports, "__esModule", { value: true });'),ii()):(ri("exports.__esModule = true;"),ii())))}function Yt(e){2&e.flags&&(ii(),ui(e),4===k&&e.parent===wa?(ri(Fa+'("'),512&e.flags?ri("default"):ia(e.name),ri('", '),mn(e),ri(")")):(512&e.flags?(Qt(e),ri(0===v?'exports["default"]':"exports.default")):Gt(e),ri(" = "),mn(e)),li(e),ri(";"))}function $t(t){if(4!==k&&!Ya&&Qa&&e.hasProperty(Qa,t.text))for(var n=0,r=Qa[t.text];n<r.length;n++){var a=r[n];ii(),ui(a.name),Ht(a),ri("."),ia(a.name),li(a.name),ri(" = "),ae(t),ri(";")}}function Zt(t){e.Debug.assert(4===k),(r.getReferencedValueDeclaration(t.propertyName||t.name)||r.isValueAliasDeclaration(t))&&(ii(),ui(t.name),ri(Fa+'("'),ia(t.name),ri('", '),ae(t.propertyName||t.name),ri(")"),li(t.name),ri(";"))}function en(e,t,n,r){n&&ri(", ");var a=Ze(e);a&&(ri(Fa+'("'),ia(e),ri('", '));var i=e.parent&&(214===e.parent.kind||166===e.parent.kind);ui(nn(r)?r.parent:r),ua(function(){i?Gt(e.parent):aa(e),ri(" = "),aa(t)}),li(r,!0),a&&ri(")")}function tn(e,t,n,r){var a=R(0);return t||I(a),en(a,e,n,r||e.parent),a}function nn(e){return 214===e.kind&&215===e.parent.kind&&e.parent.declarations[0]===e}function rn(t,n,r){function a(e,t,n){if(69===e.kind&&t)return e;var r=tn(e,g,m>0,n);return m++,r}function i(t,n,r){t=a(t,!0,r);var i=e.createSynthesizedNode(184);return i.left=t,i.operatorToken=e.createSynthesizedNode(32),i.right=Xt(),o(i,n,t)}function o(t,n,r){var a=e.createSynthesizedNode(185);return a.condition=t,a.questionToken=e.createSynthesizedNode(53),a.whenTrue=n,a.colonToken=e.createSynthesizedNode(54),a.whenFalse=r,a}function s(t){var n=e.createSynthesizedNode(8);return n.text=""+t,n}function c(t,n){var r,i=137===n.kind;return i?r=a(n.expression,!1,n):(r=e.createSynthesizedNode(n.kind),r.text=e.unescapeIdentifier(n.text)),i||69!==r.kind?Se(t,r):De(t,r)}function _(t,n){var r=e.createSynthesizedNode(171),a=e.createSynthesizedNode(69);return a.text="slice",r.expression=De(t,a),r.arguments=e.createSynthesizedNodeArray(),r.arguments[0]=s(n),r}function u(e,t,n){var r=e.properties;1!==r.length&&(t=a(t,!0,n));for(var i=0,o=r;i<o.length;i++){var s=o[i];if(248===s.kind||249===s.kind){var _=s.name,u=249===s.kind?s:s.initializer||_;d(u,c(t,_),s)}}}function l(e,t,n){var r=e.elements;1!==r.length&&(t=a(t,!0,n));for(var i=0;i<r.length;i++){var o=r[i];190!==o.kind&&(188!==o.kind?d(o,Se(t,s(i)),o):i===r.length-1&&d(o.expression,_(t,i),o))}}function d(e,t,n){249===e.kind?(e.objectAssignmentInitializer&&(t=i(t,e.objectAssignmentInitializer,n)),e=e.name):184===e.kind&&56===e.operatorToken.kind&&(t=i(t,e.right,n),e=e.left),168===e.kind?u(e,t,n):167===e.kind?l(e,t,n):(en(e,t,m>0,n),m++)}function p(t){var r=t.left,i=t.right;e.isEmptyObjectLiteralOrArrayLiteral(r)?aa(i):n?d(r,i,e.nodeIsSynthesized(t)?r:t):(175!==t.parent.kind&&ri("("),i=a(i,!0,t),d(r,i,t),ri(", "),aa(i),175!==t.parent.kind&&ri(")"))}function f(t,n){if(t.initializer?n=n?i(n,t.initializer,t):t.initializer:n||(n=Xt()),e.isBindingPattern(t.name)){var r=t.name,o=r.elements,u=o.length;1!==u&&(n=a(n,0!==u,t));for(var l=0;u>l;l++){var d=o[l];if(164===r.kind){var p=d.propertyName||d.name;f(d,c(n,p))}else 190!==d.kind&&(d.dotDotDotToken?l===u-1&&f(d,_(n,l)):f(d,Se(n,s(l))))}}else en(t.name,n,m>0,t),m++}var m=0,g=!1;if(214===t.kind){var y=2&e.getCombinedNodeFlags(t),h=nt(t);g=!y&&!h}else 139===t.kind&&(g=!0);184===t.kind?p(t):(e.Debug.assert(!n),nn(t)&&ci.changeEmitSourcePos(),f(t,r))}function an(t){if(e.isBindingPattern(t.name))2>v?rn(t,!1):(aa(t.name),B(" = ",t.initializer));else{var n=t.initializer;if(!n&&2>v&&69===t.name.kind){var a=e.getEnclosingBlockScopeContainer(t),i=r.getNodeCheckFlags(t),o=131072&i,s=262144&i,c=e.isBlockScopedContainerTopLevel(a)||o&&s&&195===a.kind&&e.isIterationStatement(a.parent,!1),_=8192&e.getCombinedNodeFlags(t)&&!c,u=_&&203!==a.kind&&204!==a.kind&&(!r.isDeclarationWithCollidingName(t)||s&&!o&&!e.isIterationStatement(a,!1));u&&(n=Xt())}var l=Ze(t.name);l&&(ri(Fa+'("'),ia(t.name),ri('", ')),Gt(t),B(" = ",n),l&&ri(")")}}function on(t){if(190!==t.kind){var n=t.name;69===n.kind?$t(n):e.isBindingPattern(n)&&e.forEach(n.elements,on)}}function sn(e){return!!(2&e.flags)&&5===k&&251===e.parent.kind}function cn(t){var n=!1;if(2&t.flags?sn(t)&&(ri("export "),n=ht(t.declarationList)):n=ht(t.declarationList),n)J(t.declarationList.declarations),ri(";");else{var r=vt(t.declarationList);r&&ri(";")}5!==k&&t.parent===wa&&e.forEach(t.declarationList.declarations,on)}function _n(e){if(!(2&e.flags))return!0;if(sn(e))return!0;for(var t=0,n=e.declarationList.declarations;t<n.length;t++){var r=n[t];if(r.initializer)return!0}return!1}function un(t){if(2>v)if(e.isBindingPattern(t.name)){var n=R(0);Ga||(Ga=[]),Ga.push(n),aa(n)}else aa(t.name);else t.dotDotDotToken&&ri("..."),aa(t.name),B(" = ",t.initializer)}function ln(t){if(2>v){var n=0;e.forEach(t.parameters,function(t){if(!t.dotDotDotToken){var r=t.name,a=t.initializer;if(e.isBindingPattern(r)){var i=r.elements.length>0;(i||a)&&(ii(),ri("var "),i?rn(t,!1,Ga[n]):(aa(Ga[n]),ri(" = "),aa(a)),ri(";"),n++)}else a&&(ii(),ui(t),ri("if ("),ca(r),ri(" === void 0)"),li(t),ri(" { "),ui(t),ia(r),ri(" = "),ia(a),li(t),ri("; }"))}})}}function dn(t){if(2>v&&e.hasRestParameter(t)){var n=t.parameters.length-1,r=t.parameters[n];if(e.isBindingPattern(r.name))return;var a=R(268435456).text;ii(),ka(r),ui(r),ri("var "),ia(r.name),ri(" = [];"),li(r),xa(r),ii(),ri("for ("),ui(r),ri("var "+a+" = "+n+";"),li(r),ri(" "),ui(r),ri(a+" < arguments.length;"),li(r),ri(" "),ui(r),ri(a+"++"),li(r),ri(") {"),oi(),ii(),ui(r),ia(r.name),ri("["+a+" - "+n+"] = arguments["+a+"];"),li(r),si(),ii(),ri("}")}}function pn(e){ri(146===e.kind?"get ":"set "),aa(e.name),Cn(e)}function fn(e){return 177===e.kind&&v>=2}function mn(e){e.name?ia(e.name):ri(N(e))}function gn(e){return 176===e.kind?!!e.name:216===e.kind?!!e.name||5!==k:void 0}function yn(t){if(e.nodeIsMissing(t.body))return va(t);var n=t.kind,r=t.parent;144!==n&&143!==n&&r&&248!==r.kind&&171!==r.kind&&167!==r.kind&&ka(t),ui(t),fn(t)||(sn(t)&&(ri("export "),512&t.flags&&ri("default ")),ri("function"),v>=2&&t.asteriskToken&&ri("*"),ri(" ")),gn(t)&&mn(t),Cn(t),5!==k&&216===n&&r===wa&&t.name&&$t(t.name),li(t),144!==n&&143!==n&&xa(t)}function hn(e){4&r.getNodeCheckFlags(e)&&(ii(),ui(e),ri("var _this = this;"),li(e))}function vn(t){if(oi(),ri("("),t){var n=t.parameters,r=2>v&&e.hasRestParameter(t)?1:0;j(n,0,n.length-r,!1,!1)}ri(")"),si()}function kn(e){return 1===e.parameters.length&&e.pos===e.parameters[0].pos?void aa(e.parameters[0]):void vn(e)}function bn(t){var n=e.getEntityNameFromTypeNode(t.type),a=177===t.kind,i=0!==(8192&r.getNodeCheckFlags(t));a||(ri(" {"),oi(),ii(),4096&r.getNodeCheckFlags(t)?(ta("\nconst _super = (function (geti, seti) {\n const cache = Object.create(null);\n return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });\n})(name => super[name], (name, value) => super[name] = value);"),ii()):2048&r.getNodeCheckFlags(t)&&(ri("const _super = name => super[name];"),ii()),ri("return")),ri(" __awaiter(this"),ri(i?", arguments, ":", void 0, "),!n||h.noCustomAsyncPromise&&v>=2?ri("void 0"):Be(n,!1),ri(", function* ()"),xn(t),ri(")"),a||(ri(";"),si(),ii(),ri("}"))}function xn(e){e.body?195===e.body.kind?En(e,e.body):Sn(e,e.body):ri(" { }")}function Cn(t){var n=ja,r=pi,a=Ha,i=Ga;ja=void 0,pi=0,Ha=void 0,Ga=void 0,fn(t)?(kn(t),ri(" =>")):vn(t);var o=e.isAsyncFunctionLike(t);o?bn(t):xn(t),sn(t)||Yt(t),e.Debug.assert(void 0===ja),ja=n,pi=r,Ha=a,Ga=i}function Dn(e){hn(e),ln(e),dn(e)}function Sn(e,t){if(2>v||256&e.flags)return void Tn(e,t);ri(" ");for(var n=t;174===n.kind;)n=n.expression;
z(t,168===n.kind)}function Tn(e,t){ri(" {"),oi();var n=ni.getTextPos();Sa(e.body),Dn(e);var r=ni.getTextPos()!==n;si(),!r&&Lt(e,t)?(ri(" "),ui(t),ri("return "),aa(t),li(t),ri(";"),L(!1),ri(" ")):(oi(),ii(),ka(e.body),ui(t),ri("return "),aa(t),li(t),ri(";"),xa(e.body),L(!0),si(),ii()),ui(e.body),ri("}"),li(e.body)}function En(e,t){ri(" {");var n=ni.getTextPos();oi(),Sa(t.statements);var r=ea(t.statements,!0);Dn(e),si();var a=ni.getTextPos()!==n;if(!a&&Bt(t,t)){for(var i=0,o=t.statements;i<o.length;i++){var s=o[i];ri(" "),aa(s)}L(!1),ri(" "),fi(t.statements.end)}else oi(),q(t.statements,r),L(!0),ii(),fi(t.statements.end),si();M(16,t.statements.end)}function wn(t,n){if(t.body){var r=t.body.statements;if(r&&!(n>=r.length)){var a=r[n];return 198===a.kind&&e.isSuperCallExpression(a.expression)?a:void 0}}}function An(t){e.forEach(t.parameters,function(e){56&e.flags&&(ii(),ui(e),ui(e.name),ri("this."),ca(e.name),li(e.name),ri(" = "),aa(e.name),ri(";"),li(e))})}function Pn(e){9===e.kind||8===e.kind?(ri("["),ia(e),ri("]")):137===e.kind?Ee(e):(ri("."),ia(e))}function Nn(e,t){for(var n=[],r=0,a=e.members;r<a.length;r++){var i=a[r];142===i.kind&&t===(0!==(64&i.flags))&&i.initializer&&n.push(i)}return n}function On(e,t){for(var n=0,r=t;n<r.length;n++){var a=r[n];Rn(e,a)}}function Rn(e,t,n,r){ii(),ka(t),ui(t),ui(t.name),n?aa(n):64&t.flags?mn(e):ri("this"),Pn(t.name),li(t.name),ri(" = "),aa(t.initializer),r||ri(";"),li(t),xa(t)}function In(t){e.forEach(t.members,function(n){if(194===n.kind)ii(),ri(";");else if(144===n.kind||143===t.kind){if(!n.body)return va(n);ii(),ka(n),ui(n),ui(n.name),Un(t,n),Pn(n.name),li(n.name),ri(" = "),yn(n),li(n),ri(";"),xa(n)}else if(146===n.kind||147===n.kind){var r=e.getAllAccessorDeclarations(t.members,n);n===r.firstAccessor&&(ii(),ui(n),ri("Object.defineProperty("),ui(n.name),Un(t,n),ri(", "),ne(n.name),li(n.name),ri(", {"),oi(),r.getAccessor&&(ii(),ka(r.getAccessor),ri("get: "),ui(r.getAccessor),ri("function "),Cn(r.getAccessor),li(r.getAccessor),xa(r.getAccessor),ri(",")),r.setAccessor&&(ii(),ka(r.setAccessor),ri("set: "),ui(r.setAccessor),ri("function "),Cn(r.setAccessor),li(r.setAccessor),xa(r.setAccessor),ri(",")),ii(),ri("enumerable: true,"),ii(),ri("configurable: true"),si(),ii(),ri("});"),li(n))}})}function Fn(e){for(var t=0,n=e.members;t<n.length;t++){var r=n[t];144!==r.kind&&143!==e.kind||r.body?144===r.kind||146===r.kind||147===r.kind?(ii(),ka(r),ui(r),64&r.flags&&ri("static "),146===r.kind?ri("get "):147===r.kind&&ri("set "),r.asteriskToken&&ri("*"),aa(r.name),Cn(r),li(r),xa(r)):194===r.kind&&(ii(),ri(";")):va(r)}}function Ln(t,n){var r=ja,a=pi,i=Ha,o=Ga;ja=void 0,pi=0,Ha=void 0,Ga=void 0,Mn(t,n),e.Debug.assert(void 0===ja),ja=r,pi=a,Ha=i,Ga=o}function Mn(t,n){var r=!1;e.forEach(t.members,function(e){145!==e.kind||e.body||va(e),142===e.kind&&e.initializer&&0===(64&e.flags)&&(r=!0)});var a=e.getFirstConstructorWithBody(t);if(!(v>=2)||a||r){a&&ka(a),ui(a||t),2>v?(ri("function "),mn(t),vn(a)):(ri("constructor"),a?vn(a):ri(n?"(...args)":"()"));var i=0;ri(" {"),oi(),a&&(i=ea(a.body.statements,!0),Sa(a.body.statements)),hn(t);var o;if(a?(ln(a),dn(a),n&&(o=wn(a,i),o&&(ii(),aa(o))),An(a)):n&&(ii(),ui(n),ri(2>v?"_super.apply(this, arguments);":"super(...args);"),li(n)),On(t,Nn(t,!1)),a){var s=a.body.statements;o&&(s=s.slice(1)),q(s,i)}L(!0),ii(),a&&fi(a.body.statements.end),si(),M(16,a?a.body.statements.end:t.members.end),li(a||t),a&&xa(a)}}function Bn(e){return Kn(e)}function zn(e){return Kn(e)}function Kn(e){2>v?Jn(e):jn(e),5!==k&&e.parent===wa&&e.name&&$t(e.name)}function jn(t){var n,a=e.nodeIsDecorated(t);217===t.kind&&(a?(524288&r.getNodeCheckFlags(t)&&(n=e.unescapeIdentifier(S(t.name?t.name.text:"default")),Ka[e.getNodeId(t)]=n,ri("let "+n+";"),ii()),!sn(t)||512&t.flags||ri("export "),ri("let "),mn(t),void 0!==n&&ri(" = "+n),ri(" = ")):sn(t)&&(ri("export "),512&t.flags&&ri("default ")));var i,o=Nn(t,!0),s=o.length>0&&189===t.kind;s&&(i=F(0),ri("("),oi(),aa(i),ri(" = ")),ri("class"),(t.name||512&t.flags&&(o.length>0||5!==k)&&!a)&&(ri(" "),mn(t));var c=e.getClassExtendsHeritageClauseElement(t);if(c&&(ri(" extends "),aa(c.expression)),ri(" {"),oi(),ii(),Ln(t,c),Fn(t),si(),ii(),M(16,t.members.end),a&&(Ka[e.getNodeId(t)]=void 0,ri(";")),s){for(var _=0,u=o;_<u.length;_++){var l=u[_];ri(","),ii(),Rn(t,l,i,!0)}ri(","),ii(),aa(i),si(),ri(")")}else ii(),On(t,o),qn(t,n);2&t.flags&&(5!==k?Yt(t):512&t.flags?a&&(ii(),ri("export default "),mn(t),ri(";")):251!==t.parent.kind&&(ii(),ui(t),Gt(t),ri(" = "),mn(t),li(t),ri(";")))}function Jn(t){217===t.kind&&(nt(t)||ri("var "),mn(t),ri(" = ")),ri("(function (");var n=e.getClassExtendsHeritageClauseElement(t);n&&ri("_super"),ri(") {");var r=pi,a=Ha,i=Ga,o=za,s=ja;ja=void 0,pi=0,Ha=void 0,Ga=void 0,za=void 0,oi(),n&&(ii(),ui(n),ri("__extends("),mn(t),ri(", _super);"),li(n)),ii(),Ln(t,n),In(t),On(t,Nn(t,!0)),ii(),qn(t,void 0),ii(),M(16,t.members.end,function(){ri("return "),mn(t)}),ri(";"),L(!0),e.Debug.assert(void 0===ja),ja=s,pi=r,Ha=a,Ga=i,za=o,si(),ii(),M(16,t.members.end),ui(t),ri("("),n&&aa(n.expression),ri("))"),217===t.kind&&ri(";"),li(t),217===t.kind&&Yt(t)}function Un(e,t){mn(e),64&t.flags||ri(".prototype")}function qn(e,t){Vn(e,0),Vn(e,64),Wn(e,t)}function Wn(t,n){var r=t.decorators,a=e.getFirstConstructorWithBody(t),i=a&&e.forEach(a.parameters,function(e){return e.decorators});if(r||i){ii(),ui(t.decorators||i),mn(t),void 0!==n&&ri(" = "+n),ri(" = __decorate(["),oi(),ii();var o=r?r.length:0,s=j(r,0,o,!0,!1,!1,!0,function(e){return aa(e.expression)});i&&(s+=Hn(a,s>0)),nr(t,s>=0),si(),ii(),ri("], "),mn(t),ri(")"),li(t.decorators||i),ri(";"),ii()}}function Vn(t,n){for(var r=0,a=t.members;r<a.length;r++){var i=a[r];if((64&i.flags)===n&&e.nodeCanBeDecorated(i)){var o=void 0,s=void 0;if(e.isAccessor(i)){var c=e.getAllAccessorDeclarations(t.members,i);if(i!==c.firstAccessor)continue;o=c.firstAccessor.decorators,!o&&c.secondAccessor&&(o=c.secondAccessor.decorators),s=c.setAccessor}else o=i.decorators,144===i.kind&&(s=i);var _=s&&e.forEach(s.parameters,function(e){return e.decorators});if(o||_){ii(),ui(o||_),ri("__decorate(["),oi(),ii();var u=o?o.length:0,l=j(o,0,u,!0,!1,!1,!0,function(e){return aa(e.expression)});_&&(l+=Hn(s,l>0)),nr(i,l>0),si(),ii(),ri("], "),Un(t,i),ri(", "),ne(i.name),v>0&&ri(142!==i.kind?", null":", void 0"),ri(")"),li(o||_),ri(";"),ii()}}}}function Hn(t,n){var r=0;if(t)for(var a=0,i=0,o=t.parameters;i<o.length;i++){var s=o[i];if(e.nodeIsDecorated(s)){var c=s.decorators;r+=j(c,0,c.length,!0,!1,n,!0,function(e){ri("__param("+a+", "),aa(e.expression),ri(")")}),n=!0}a++}return r}function Gn(e){switch(e.kind){case 144:case 146:case 147:case 142:return!0}return!1}function Xn(e){switch(e.kind){case 144:return!0}return!1}function Qn(e){switch(e.kind){case 217:case 144:case 147:return!0}return!1}function Yn(t){switch(t.kind){case 217:return void ri("Function");case 142:return void $n(t.type);case 139:return void $n(t.type);case 146:return void $n(t.type);case 147:return void $n(e.getSetAccessorTypeAnnotationNode(t))}return e.isFunctionLike(t)?void ri("Function"):void ri("void 0")}function $n(t){if(t)switch(t.kind){case 103:return void ri("void 0");case 161:return void $n(t.type);case 153:case 154:return void ri("Function");case 157:case 158:return void ri("Array");case 151:case 120:return void ri("Boolean");case 130:case 163:return void ri("String");case 128:return void ri("Number");case 131:return void ri("Symbol");case 152:return void Zn(t);case 155:case 156:case 159:case 160:case 117:case 162:break;default:e.Debug.fail("Cannot serialize unexpected type node.")}ri("Object")}function Zn(t){for(var n=t.parent;e.isDeclaration(n)||e.isTypeNode(n);)n=n.parent;var a=e.cloneEntityName(t.typeName,n),i=r.getTypeReferenceSerializationKind(a);switch(i){case e.TypeReferenceSerializationKind.Unknown:var o=F(0);ri("(typeof ("),ca(o),ri(" = "),Be(a,!0),ri(") === 'function' && "),ca(o),ri(") || Object");break;case e.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue:Be(a,!1);break;case e.TypeReferenceSerializationKind.VoidType:ri("void 0");break;case e.TypeReferenceSerializationKind.BooleanType:ri("Boolean");break;case e.TypeReferenceSerializationKind.NumberLikeType:ri("Number");break;case e.TypeReferenceSerializationKind.StringLikeType:ri("String");break;case e.TypeReferenceSerializationKind.ArrayLikeType:ri("Array");break;case e.TypeReferenceSerializationKind.ESSymbolType:ri(2>v?"typeof Symbol === 'function' ? Symbol : Object":"Symbol");break;case e.TypeReferenceSerializationKind.TypeWithCallSignature:ri("Function");break;case e.TypeReferenceSerializationKind.ObjectType:ri("Object")}}function er(t){if(t){var n=void 0;if(217===t.kind?n=e.getFirstConstructorWithBody(t):e.isFunctionLike(t)&&e.nodeIsPresent(t.body)&&(n=t),n){var r=n.parameters,a=r.length;if(a>0)for(var i=0;a>i;i++)if(i>0&&ri(", "),r[i].dotDotDotToken){var o=r[i].type;o=157===o.kind?o.elementType:152===o.kind&&o.typeArguments&&1===o.typeArguments.length?o.typeArguments[0]:void 0,$n(o)}else Yn(r[i])}}}function tr(t){return t&&e.isFunctionLike(t)&&t.type?void $n(t.type):void ri("void 0")}function nr(e,t){var n=0;return h.emitDecoratorMetadata&&(Gn(e)&&(t&&ri(", "),ii(),ri("__metadata('design:type', "),Yn(e),ri(")"),n++),Qn(e)&&((t||n)&&ri(", "),ii(),ri("__metadata('design:paramtypes', ["),er(e),ri("])"),n++),Xn(e)&&((t||n)&&ri(", "),ii(),ri("__metadata('design:returntype', "),tr(e),ri(")"),n++)),n}function rr(e){va(e)}function ar(t){var n=e.isConst(t);return!n||h.preserveConstEnums||h.isolatedModules}function ir(e){if(ar(e)){if(!nt(e)){var t=sn(e);(!(2&e.flags)||t&&lr(e,e.symbol&&e.symbol.declarations,220))&&(ui(e),t&&ri("export "),ri("var "),aa(e.name),li(e),ri(";"))}ii(),ui(e),ri("(function ("),ui(e.name),ri(N(e)),li(e.name),ri(") {"),oi(),U(e.members),si(),ii(),M(16,e.members.end),ri(")("),Gt(e),ri(" || ("),Gt(e),ri(" = {}));"),li(e),!sn(e)&&2&e.flags&&!nt(e)&&(ii(),ui(e),ri("var "),aa(e.name),ri(" = "),Gt(e),li(e),ri(";")),5!==k&&e.parent===wa&&(4===k&&2&e.flags&&(ii(),ri(Fa+'("'),mn(e),ri('", '),mn(e),ri(");")),$t(e.name))}}function or(e){var t=e.parent;ui(e),ri(N(t)),ri("["),ri(N(t)),ri("["),ne(e.name),ri("] = "),sr(e),ri("] = "),ne(e.name),li(e),ri(";")}function sr(e){var t=r.getConstantValue(e);return void 0!==t?void ri(t.toString()):void(e.initializer?aa(e.initializer):ri("undefined"))}function cr(e){if(221===e.body.kind){var t=cr(e.body);return t||e.body}}function _r(t){return e.isInstantiatedModule(t,h.preserveConstEnums||h.isolatedModules)}function ur(e){return 2===v&&!!(32768&r.getNodeCheckFlags(e))}function lr(t,n,r){return!e.forEach(n,function(e){return e.kind===r&&e.pos<t.pos})}function dr(t){var n=_r(t);if(!n)return va(t);var r=nt(t),a=!r&&!ur(t);if(a){var i=sn(t);i&&!lr(t,t.symbol&&t.symbol.declarations,221)||(ui(t),i&&ri("export "),ri("var "),aa(t.name),ri(";"),li(t),ii())}if(ui(t),ri("(function ("),ui(t.name),ri(N(t)),li(t.name),ri(") "),222===t.body.kind){var o=ja,s=pi,c=Ha;ja=void 0,pi=0,Ha=void 0,aa(t.body),e.Debug.assert(void 0===ja),ja=o,pi=s,Ha=c}else{ri("{"),oi(),hn(t),ii(),aa(t.body),si(),ii();var _=cr(t).body;M(16,_.statements.end)}ri(")("),2&t.flags&&!sn(t)&&(aa(t.name),ri(" = ")),Gt(t),ri(" || ("),Gt(t),ri(" = {}));"),li(t),sn(t)||69!==t.name.kind||t.parent!==wa||(4===k&&2&t.flags&&(ii(),ri(Fa+'("'),mn(t),ri('", '),mn(t),ri(");")),$t(t.name))}function pr(t){return Oa&&e.hasProperty(Oa,t.text)?'"'+Oa[t.text]+'"':void 0}function fr(e){if(9===e.kind){ri("require(");var t=pr(e);t?ri(t):(ui(e),V(e),li(e)),M(18,e.end)}else ri("require()")}function mr(e){if(224===e.kind)return e;var t=e.importClause;return t&&t.namedBindings&&227===t.namedBindings.kind?t.namedBindings:void 0}function gr(e){return 225===e.kind&&e.importClause&&!!e.importClause.name}function yr(t){e.isAliasSymbolDeclaration(t)&&r.isValueAliasDeclaration(t)&&$t(t.name),e.forEachChild(t,yr)}function hr(e){if(5!==k)return vr(e);if(e.importClause){var t=r.isReferencedAliasDeclaration(e.importClause),n=e.importClause.namedBindings&&r.isReferencedAliasDeclaration(e.importClause.namedBindings,!0);(t||n)&&(ri("import "),ui(e.importClause),t&&(aa(e.importClause.name),n&&ri(", ")),n&&(ka(e.importClause.namedBindings),ui(e.importClause.namedBindings),227===e.importClause.namedBindings.kind?(ri("* as "),aa(e.importClause.namedBindings.name)):(ri("{ "),xr(e.importClause.namedBindings.elements,r.isReferencedAliasDeclaration),ri(" }")),li(e.importClause.namedBindings),xa(e.importClause.namedBindings)),li(e.importClause),ri(" from "),aa(e.moduleSpecifier),ri(";"))}else ri("import "),aa(e.moduleSpecifier),ri(";")}function vr(t){if(e.contains(Xa,t)){var n=224===t.kind&&0!==(2&t.flags),r=mr(t),a=1>=v?"var ":"const ";if(2!==k){if(ka(t),ui(t),r&&!gr(t))n||ri(a),Gt(r),ri(" = ");else{var i=!t.importClause;i||(ri(a),ri(N(t)),ri(" = "))}fr(e.getExternalModuleName(t)),r&&gr(t)&&(ri(", "),Gt(r),ri(" = "),ri(N(t))),ri(";"),li(t),yr(t),xa(t)}else n?(Gt(r),ri(" = "),aa(r.name),ri(";")):r&&gr(t)&&(ri(a),Gt(r),ri(" = "),ri(N(t)),ri(";")),yr(t)}}function kr(t){if(e.isExternalModuleImportEqualsDeclaration(t))return void vr(t);if(r.isReferencedAliasDeclaration(t)||!Ia&&r.isTopLevelValueImportEqualsWithEntityName(t)){ka(t),ui(t);var n=Nr(t,!0),a=rt(t,!0);n||(e.Debug.assert(!a),sn(t)?(ri("export "),ri("var ")):2&t.flags||ri("var ")),a&&(ri(Fa+'("'),ca(t.name),ri('", ')),Gt(t),ri(" = "),aa(t.moduleReference),a&&ri(")"),ri(";"),li(t),yr(t),xa(t)}}function br(t){if(e.Debug.assert(4!==k),5!==k){if(t.moduleSpecifier&&(!t.exportClause||r.isValueAliasDeclaration(t))){ui(t);var n=N(t);if(t.exportClause){2!==k&&(ri("var "),ri(n),ri(" = "),fr(e.getExternalModuleName(t)),ri(";"));for(var a=0,i=t.exportClause.elements;a<i.length;a++){var o=i[a];r.isValueAliasDeclaration(o)&&(ii(),ui(o),Ht(o),ri("."),ia(o.name),ri(" = "),ri(n),ri("."),ia(o.propertyName||o.name),ri(";"),li(o))}}else $a&&r.moduleExportsSomeValue(t.moduleSpecifier)&&(ii(),ri("__export("),2!==k?fr(e.getExternalModuleName(t)):ri(n),ri(");"));li(t)}}else t.exportClause&&!r.isValueAliasDeclaration(t)||(ri("export "),t.exportClause?(ri("{ "),xr(t.exportClause.elements,r.isValueAliasDeclaration),ri(" }")):ri("*"),t.moduleSpecifier&&(ri(" from "),aa(t.moduleSpecifier)),ri(";"))}function xr(t,n){e.Debug.assert(5===k);for(var r=!1,a=0,i=t;a<i.length;a++){var o=i[a];n(o)&&(r&&ri(", "),o.propertyName&&(aa(o.propertyName),ri(" as ")),aa(o.name),r=!0)}}function Cr(e){if(!e.isExportEquals&&r.isValueAliasDeclaration(e))if(5===k){ii(),ui(e),ri("export default ");var t=e.expression;aa(t),216!==t.kind&&217!==t.kind&&ri(";"),li(e)}else ii(),ui(e),4===k?(ri(Fa+'("default",'),aa(e.expression),ri(")")):(Qt(e),Ht(e),ri(0===v?'["default"] = ':".default = "),aa(e.expression)),ri(";"),li(e)}function Dr(e){Xa=[],Qa={},Ya=void 0,$a=!1;for(var t=0,n=e.statements;t<n.length;t++){var a=n[t];switch(a.kind){case 225:a.importClause&&!r.isReferencedAliasDeclaration(a.importClause,!0)||Xa.push(a);break;case 224:235===a.moduleReference.kind&&r.isReferencedAliasDeclaration(a)&&Xa.push(a);break;case 231:if(a.moduleSpecifier)a.exportClause?r.isValueAliasDeclaration(a)&&Xa.push(a):r.moduleExportsSomeValue(a.moduleSpecifier)&&(Xa.push(a),$a=!0);else for(var i=0,o=a.exportClause.elements;i<o.length;i++){var s=o[i],c=(s.propertyName||s.name).text;(Qa[c]||(Qa[c]=[])).push(s)}break;case 230:a.isExportEquals&&!Ya&&(Ya=a)}}}function Sr(){$a&&(ii(),ri("function __export(m) {"),oi(),ii(),ri("for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];"),si(),ii(),ri("}"))}function Tr(t){var n=mr(t);return n&&!gr(t)?e.getTextOfNodeFromSourceText(Aa,n.name):225===t.kind&&t.importClause?N(t):231===t.kind&&t.moduleSpecifier?N(t):void 0}function Er(t,i){if(i){var o=n(a,r,t);if(o)return'"'+o+'"'}var s=e.getExternalModuleName(t);return 9===s.kind?pr(s)||H(s):void 0}function wr(){if(0!==Xa.length){ii();for(var e=!1,t=0,n=Xa;t<n.length;t++){var r=n[t],a=231===r.kind||225===r.kind&&!r.importClause;a||(e?ri(", "):(ri("var "),e=!0),ri(Tr(r)))}e&&ri(";")}}function Ar(t){function n(e){var t=S("exportStar");return ii(),ri("function "+t+"(m) {"),oi(),ii(),ri("var exports = {};"),ii(),ri("for(var n in m) {"),oi(),ii(),ri('if (n !== "default"'),e&&ri("&& !"+e+".hasOwnProperty(n)"),ri(") exports[n] = m[n];"),si(),ii(),ri("}"),ii(),ri(Fa+"(exports);"),si(),ii(),ri("}"),t}function r(e){69!==e.kind&&512&e.flags||(_?ri(","):_=!0,ii(),ri("'"),69===e.kind?ia(e):mn(e),ri("': true"))}if($a){if(!t&&e.isEmpty(Qa)){for(var a=!1,i=0,o=Xa;i<o.length;i++){var s=o[i];if(231===s.kind&&s.exportClause){a=!0;break}}if(!a)return n(void 0)}var c=S("exportedNames");ii(),ri("var "+c+" = {"),oi();var _=!1;if(t)for(var u=0;u<t.length;u++)r(t[u]);if(Qa)for(var l in Qa)for(var d=0,p=Qa[l];d<p.length;d++){var f=p[d];r(f.name)}for(var m=0,g=Xa;m<g.length;m++){var s=g[m];if(231===s.kind){var y=s;if(y.exportClause)for(var h=0,v=y.exportClause.elements;h<v.length;h++){var k=v[h];r(k.name||k.propertyName)}}}return si(),ii(),ri("};"),n(c)}}function Pr(t){function n(t){if(!(4&t.flags)){if(216===t.kind)return i||(i=[]),void i.push(t);if(217===t.kind)return a||(a=[]),void a.push(t);if(220===t.kind)return void(ar(t)&&(a||(a=[]),a.push(t)));if(221===t.kind)return void(_r(t)&&(a||(a=[]),a.push(t)));if(214!==t.kind&&166!==t.kind)return e.isInternalModuleImportEqualsDeclaration(t)&&r.isValueAliasDeclaration(t)?(a||(a=[]),void a.push(t.name)):e.isBindingPattern(t)?void e.forEach(t.elements,n):void(e.isDeclaration(t)||e.forEachChild(t,n));if(Nr(t,!1)){var o=t.name;69===o.kind?(a||(a=[]),a.push(o)):e.forEachChild(o,n)}}}var a,i,o;if(n(t),a){ii(),ri("var ");for(var s={},c=0;c<a.length;c++){var _=a[c],u=69===_.kind?_:_.name;if(u){var l=e.unescapeIdentifier(u.text);if(e.hasProperty(s,l))continue;s[l]=l}0!==c&&ri(", "),217===_.kind||221===_.kind||220===_.kind?mn(_):aa(_);var d=e.getCombinedNodeFlags(69===_.kind?_.parent:_);2&d&&(o||(o=[]),o.push(_))}ri(";")}if(i)for(var p=0,f=i;p<f.length;p++){var m=f[p];ii(),aa(m),2&m.flags&&(o||(o=[]),o.push(m))}return o}function Nr(t,n){return n&&!nt(t)?!1:0===(24576&e.getCombinedNodeFlags(t))||251===e.getEnclosingBlockScopeContainer(t).kind}function Or(){return 4===k&&Ia}function Rr(e,t,n){wr(),ii();var r=Pr(e),a=Ar(r);ii(),ri("return {"),oi(),ii(),Ir(a,t),ii(),Fr(e,n),si(),ii(),ri("}"),L(!0)}function Ir(t,n){ri("setters:[");for(var r=0;r<n.length;r++){0!==r&&ri(","),ii(),oi();var a=n[r],i=S(e.forEach(a,Tr)||"");ri("function ("+i+") {"),oi();for(var o=0,s=a;o<s.length;o++){var c=s[o],_=Tr(c)||"";switch(c.kind){case 225:if(!c.importClause)break;case 224:e.Debug.assert(""!==_),ii(),ri(_+" = "+i+";"),ii();break;case 231:if(e.Debug.assert(""!==_),c.exportClause){ii(),ri(Fa+"({"),ii(),oi();for(var u=0,l=c.exportClause.elements.length;l>u;u++){0!==u&&(ri(","),ii());var d=c.exportClause.elements[u];ri('"'),ia(d.name),ri('": '+i+'["'),ia(d.propertyName||d.name),ri('"]')}si(),ii(),ri("});")}else ii(),ri(t+"("+i+");");ii()}}si(),ri("}"),si()}ri("],")}function Fr(t,n){ri("execute: function() {"),oi(),ii();for(var r=n;r<t.statements.length;r++){var a=t.statements[r];switch(a.kind){case 216:case 225:continue;case 231:if(!a.moduleSpecifier)for(var i=0,o=a.exportClause.elements;i<o.length;i++){var s=o[i];Zt(s)}continue;case 224:if(!e.isInternalModuleImportEqualsDeclaration(a))continue;default:ii(),aa(a)}}si(),ii(),ri("}")}function Lr(e,n){var r=e.moduleName;(r||n&&(r=t(a,e)))&&ri('"'+r+'", ')}function Mr(t,n){Dr(t),e.Debug.assert(!Fa),Fa=S("exports"),La=S("context"),ii(),ri("System.register("),Lr(t,n),ri("[");for(var r={},a=[],i=0;i<Xa.length;i++){var o=Er(Xa[i],n);if(void 0!==o){var s=o.substr(1,o.length-2);if(e.hasProperty(r,s)){var c=r[s];a[c].push(Xa[i])}else r[s]=a.length,a.push([Xa[i]]),0!==i&&ri(", "),ri(o)}}ri("], function("+Fa+", "+La+") {"),ii(),oi();var _=ea(t.statements,!0,!h.noImplicitUseStrict);ii(),ri("var __moduleName = "+La+" && "+La+".id;"),ii(),na(t),hn(t),Rr(t,a,_),si(),ii(),ri("});")}function Br(e,t,n){for(var r=[],a=[],i=[],o=0,s=e.amdDependencies;o<s.length;o++){var c=s[o];c.name?(r.push('"'+c.path+'"'),i.push(c.name)):a.push('"'+c.path+'"')}for(var _=0,u=Xa;_<u.length;_++){var l=u[_],d=Er(l,n),p=Tr(l);t&&p?(r.push(d),i.push(p)):a.push(d)}return{aliasedModuleNames:r,unaliasedModuleNames:a,importAliasNames:i}}function zr(e,t,n){var r=Br(e,t,n);Kr(r),ri(", "),jr(r)}function Kr(e){var t=e.aliasedModuleNames,n=e.unaliasedModuleNames;ri('["require", "exports"'),t.length&&(ri(", "),ri(t.join(", "))),n.length&&(ri(", "),ri(n.join(", "))),ri("]")}function jr(e){var t=e.importAliasNames;ri("function (require, exports"),t.length&&(ri(", "),ri(t.join(", "))),ri(") {")}function Jr(e,t){na(e),Dr(e),ii(),ri("define("),Lr(e,t),zr(e,!0,t),oi();var n=ea(e.statements,!0,!h.noImplicitUseStrict);Sr(),hn(e),q(e.statements,n),L(!0),Vr(!0),si(),ii(),ri("});")}function Ur(e){var t=ea(e.statements,!1,!h.noImplicitUseStrict);na(e),Dr(e),Sr(),hn(e),q(e.statements,t),L(!0),Vr(!1)}function qr(e){na(e),Dr(e);var t=Br(e,!1);ta("(function (factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define("),Kr(t),ri(", factory);"),ta(" }\n})("),jr(t),oi();var n=ea(e.statements,!0,!h.noImplicitUseStrict);Sr(),hn(e),q(e.statements,n),L(!0),Vr(!0),si(),ii(),ri("});")}function Wr(e){Xa=void 0,Qa=void 0,Ya=void 0,$a=!1;var t=ea(e.statements,!1);na(e),hn(e),q(e.statements,t),L(!0)}function Vr(e){Ya&&r.isValueAliasDeclaration(Ya)&&(ii(),ui(Ya),ri(e?"return ":"module.exports = "),aa(Ya.expression),ri(";"),li(Ya))}function Hr(e){switch(h.jsx){case 2:ee(e);break;case 1:default:te(e)}}function Gr(t){for(var n=void 0,r=e.getTextOfNode(t,!0),a=0,i=-1,s=0;s<r.length;s++){var c=r.charCodeAt(s);if(e.isLineBreak(c)){if(-1!==a&&i-a+1>0){var _=r.substr(a,i-a+1);n=(n?n+"\" + ' ' + \"":"")+e.escapeString(_)}a=-1}else e.isWhiteSpace(c)||(i=s,-1===a&&(a=s))}if(-1!==a){var _=r.substr(a);n=(n?n+"\" + ' ' + \"":"")+e.escapeString(_)}return n&&(n=n.replace(/&(\w+);/g,function(e,t){if(void 0!==o[t]){var n=String.fromCharCode(o[t]);return'"'===n?'\\"':n}return e})),n}function Xr(t){switch(h.jsx){case 2:var n=Gr(t);return void 0===n||0===n.length?void 0:n;case 1:default:return e.getTextOfNode(t,!0)}}function Qr(t){switch(h.jsx){case 2:ri('"'),ri(Gr(t)),ri('"');break;case 1:default:ni.writeLiteral(e.getTextOfNode(t,!0))}}function Yr(e){if(e.expression)switch(h.jsx){case 1:default:ri("{"),aa(e.expression),ri("}");break;case 2:aa(e.expression)}}function $r(e){return!!e.expression.text.match(/use strict/)}function Zr(e,t){t&&(e&&ii(),ri('"use strict";'))}function ea(t,n,r){for(var a=!1,i=0;i<t.length;i++){if(!e.isPrologueDirective(t[i]))return Zr(n||i>0,!a&&r),i;$r(t[i])&&(a=!0),(n||i>0)&&ii(),aa(t[i])}return Zr(n,!a&&r),t.length}function ta(e){for(var t=e.split(/\r\n|\r|\n/g),n=0;n<t.length;n++){var r=t[n];r.length&&(ii(),ri(r))}}function na(e){h.noEmitHelpers||(2>v&&!Ja&&4194304&e.flags&&(ta(d),Ja=!0),1!==h.jsx&&!Ua&&1073741824&e.flags&&(ta(p),Ua=!0),!qa&&8388608&e.flags&&(ta(f),h.emitDecoratorMetadata&&ta(m),qa=!0),!Wa&&16777216&e.flags&&(ta(g),Wa=!0),!Va&&33554432&e.flags&&(ta(y),Va=!0))}function ra(t){if(ii(),Ea(),Sa(t),e.isExternalModule(t)||h.isolatedModules)if(ti||!e.isExternalModule(t)&&h.isolatedModules){var n=gi[k]||gi[1];n(t)}else yi[k](t,!0);else{var r=ea(t.statements,!1);Xa=void 0,Qa=void 0,Ya=void 0,$a=!1,na(t),hn(t),q(t.statements,r),L(!0)}ka(t.endOfFileToken)}function aa(e){oa(e,sa)}function ia(e){oa(e,ca)}function oa(e,t){if(e){if(4&e.flags)return va(e);if(la(e))return ca(e);var n=da(e);n&&ka(e),t(e),n&&xa(e)}}function sa(e){e&&(ui(e),ca(e),li(e))}function ca(e){e&&pa(e)}function _a(e){ci=e,ui=e.emitStart,li=e.emitEnd,di=e.emitPos,_i=e.setSourceFile}function ua(t){var n=ci;mi(e.getNullSourceMapWriter()),t(),mi(n)}function la(e){switch(e.kind){case 218:case 216:case 225:case 224:case 219:case 230:return!0}}function da(t){switch(t.kind){case 196:return _n(t);case 221:return _r(t);case 220:return ar(t)}return e.Debug.assert(!la(t)),!(195!==t.kind&&t.parent&&177===t.parent.kind&&t.parent.body===t&&h.target<=1)}function pa(e){switch(e.kind){case 69:return oe(e);case 139:return un(e);case 144:case 143:return we(e);case 146:case 147:return pn(e);case 97:return se(e);case 95:return ce(e);case 93:return ri("null");case 99:return ri("true");case 84:return ri("false");case 8:case 9:case 10:case 11:case 12:case 13:case 14:return V(e);case 186:return $(e);case 193:return Z(e);case 236:case 237:return Hr(e);case 239:return Qr(e);case 243:return Yr(e);case 136:return Le(e);case 164:return _e(e);case 165:return ue(e);case 166:return le(e);case 167:return ve(e);case 168:return xe(e);case 248:return Ae(e);case 249:return Ne(e);case 137:return Ee(e);case 169:return Fe(e);case 170:return ze(e);case 171:return Ve(e);case 172:return He(e);case 173:return Ge(e);case 174:return aa(e.expression);case 192:return aa(e.expression);case 175:return Xe(e);case 216:case 176:case 177:return yn(e);case 178:return Qe(e);case 179:return $e(e);case 180:return Ye(e);case 181:return fe(e);case 182:return et(e);case 183:return tt(e);case 184:return it(e);case 185:return st(e);case 188:return de(e);case 187:return pe(e);case 190:return;case 195:case 222:return ut(e);case 196:return cn(e);case 197:return ri(";");case 198:return dt(e);case 199:return pt(e);case 200:return ft(e);case 201:return gt(e);case 202:return Tt(e);case 204:case 203:return wt(e);case 205:case 206:return Nt(e);case 207:return Ot(e);case 208:return Rt(e);case 209:return It(e);case 244:case 245:return zt(e);case 210:return Wt(e);case 211:return Kt(e);case 212:return jt(e);case 247:return Jt(e);case 213:return Ut(e);case 214:return an(e);case 189:return Bn(e);case 217:return zn(e);case 218:return rr(e);case 220:return ir(e);case 250:return or(e);case 221:return dr(e);case 225:return hr(e);case 224:return kr(e);case 231:return br(e);case 230:return Cr(e);case 251:return ra(e)}}function fa(t){return void 0!==Za&&e.lastOrUndefined(Za).nodePos===t}function ma(){var t=e.getLeadingCommentRanges(Aa,e.lastOrUndefined(Za).detachedCommentEndPos);return Za.length-1?Za.pop():Za=void 0,t}function ga(t){if(47===Aa.charCodeAt(t.pos+1)&&t.pos+2<t.end&&47===Aa.charCodeAt(t.pos+2)){var n=Aa.substring(t.pos,t.end);return!(!n.match(e.fullTripleSlashReferencePathRegEx)&&!n.match(e.fullTripleSlashAMDReferencePathRegEx))}return!1}function ya(t){return!t.parent||251!==t.parent.kind&&t.pos===t.parent.pos?void 0:fa(t.pos)?ma():e.getLeadingCommentRangesOfNodeFromText(t,Aa)}function ha(t){return!t.parent||251!==t.parent.kind&&t.end===t.parent.end?void 0:e.getTrailingCommentRanges(Aa,t.end)}function va(e){ba(e,!1)}function ka(e){return ba(e,!0)}function ba(t,n){if(!h.removeComments){var r;n?r=ya(t):0===t.pos&&(r=e.filter(ya(t),ga)),e.emitNewLineBeforeLeadingComments(Pa,ni,t,r),e.emitComments(Aa,Pa,ni,r,!0,D,Ta)}}function xa(t){if(!h.removeComments){var n=ha(t);e.emitComments(Aa,Pa,ni,n,!1,D,Ta)}}function Ca(t){if(!h.removeComments){var n=e.getTrailingCommentRanges(Aa,t);e.emitComments(Aa,Pa,ni,n,!0,D,Ta)}}function Da(t){if(!h.removeComments){var n;n=fa(t)?ma():e.getLeadingCommentRanges(Aa,t),e.emitNewLineBeforeLeadingComments(Pa,ni,{pos:t,end:t},n),e.emitComments(Aa,Pa,ni,n,!0,D,Ta)}}function Sa(t){var n=e.emitDetachedComments(Aa,Pa,ni,Ta,t,D,h.removeComments);n&&(Za?Za.push(n):Za=[n])}function Ta(t,n,r,a,i){di(a.pos),e.writeCommentRange(t,n,r,a,i),di(a.end)}function Ea(){var t=e.getShebang(Aa);t&&(ri(t),ii())}var wa,Aa,Pa,Na,Oa,Ra,Ia,Fa,La,Ma,Ba,za,Ka,ja,Ja,Ua,qa,Wa,Va,Ha,Ga,Xa,Qa,Ya,$a,Za,ei,ti,ni=e.createTextWriter(D),ri=ni.write,ai=ni.writeTextOfNode,ii=ni.writeLine,oi=ni.increaseIndent,si=ni.decreaseIndent,ci=h.sourceMap||h.inlineSourceMap?e.createSourceMapWriter(a,ni):e.getNullSourceMapWriter(),_i=ci.setSourceFile,ui=ci.emitStart,li=ci.emitEnd,di=ci.emitPos,pi=0,fi=h.removeComments?function(e){}:Da,mi=h.sourceMap||h.inlineSourceMap?_a:function(e){},gi=(hi={},hi[5]=Wr,hi[2]=Jr,hi[4]=Mr,hi[3]=qr,hi[1]=Ur,hi),yi=(vi={},vi[5]=function(){},vi[2]=Jr,vi[4]=Mr,vi[3]=function(){},vi[1]=function(){},vi);return i;var hi,vi}function l(t,n,i){var o=t.jsFilePath,s=t.sourceMapFilePath,c=t.declarationFilePath;a.isEmitBlocked(o)||h.noEmit?C=!0:S(o,s,n,i),c&&(C=e.writeDeclarationFile(c,n,i,a,r,x)||C)}var d="\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};",p="\nvar __assign = (this && this.__assign) || Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n};",f='\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};',m='\nvar __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);\n};',g="\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};",y="\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments)).next());\n });\n};",h=a.getCompilerOptions(),v=e.getEmitScriptTarget(h),k=e.getEmitModuleKind(h),b=h.sourceMap||h.inlineSourceMap?[]:void 0,x=e.createDiagnosticCollection(),C=!1,D=a.getNewLine(),S=u();return e.forEachExpectedEmitFile(a,l,i),{emitSkipped:C,diagnostics:x.getDiagnostics(),sourceMaps:b}}e.getResolvedExternalModuleName=t,e.getExternalModuleNameFromDeclaration=n;var a;!function(e){e[e.Break=2]="Break",e[e.Continue=4]="Continue",e[e.Return=8]="Return"}(a||(a={}));var i,o={quot:34,amp:38,apos:39,lt:60,gt:62,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,copy:169,ordf:170,laquo:171,not:172,shy:173,reg:174,macr:175,deg:176,plusmn:177,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,sup1:185,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,Agrave:192,Aacute:193,Acirc:194,Atilde:195,Auml:196,Aring:197,AElig:198,Ccedil:199,Egrave:200,Eacute:201,Ecirc:202,Euml:203,Igrave:204,Iacute:205,Icirc:206,Iuml:207,ETH:208,Ntilde:209,Ograve:210,Oacute:211,Ocirc:212,Otilde:213,Ouml:214,times:215,Oslash:216,Ugrave:217,Uacute:218,Ucirc:219,Uuml:220,Yacute:221,THORN:222,szlig:223,agrave:224,aacute:225,acirc:226,atilde:227,auml:228,aring:229,aelig:230,ccedil:231,egrave:232,eacute:233,ecirc:234,euml:235,igrave:236,iacute:237,icirc:238,iuml:239,eth:240,ntilde:241,ograve:242,oacute:243,ocirc:244,otilde:245,ouml:246,divide:247,oslash:248,ugrave:249,uacute:250,ucirc:251,uuml:252,yacute:253,thorn:254,yuml:255,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,
Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,"int":8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830};!function(e){e[e.Auto=0]="Auto",e[e.CountMask=268435455]="CountMask",e[e._i=268435456]="_i"}(i||(i={}));var s;!function(e){e[e.ToOriginal=0]="ToOriginal",e[e.ToOutParameter=1]="ToOutParameter"}(s||(s={})),e.emitFiles=r}(ts||(ts={}));var ts;!function(e){function t(t,n){for(var r="tsconfig.json";;){if(n(r))return r;var a=e.getDirectoryPath(t);if(a===t)break;t=a,r="../"+r}}function n(t,n){var r=e.getDirectoryPath(n),a=e.isRootedDiskPath(t)?t:e.combinePaths(r,t);return e.normalizePath(a)}function r(t,n,r,i){var o=void 0!==r.moduleResolution?r.moduleResolution:1===e.getEmitModuleKind(r)?2:1;switch(o){case 2:return a(t,n,r,i);case 1:return u(t,n,r,i)}}function a(t,n,r,a){var i=e.getDirectoryPath(n),u=e.getSupportedExtensions(r);if(0!==e.getRootLength(t)||_(t)){var l=[],d=e.normalizePath(e.combinePaths(i,t)),p=o(u,d,l,!1,a);return p?{resolvedModule:{resolvedFileName:p},failedLookupLocations:l}:(p=s(u,d,l,!1,a),p?{resolvedModule:{resolvedFileName:p},failedLookupLocations:l}:{resolvedModule:void 0,failedLookupLocations:l})}return c(t,i,a)}function i(e,t){return!t.directoryExists||t.directoryExists(e)}function o(t,n,r,a,i){function o(t){var o=e.fileExtensionIs(n,t)?n:n+t;return!a&&i.fileExists(o)?o:void r.push(o)}return e.forEach(t,o)}function s(t,n,r,a,s){var c=e.combinePaths(n,"package.json"),_=!a&&i(n,s);if(_&&s.fileExists(c)){var u=void 0;try{var l=s.readFile(c);u=l?JSON.parse(l):{typings:void 0}}catch(d){u={typings:void 0}}if("string"==typeof u.typings){var p=e.normalizePath(e.combinePaths(n,u.typings)),f=o(t,p,r,!i(e.getDirectoryPath(p),s),s);if(f)return f}}else r.push(c);return o(t,e.combinePaths(n,"index"),r,!_,s)}function c(t,n,r){var a=[];for(n=e.normalizeSlashes(n);;){var c=e.getBaseFileName(n);if("node_modules"!==c){var _=e.combinePaths(n,"node_modules"),u=i(_,r),l=e.normalizePath(e.combinePaths(_,t)),d=o(e.supportedTypeScriptExtensions,l,a,!u,r);if(d)return{resolvedModule:{resolvedFileName:d,isExternalLibraryImport:!0},failedLookupLocations:a};if(d=s(e.supportedTypeScriptExtensions,l,a,!u,r))return{resolvedModule:{resolvedFileName:d,isExternalLibraryImport:!0},failedLookupLocations:a}}var p=e.getDirectoryPath(n);if(p===n)break;n=p}return{resolvedModule:void 0,failedLookupLocations:a}}function _(e){var t=e.lastIndexOf("./",1);return 0===t||1===t&&46===e.charCodeAt(0)}function u(t,n,r,a){if(-1!=t.indexOf("!"))return{resolvedModule:void 0,failedLookupLocations:[]};for(var i,o,s=e.getDirectoryPath(n),c=[],_=e.getSupportedExtensions(r);;){if(i=e.normalizePath(e.combinePaths(s,t)),o=e.forEach(_,function(e){if(".tsx"!==e||r.jsx){var t=i+e;return a.fileExists(t)?t:void c.push(t)}}))break;var u=e.getDirectoryPath(s);if(u===s)break;s=u}return o?{resolvedModule:{resolvedFileName:o},failedLookupLocations:c}:{resolvedModule:void 0,failedLookupLocations:c}}function l(t,n){function r(t){return e.sys.useCaseSensitiveFileNames?t:t.toLowerCase()}function a(r,a,i){var o;try{var s=(new Date).getTime();o=e.sys.readFile(r,t.charset),e.ioReadTime+=(new Date).getTime()-s}catch(c){i&&i(c.number===_?e.createCompilerDiagnostic(e.Diagnostics.Unsupported_file_encoding).messageText:c.message),o=""}return void 0!==o?e.createSourceFile(r,o,a,n):void 0}function i(t){return e.hasProperty(c,t)?!0:e.sys.directoryExists(t)?(c[t]=!0,!0):!1}function o(t){if(t.length>e.getRootLength(t)&&!i(t)){var n=e.getDirectoryPath(t);o(n),e.sys.createDirectory(t)}}function s(t,n,r,a){try{var i=(new Date).getTime();o(e.getDirectoryPath(e.normalizePath(t))),e.sys.writeFile(t,n,r),e.ioWriteTime+=(new Date).getTime()-i}catch(s){a&&a(s.message)}}var c={},_=-2147024809,u=e.getNewLineCharacter(t);return{getSourceFile:a,getDefaultLibFileName:function(t){return e.combinePaths(e.getDirectoryPath(e.normalizePath(e.sys.getExecutingFilePath())),e.getDefaultLibFileName(t))},writeFile:s,getCurrentDirectory:e.memoize(function(){return e.sys.getCurrentDirectory()}),useCaseSensitiveFileNames:function(){return e.sys.useCaseSensitiveFileNames},getCanonicalFileName:r,getNewLine:function(){return u},fileExists:function(t){return e.sys.fileExists(t)},readFile:function(t){return e.sys.readFile(t)},directoryExists:function(t){return e.sys.directoryExists(t)}}}function d(t,n,r){var a=t.getOptionsDiagnostics(r).concat(t.getSyntacticDiagnostics(n,r),t.getGlobalDiagnostics(r),t.getSemanticDiagnostics(n,r));return t.getCompilerOptions().declaration&&(a=a.concat(t.getDeclarationDiagnostics(n,r))),e.sortAndDeduplicateDiagnostics(a)}function p(e,t){if("string"==typeof e)return e;for(var n=e,r="",a=0;n;){if(a){r+=t;for(var i=0;a>i;i++)r+=" "}r+=n.messageText,a++,n=n.next}return r}function f(t,a,i,o){function s(){return!a.disableSizeLimit&&re===ne}function c(){return"undefined"==typeof X&&(X=a.rootDir&&W(Z,a.rootDir)?e.getNormalizedAbsolutePath(a.rootDir,ce):q(Z),X&&X[X.length-1]!==e.directorySeparator&&(X+=e.directorySeparator)),X}function _(){if(!$){f(),$={};for(var t=0,n=Z;t<n.length;t++){var r=n[t];e.copyMap(r.classifiableNames,$)}}return $}function u(){if(!o)return!1;e.Debug.assert(!o.structureIsReused);var n=o.getRootFileNames();if(!e.arrayIsEqualTo(n,t))return!1;for(var r=[],s=[],c=[],_=0,u=o.getSourceFiles();_<u.length;_++){var l=u[_],d=i.getSourceFile(l.fileName,a.target);if(!d)return!1;if(d.path=l.path,s.push(d.path),l!==d){if(l.hasNoDefaultLib!==d.hasNoDefaultLib)return!1;if(!e.arrayIsEqualTo(l.referencedFiles,d.referencedFiles,I))return!1;if(M(d),!e.arrayIsEqualTo(l.imports,d.imports,F))return!1;if(!e.arrayIsEqualTo(l.moduleAugmentations,d.moduleAugmentations,F))return!1;if(_e)for(var p=e.map(e.concatenate(d.imports,d.moduleAugmentations),L),f=_e(p,e.getNormalizedAbsolutePath(d.fileName,ce)),m=0;m<p.length;m++){var g=f[m],y=e.getResolvedModule(l,p[m]),h=y?!g||y.resolvedFileName!==g.resolvedFileName||!!y.isExternalLibraryImport!=!!g.isExternalLibraryImport:g;if(h)return!1}d.resolvedModules=l.resolvedModules,c.push(d)}else d=l;r.push(d)}for(var m=0,v=r.length;v>m;m++)ue.set(s[m],r[m]);Z=r,ee=o.getFileProcessingDiagnostics();for(var k=0,b=c;k<b.length;k++){var x=b[k];ee.reattachFileDiagnostics(x)}return o.structureIsReused=!0,!0}function d(e){return{getCanonicalFileName:J,getCommonSourceDirectory:G.getCommonSourceDirectory,getCompilerOptions:G.getCompilerOptions,getCurrentDirectory:function(){return ce},getNewLine:function(){return i.getNewLine()},getSourceFile:G.getSourceFile,getSourceFiles:G.getSourceFiles,writeFile:e||function(e,t,n,r){return i.writeFile(e,t,n,r)},isEmitBlocked:y}}function p(){return Q||(Q=e.createTypeChecker(G,!0))}function f(){return Y||(Y=e.createTypeChecker(G,!1))}function g(e,t,n){var r=this;return S(function(){return h(r,e,t,n)})}function y(t){return se.contains(e.toPath(t,ce,J))}function h(t,n,r,i){if(a.noEmitOnError){var o=t.getOptionsDiagnostics(i).concat(t.getSyntacticDiagnostics(n,i),t.getGlobalDiagnostics(i),t.getSemanticDiagnostics(n,i)),s=[];if(0===o.length&&t.getCompilerOptions().declaration&&(s=t.getDeclarationDiagnostics(void 0,i)),o.length>0||s.length>0)return{diagnostics:s,sourceMaps:void 0,emitSkipped:!0}}var c=p().getEmitResolver(a.outFile||a.out?void 0:n),_=(new Date).getTime(),u=e.emitFiles(c,d(r),n);return e.emitTime+=(new Date).getTime()-_,u}function v(t){return ue.get(e.toPath(t,ce,J))}function k(t,n,r){if(t)return n(t,r);var a=[];return e.forEach(G.getSourceFiles(),function(t){r&&r.throwIfCancellationRequested(),e.addRange(a,n(t,r))}),e.sortAndDeduplicateDiagnostics(a)}function b(e,t){return k(e,D,t)}function x(e,t){return k(e,T,t)}function C(e,t){var n=G.getCompilerOptions();return!e||n.out||n.outFile?w(e,t):k(e,A,t)}function D(e,t){return e.parseDiagnostics}function S(t){try{return t()}catch(n){throw n instanceof e.OperationCanceledException&&(Y=void 0,Q=void 0),n}}function T(t,n){return S(function(){var r=p();e.Debug.assert(!!t.bindDiagnostics);var a=t.bindDiagnostics,i=e.isSourceFileJavaScript(t)?E(t,n):r.getDiagnostics(t,n),o=ee.getDiagnostics(t.fileName),s=te.getDiagnostics(t.fileName);return a.concat(i).concat(o).concat(s)})}function E(t,n){return S(function(){function n(c){if(!c)return!1;switch(c.kind){case 224:return s.push(e.createDiagnosticForNode(c,e.Diagnostics.import_can_only_be_used_in_a_ts_file)),!0;case 230:if(c.isExportEquals)return s.push(e.createDiagnosticForNode(c,e.Diagnostics.export_can_only_be_used_in_a_ts_file)),!0;break;case 217:var _=c;if(o(_.modifiers)||r(_.typeParameters))return!0;break;case 246:var u=c;if(106===u.token)return s.push(e.createDiagnosticForNode(c,e.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)),!0;break;case 218:return s.push(e.createDiagnosticForNode(c,e.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)),!0;case 221:return s.push(e.createDiagnosticForNode(c,e.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)),!0;case 219:return s.push(e.createDiagnosticForNode(c,e.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)),!0;case 144:case 143:case 145:case 146:case 147:case 176:case 216:case 177:case 216:var l=c;if(o(l.modifiers)||r(l.typeParameters)||i(l.type))return!0;break;case 196:var d=c;if(o(d.modifiers))return!0;break;case 214:var p=c;if(i(p.type))return!0;break;case 171:case 172:var f=c;if(f.typeArguments&&f.typeArguments.length>0){var m=f.typeArguments.pos;return s.push(e.createFileDiagnostic(t,m,f.typeArguments.end-m,e.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file)),!0}break;case 139:var g=c;if(g.modifiers){var y=g.modifiers.pos;return s.push(e.createFileDiagnostic(t,y,g.modifiers.end-y,e.Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file)),!0}if(g.questionToken)return s.push(e.createDiagnosticForNode(g.questionToken,e.Diagnostics._0_can_only_be_used_in_a_ts_file,"?")),!0;if(g.type)return s.push(e.createDiagnosticForNode(g.type,e.Diagnostics.types_can_only_be_used_in_a_ts_file)),!0;break;case 142:return s.push(e.createDiagnosticForNode(c,e.Diagnostics.property_declarations_can_only_be_used_in_a_ts_file)),!0;case 220:return s.push(e.createDiagnosticForNode(c,e.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)),!0;case 174:var h=c;return s.push(e.createDiagnosticForNode(h.type,e.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)),!0;case 140:return a.experimentalDecorators||s.push(e.createDiagnosticForNode(c,e.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning)),!0}return e.forEachChild(c,n)}function r(n){if(n){var r=n.pos;return s.push(e.createFileDiagnostic(t,r,n.end-r,e.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)),!0}return!1}function i(t){return t?(s.push(e.createDiagnosticForNode(t,e.Diagnostics.types_can_only_be_used_in_a_ts_file)),!0):!1}function o(t){if(t)for(var n=0,r=t;n<r.length;n++){var a=r[n];switch(a.kind){case 112:case 110:case 111:case 122:return s.push(e.createDiagnosticForNode(a,e.Diagnostics._0_can_only_be_used_in_a_ts_file,e.tokenToString(a.kind))),!0;case 113:case 82:case 74:case 77:case 115:}}return!1}var s=[];return n(t),s})}function w(t,n){return S(function(){var r=p().getEmitResolver(t,n),a=function(){};return e.getDeclarationDiagnostics(d(a),r,t)})}function A(t,n){return e.isDeclarationFile(t)?[]:w(t,n)}function P(){var t=[];return e.addRange(t,ee.getGlobalDiagnostics()),e.addRange(t,te.getGlobalDiagnostics()),e.sortAndDeduplicateDiagnostics(t)}function N(){var t=[];return e.addRange(t,p().getGlobalDiagnostics()),e.sortAndDeduplicateDiagnostics(t)}function O(t){return e.getBaseFileName(t).indexOf(".")>=0}function R(t,n){B(e.normalizePath(t),n)}function I(e,t){return e.fileName===t.fileName}function F(e,t){return e.text===t.text}function L(e){return e.text}function M(t){function n(r,o){switch(r.kind){case 225:case 224:case 231:var c=e.getExternalModuleName(r);if(!c||9!==c.kind)break;if(!c.text)break;o&&e.isExternalModuleNameRelative(c.text)||(a||(a=[])).push(c);break;case 221:if(e.isAmbientModule(r)&&(o||4&r.flags||e.isDeclarationFile(t))){var _=r.name;if(s||o&&!e.isExternalModuleNameRelative(_.text))(i||(i=[])).push(_);else if(!o)for(var u=0,l=r.body.statements;u<l.length;u++){var d=l[u];n(d,!0)}}}}function r(t){e.isRequireCall(t,!0)?(a||(a=[])).push(t.arguments[0]):e.forEachChild(t,r)}if(!t.imports){for(var a,i,o=e.isSourceFileJavaScript(t),s=e.isExternalModule(t),c=0,_=t.statements;c<_.length;c++){var u=_[c];n(u,!1),o&&r(u)}t.imports=a||m,t.moduleAugmentations=i||m}}function B(t,n,r,o,c){var _,u;if(O(t))a.allowNonTsExtensions||e.forEach(ie,function(n){return e.fileExtensionIs(i.getCanonicalFileName(t),n)})?K(t,e.toPath(t,ce,J),n,r,o,c)?r&&i.getCanonicalFileName(t)===i.getCanonicalFileName(r.fileName)&&(u=e.Diagnostics.A_file_cannot_have_a_reference_to_itself,_=[t]):(u=e.Diagnostics.File_0_not_found,_=[t]):(u=e.Diagnostics.File_0_has_unsupported_extension_The_only_supported_extensions_are_1,_=[t,"'"+ie.join("', '")+"'"]);else{var l=a.allowNonTsExtensions&&K(t,e.toPath(t,ce,J),n,r,o,c);l||(a.allowNonTsExtensions?(u=e.Diagnostics.File_0_not_found,_=[t]):e.forEach(ie,function(a){return K(t+a,e.toPath(t+a,ce,J),n,r,o,c)})||(u=e.Diagnostics.File_0_not_found,t+=".ts",_=[t]))}u&&!s()&&(void 0!==r&&void 0!==c&&void 0!==o?ee.add(e.createFileDiagnostic.apply(void 0,[r,o,c-o,u].concat(_))):ee.add(e.createCompilerDiagnostic.apply(void 0,[u].concat(_))))}function z(t,n,r,a,i){void 0!==r&&void 0!==a&&void 0!==i?ee.add(e.createFileDiagnostic(r,a,i-a,e.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing,t,n)):ee.add(e.createCompilerDiagnostic(e.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing,t,n))}function K(t,n,r,o,_,u){if(ue.contains(n)){var l=ue.get(n);return l&&a.forceConsistentCasingInFileNames&&e.getNormalizedAbsolutePath(l.fileName,ce)!==e.getNormalizedAbsolutePath(t,ce)&&z(t,l.fileName,o,_,u),l}var d=!e.hasTypeScriptFileExtension(t);if(!d||!s()){var p=i.getSourceFile(t,a.target,function(n){void 0!==o&&void 0!==_&&void 0!==u?ee.add(e.createFileDiagnostic(o,_,u-_,e.Diagnostics.Cannot_read_file_0_Colon_1,t,n)):ee.add(e.createCompilerDiagnostic(e.Diagnostics.Cannot_read_file_0_Colon_1,t,n))});if(d&&!a.disableSizeLimit&&p&&p.text&&(re+=p.text.length,re>e.maxProgramSizeForNonTsFiles)){var f=c(),m=n.substring(0,Math.max(f.length,n.indexOf(e.directorySeparator,f.length)));return m[m.length-1]!==e.directorySeparator&&(m+=e.directorySeparator),te.add(e.createCompilerDiagnostic(e.Diagnostics.Too_many_JavaScript_files_in_the_project_Consider_specifying_the_exclude_setting_in_project_configuration_to_limit_included_source_folders_The_likely_folder_to_exclude_is_0_To_disable_the_project_size_limit_set_the_disableSizeLimit_compiler_option_to_true,m)),void(re=ne)}if(ue.set(n,p),p){if(p.path=n,i.useCaseSensitiveFileNames()){var g=le.get(n);g?z(t,g.fileName,o,_,u):le.set(n,p)}ae=ae||p.hasNoDefaultLib;var y=e.getDirectoryPath(t);a.noResolve||j(p,y),U(p,y),r?Z.unshift(p):Z.push(p)}return p}}function j(t,r){e.forEach(t.referencedFiles,function(e){var r=n(e.fileName,t.fileName);B(r,!1,t,e.pos,e.end)})}function J(e){return i.getCanonicalFileName(e)}function U(t,n){if(M(t),t.imports.length||t.moduleAugmentations.length){t.resolvedModules={};for(var r=e.map(e.concatenate(t.imports,t.moduleAugmentations),L),i=_e(r,e.getNormalizedAbsolutePath(t.fileName,ce)),o=0;o<r.length;o++){var s=i[o];e.setResolvedModule(t,r[o],s);var c=s&&!a.noResolve&&o<t.imports.length;if(c){var _=K(s.resolvedFileName,e.toPath(s.resolvedFileName,ce,J),!1,t,e.skipTrivia(t.text,t.imports[o].pos),t.imports[o].end);if(_&&s.isExternalLibraryImport)if(!e.isExternalModule(_)&&_.statements.length){var u=e.getTokenPosOfNode(t.imports[o],t);ee.add(e.createFileDiagnostic(t,u,t.imports[o].end-u,e.Diagnostics.Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition,_.fileName))}else if(_.referencedFiles.length){var l=_.referencedFiles[0];ee.add(e.createFileDiagnostic(_,l.pos,l.end-l.pos,e.Diagnostics.Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition))}}}}else t.resolvedModules=void 0}function q(t){var n,r=e.forEach(Z,function(t){if(!e.isDeclarationFile(t)){var r=e.getNormalizedPathComponents(t.fileName,ce);if(r.pop(),!n)return void(n=r);for(var a=0,i=Math.min(n.length,r.length);i>a;a++)if(J(n[a])!==J(r[a])){if(0===a)return!0;n.length=a;break}r.length<n.length&&(n.length=r.length)}});return r?"":n?e.getNormalizedPathFromPathComponents(n):ce}function W(t,n){var r=!0;if(t)for(var o=i.getCanonicalFileName(e.getNormalizedAbsolutePath(n,ce)),s=0,c=t;s<c.length;s++){var _=c[s];if(!e.isDeclarationFile(_)){var u=i.getCanonicalFileName(e.getNormalizedAbsolutePath(_.fileName,ce));0!==u.indexOf(o)&&(te.add(e.createCompilerDiagnostic(e.Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files,_.fileName,a.rootDir)),r=!1)}}return r}function V(){function t(t,n){if(t){var r=e.toPath(t,ce,J);ue.contains(r)&&H(t,r,e.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file),n.contains(r)?H(t,r,e.Diagnostics.Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files):n.set(r,!0)}}a.isolatedModules&&(a.declaration&&te.add(e.createCompilerDiagnostic(e.Diagnostics.Option_0_cannot_be_specified_with_option_1,"declaration","isolatedModules")),a.noEmitOnError&&te.add(e.createCompilerDiagnostic(e.Diagnostics.Option_0_cannot_be_specified_with_option_1,"noEmitOnError","isolatedModules")),a.out&&te.add(e.createCompilerDiagnostic(e.Diagnostics.Option_0_cannot_be_specified_with_option_1,"out","isolatedModules")),a.outFile&&te.add(e.createCompilerDiagnostic(e.Diagnostics.Option_0_cannot_be_specified_with_option_1,"outFile","isolatedModules"))),a.inlineSourceMap&&(a.sourceMap&&te.add(e.createCompilerDiagnostic(e.Diagnostics.Option_0_cannot_be_specified_with_option_1,"sourceMap","inlineSourceMap")),a.mapRoot&&te.add(e.createCompilerDiagnostic(e.Diagnostics.Option_0_cannot_be_specified_with_option_1,"mapRoot","inlineSourceMap"))),a.inlineSources&&(a.sourceMap||a.inlineSourceMap||te.add(e.createCompilerDiagnostic(e.Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided)),a.sourceRoot&&te.add(e.createCompilerDiagnostic(e.Diagnostics.Option_0_cannot_be_specified_with_option_1,"sourceRoot","inlineSources"))),a.out&&a.outFile&&te.add(e.createCompilerDiagnostic(e.Diagnostics.Option_0_cannot_be_specified_with_option_1,"out","outFile")),a.sourceMap||!a.mapRoot&&!a.sourceRoot||(a.mapRoot&&te.add(e.createCompilerDiagnostic(e.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1,"mapRoot","sourceMap")),a.sourceRoot&&!a.inlineSourceMap&&te.add(e.createCompilerDiagnostic(e.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1,"sourceRoot","sourceMap")));var n=a.target||0,r=a.outFile||a.out,o=e.forEach(Z,function(t){return e.isExternalModule(t)?t:void 0});if(a.isolatedModules){0===a.module&&2>n&&te.add(e.createCompilerDiagnostic(e.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher));var s=e.forEach(Z,function(t){return e.isExternalModule(t)||e.isDeclarationFile(t)?void 0:t});if(s){var _=e.getErrorSpanForNode(s,s);te.add(e.createFileDiagnostic(s,_.start,_.length,e.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided))}}else if(o&&2>n&&0===a.module){var _=e.getErrorSpanForNode(o,o.externalModuleIndicator);te.add(e.createFileDiagnostic(o,_.start,_.length,e.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided_with_a_valid_module_type_Consider_setting_the_module_compiler_option_in_a_tsconfig_json_file))}if(5===a.module&&2>n&&te.add(e.createCompilerDiagnostic(e.Diagnostics.Cannot_compile_modules_into_es2015_when_targeting_ES5_or_lower)),r&&a.module&&2!==a.module&&4!==a.module&&te.add(e.createCompilerDiagnostic(e.Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0,a.out?"out":"outFile")),a.outDir||a.sourceRoot||a.mapRoot){var u=c();a.outDir&&""===u&&e.forEach(Z,function(t){return e.getRootLength(t.fileName)>1})&&te.add(e.createCompilerDiagnostic(e.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files))}if(a.noEmit?(a.out&&te.add(e.createCompilerDiagnostic(e.Diagnostics.Option_0_cannot_be_specified_with_option_1,"noEmit","out")),a.outFile&&te.add(e.createCompilerDiagnostic(e.Diagnostics.Option_0_cannot_be_specified_with_option_1,"noEmit","outFile")),a.outDir&&te.add(e.createCompilerDiagnostic(e.Diagnostics.Option_0_cannot_be_specified_with_option_1,"noEmit","outDir")),a.declaration&&te.add(e.createCompilerDiagnostic(e.Diagnostics.Option_0_cannot_be_specified_with_option_1,"noEmit","declaration"))):a.allowJs&&a.declaration&&te.add(e.createCompilerDiagnostic(e.Diagnostics.Option_0_cannot_be_specified_with_option_1,"allowJs","declaration")),a.emitDecoratorMetadata&&!a.experimentalDecorators&&te.add(e.createCompilerDiagnostic(e.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1,"emitDecoratorMetadata","experimentalDecorators")),a.reactNamespace&&!e.isIdentifier(a.reactNamespace,n)&&te.add(e.createCompilerDiagnostic(e.Diagnostics.Invalide_value_for_reactNamespace_0_is_not_a_valid_identifier,a.reactNamespace)),!a.noEmit&&!a.suppressOutputPathCheck){var l=d(),p=e.createFileMap(i.useCaseSensitiveFileNames()?void 0:function(e){return e.toLocaleLowerCase()});e.forEachExpectedEmitFile(l,function(e,n,r){t(e.jsFilePath,p),t(e.declarationFilePath,p)})}}function H(t,n,r){se.set(e.toPath(t,ce,J),!0),te.add(e.createCompilerDiagnostic(r,t))}var G,X,Q,Y,$,Z=[],ee=e.createDiagnosticCollection(),te=e.createDiagnosticCollection(),ne=-1,re=0,ae=a.noLib,ie=e.getSupportedExtensions(a),oe=(new Date).getTime();i=i||l(a);var se=e.createFileMap(J),ce=i.getCurrentDirectory(),_e=i.resolveModuleNames?function(e,t){return i.resolveModuleNames(e,t)}:function(t,n){for(var o=[],s={},c=0,_=t;c<_.length;c++){var u=_[c],l=void 0;e.hasProperty(s,u)?l=s[u]:(l=r(u,n,a,i).resolvedModule,s[u]=l),o.push(l)}return o},ue=e.createFileMap(),le=i.useCaseSensitiveFileNames()?e.createFileMap(function(e){return e.toLowerCase()}):void 0;if(o){var de=o.getCompilerOptions();de.module===a.module&&de.noResolve===a.noResolve&&de.target===a.target&&de.noLib===a.noLib&&de.jsx===a.jsx&&de.allowJs===a.allowJs&&de.disableSizeLimit===a.disableSizeLimit||(o=void 0)}return u()||(e.forEach(t,function(e){return R(e,!1)}),ae||R(i.getDefaultLibFileName(a),!0)),o=void 0,G={getRootFileNames:function(){return t},getSourceFile:v,getSourceFiles:function(){return Z},getCompilerOptions:function(){return a},getSyntacticDiagnostics:b,getOptionsDiagnostics:P,getGlobalDiagnostics:N,getSemanticDiagnostics:x,getDeclarationDiagnostics:C,getTypeChecker:f,getClassifiableNames:_,getDiagnosticsProducingTypeChecker:p,getCommonSourceDirectory:c,emit:g,getCurrentDirectory:function(){return ce},getNodeCount:function(){return p().getNodeCount()},getIdentifierCount:function(){return p().getIdentifierCount()},getSymbolCount:function(){return p().getSymbolCount()},getTypeCount:function(){return p().getTypeCount()},getFileProcessingDiagnostics:function(){return ee}},V(),e.programTime+=(new Date).getTime()-oe,G}e.programTime=0,e.emitTime=0,e.ioReadTime=0,e.ioWriteTime=0,e.maxProgramSizeForNonTsFiles=20971520;var m=[];e.version="1.8.10",e.findConfigFile=t,e.resolveTripleslashReference=n,e.resolveModuleName=r,e.nodeModuleNameResolver=a,e.directoryProbablyExists=i,e.classicNameResolver=u,e.defaultInitCompilerOptions={module:1,target:1,noImplicitAny:!1,sourceMap:!1},e.createCompilerHost=l,e.getPreEmitDiagnostics=d,e.flattenDiagnosticMessageText=p,e.createProgram=f}(ts||(ts={}));var ts;!function(e){function t(){if(_)return _;var t={},n={};return e.forEach(e.optionDeclarations,function(e){t[e.name.toLowerCase()]=e,e.shortName&&(n[e.shortName]=e.name)}),_={optionNameMap:t,shortOptionNames:n}}function n(n,r){function a(t){for(var n=0;n<t.length;){var r=t[n];if(n++,64===r.charCodeAt(0))i(r.slice(1));else if(45===r.charCodeAt(0))if(r=r.slice(45===r.charCodeAt(1)?2:1).toLowerCase(),e.hasProperty(l,r)&&(r=l[r]),e.hasProperty(u,r)){var a=u[r];switch(t[n]||"boolean"===a.type||c.push(e.createCompilerDiagnostic(e.Diagnostics.Compiler_option_0_expects_an_argument,a.name)),a.type){case"number":o[a.name]=parseInt(t[n]),n++;break;case"boolean":o[a.name]=!0;break;case"string":o[a.name]=t[n]||"",n++;break;default:var _=a.type,d=(t[n]||"").toLowerCase();n++,e.hasProperty(_,d)?o[a.name]=_[d]:c.push(e.createCompilerDiagnostic(a.error))}}else c.push(e.createCompilerDiagnostic(e.Diagnostics.Unknown_compiler_option_0,r));else s.push(r)}}function i(t){var n=r?r(t):e.sys.readFile(t);if(!n)return void c.push(e.createCompilerDiagnostic(e.Diagnostics.File_0_not_found,t));for(var i=[],o=0;;){for(;o<n.length&&n.charCodeAt(o)<=32;)o++;if(o>=n.length)break;var s=o;if(34===n.charCodeAt(s)){for(o++;o<n.length&&34!==n.charCodeAt(o);)o++;o<n.length?(i.push(n.substring(s+1,o)),o++):c.push(e.createCompilerDiagnostic(e.Diagnostics.Unterminated_quoted_string_in_response_file_0,t))}else{for(;n.charCodeAt(o)>32;)o++;i.push(n.substring(s,o))}}a(i)}var o={},s=[],c=[],_=t(),u=_.optionNameMap,l=_.shortOptionNames;return a(n),{options:o,fileNames:s,errors:c}}function r(t,n){var r="";try{r=n(t)}catch(i){return{error:e.createCompilerDiagnostic(e.Diagnostics.Cannot_read_file_0_Colon_1,t,i.message)}}return a(t,r)}function a(t,n){try{var r=i(n);return{config:/\S/.test(r)?JSON.parse(r):{}}}catch(a){return{error:e.createCompilerDiagnostic(e.Diagnostics.Failed_to_parse_file_0_Colon_1,t,a.message)}}}function i(t){for(var n,r="",a=e.createScanner(1,!1,0,t);1!==(n=a.scan());)switch(n){case 2:case 3:r+=a.getTokenText().replace(/\S/g," ");break;default:r+=a.getTokenText()}return r}function o(t,n,r,a,i){function o(){var a=[];if(e.hasProperty(t,"files"))t.files instanceof Array?a=e.map(t.files,function(t){return e.combinePaths(r,t)}):d.push(e.createCompilerDiagnostic(e.Diagnostics.Compiler_option_0_requires_a_value_of_type_1,"files","Array"));else{var i={},o=[];if(t.exclude instanceof Array)o=t.exclude;else{o=["node_modules","bower_components"];var s=t.compilerOptions&&t.compilerOptions.outDir;s&&o.push(s)}o=e.map(o,e.normalizeSlashes);var c=e.getSupportedExtensions(p);e.Debug.assert(e.indexOf(c,".ts")<e.indexOf(c,".d.ts"),"Changed priority of extensions to pick");for(var _=0,u=c;_<u.length;_++)for(var l=u[_],f=n.readDirectory(r,l,o),m=0,g=f;m<g.length;m++){var y=g[m];if(!(".ts"===l&&e.fileExtensionIs(y,".d.ts")||/\.min\.js$/.test(y))){if(".d.ts"===l||p.allowJs&&e.contains(e.supportedJavascriptExtensions,l)){var h=y.substr(0,y.length-l.length);if(e.hasProperty(i,h+".ts")||e.hasProperty(i,h+".tsx"))continue}i[y]=!0,a.push(y)}}}return a}function _(){var n="jsconfig.json"===e.getBaseFileName(i)?{enableAutoDiscovery:!0,include:[],exclude:[]}:{enableAutoDiscovery:!1,include:[],exclude:[]},r=t.typingOptions;if(r)for(var a in r)"enableAutoDiscovery"===a?"boolean"==typeof r[a]?n.enableAutoDiscovery=r[a]:d.push(e.createCompilerDiagnostic(e.Diagnostics.Unknown_typing_option_0,a)):"include"===a?n.include=c(a,r[a],d):"exclude"===a?n.exclude=c(a,r[a],d):d.push(e.createCompilerDiagnostic(e.Diagnostics.Unknown_typing_option_0,a));return n}void 0===a&&(a={});var u=s(t.compilerOptions,r,i),l=u.options,d=u.errors,p=e.extend(a,l);return{options:p,fileNames:o(),typingOptions:_(),errors:d}}function s(t,n,r){var a={},i=[];if(r&&"jsconfig.json"===e.getBaseFileName(r)&&(a.allowJs=!0),!t)return{options:a,errors:i};var o=e.arrayToMap(e.optionDeclarations,function(e){return e.name});for(var s in t)if(e.hasProperty(o,s)){var c=o[s],_=c.type,u=t[s],l="string"==typeof _?_:"string";if(typeof u===l){if("string"!=typeof _){var d=u.toLowerCase();e.hasProperty(_,d)?u=_[d]:(i.push(e.createCompilerDiagnostic(c.error)),u=0)}c.isFilePath&&(u=e.normalizePath(e.combinePaths(n,u)),""===u&&(u=".")),a[c.name]=u}else i.push(e.createCompilerDiagnostic(e.Diagnostics.Compiler_option_0_requires_a_value_of_type_1,s,l))}else i.push(e.createCompilerDiagnostic(e.Diagnostics.Unknown_compiler_option_0,s));return{options:a,errors:i}}function c(t,n,r,a){var i=[],o=!1;if(e.isArray(n))for(var s=0,c=n;s<c.length;s++){var _=c[s];if("string"!=typeof _){o=!0;break}var u=a?a(_):_;i.push(u)}else o=!0;return o&&r.push(e.createCompilerDiagnostic(e.Diagnostics.Option_0_should_have_array_of_strings_as_a_value,t)),i}e.optionDeclarations=[{name:"charset",type:"string"},{name:"declaration",shortName:"d",type:"boolean",description:e.Diagnostics.Generates_corresponding_d_ts_file},{name:"diagnostics",type:"boolean"},{name:"emitBOM",type:"boolean"},{name:"help",shortName:"h",type:"boolean",description:e.Diagnostics.Print_this_message},{name:"init",type:"boolean",description:e.Diagnostics.Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file},{name:"inlineSourceMap",type:"boolean"},{name:"inlineSources",type:"boolean"},{name:"jsx",type:{preserve:1,react:2},paramType:e.Diagnostics.KIND,description:e.Diagnostics.Specify_JSX_code_generation_Colon_preserve_or_react,error:e.Diagnostics.Argument_for_jsx_must_be_preserve_or_react},{name:"reactNamespace",type:"string",description:e.Diagnostics.Specifies_the_object_invoked_for_createElement_and_spread_when_targeting_react_JSX_emit},{name:"listFiles",type:"boolean"},{name:"locale",type:"string"},{name:"mapRoot",type:"string",isFilePath:!0,description:e.Diagnostics.Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,paramType:e.Diagnostics.LOCATION},{name:"module",shortName:"m",type:{none:0,commonjs:1,amd:2,system:4,umd:3,es6:5,es2015:5},description:e.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_or_es2015,paramType:e.Diagnostics.KIND,error:e.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_umd_es2015_or_none},{name:"newLine",type:{crlf:0,lf:1},description:e.Diagnostics.Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix,paramType:e.Diagnostics.NEWLINE,error:e.Diagnostics.Argument_for_newLine_option_must_be_CRLF_or_LF},{name:"noEmit",type:"boolean",description:e.Diagnostics.Do_not_emit_outputs},{name:"noEmitHelpers",type:"boolean"},{name:"noEmitOnError",type:"boolean",description:e.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported},{name:"noImplicitAny",type:"boolean",description:e.Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type},{name:"noLib",type:"boolean"},{name:"noResolve",type:"boolean"},{name:"skipDefaultLibCheck",type:"boolean"},{name:"out",type:"string",isFilePath:!1,paramType:e.Diagnostics.FILE},{
name:"outFile",type:"string",isFilePath:!0,description:e.Diagnostics.Concatenate_and_emit_output_to_single_file,paramType:e.Diagnostics.FILE},{name:"outDir",type:"string",isFilePath:!0,description:e.Diagnostics.Redirect_output_structure_to_the_directory,paramType:e.Diagnostics.DIRECTORY},{name:"preserveConstEnums",type:"boolean",description:e.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code},{name:"pretty",paramType:e.Diagnostics.KIND,description:e.Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental,type:"boolean"},{name:"project",shortName:"p",type:"string",isFilePath:!0,description:e.Diagnostics.Compile_the_project_in_the_given_directory,paramType:e.Diagnostics.DIRECTORY},{name:"removeComments",type:"boolean",description:e.Diagnostics.Do_not_emit_comments_to_output},{name:"rootDir",type:"string",isFilePath:!0,description:e.Diagnostics.Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir,paramType:e.Diagnostics.LOCATION},{name:"isolatedModules",type:"boolean"},{name:"sourceMap",type:"boolean",description:e.Diagnostics.Generates_corresponding_map_file},{name:"sourceRoot",type:"string",isFilePath:!0,description:e.Diagnostics.Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations,paramType:e.Diagnostics.LOCATION},{name:"suppressExcessPropertyErrors",type:"boolean",description:e.Diagnostics.Suppress_excess_property_checks_for_object_literals,experimental:!0},{name:"suppressImplicitAnyIndexErrors",type:"boolean",description:e.Diagnostics.Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures},{name:"stripInternal",type:"boolean",description:e.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation,experimental:!0},{name:"target",shortName:"t",type:{es3:0,es5:1,es6:2,es2015:2},description:e.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES2015_experimental,paramType:e.Diagnostics.VERSION,error:e.Diagnostics.Argument_for_target_option_must_be_ES3_ES5_or_ES2015},{name:"version",shortName:"v",type:"boolean",description:e.Diagnostics.Print_the_compiler_s_version},{name:"watch",shortName:"w",type:"boolean",description:e.Diagnostics.Watch_input_files},{name:"experimentalDecorators",type:"boolean",description:e.Diagnostics.Enables_experimental_support_for_ES7_decorators},{name:"emitDecoratorMetadata",type:"boolean",experimental:!0,description:e.Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators},{name:"moduleResolution",type:{node:2,classic:1},description:e.Diagnostics.Specifies_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6,error:e.Diagnostics.Argument_for_moduleResolution_option_must_be_node_or_classic},{name:"allowUnusedLabels",type:"boolean",description:e.Diagnostics.Do_not_report_errors_on_unused_labels},{name:"noImplicitReturns",type:"boolean",description:e.Diagnostics.Report_error_when_not_all_code_paths_in_function_return_a_value},{name:"noFallthroughCasesInSwitch",type:"boolean",description:e.Diagnostics.Report_errors_for_fallthrough_cases_in_switch_statement},{name:"allowUnreachableCode",type:"boolean",description:e.Diagnostics.Do_not_report_errors_on_unreachable_code},{name:"forceConsistentCasingInFileNames",type:"boolean",description:e.Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file},{name:"allowSyntheticDefaultImports",type:"boolean",description:e.Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking},{name:"allowJs",type:"boolean",description:e.Diagnostics.Allow_javascript_files_to_be_compiled},{name:"noImplicitUseStrict",type:"boolean",description:e.Diagnostics.Do_not_emit_use_strict_directives_in_module_output},{name:"noCustomAsyncPromise",type:"boolean",experimental:!0},{name:"disableSizeLimit",type:"boolean"}];var _;e.getOptionNameMap=t,e.parseCommandLine=n,e.readConfigFile=r,e.parseConfigFileTextToJson=a,e.parseJsonConfigFileContent=o,e.convertCompilerOptionsFromJson=s}(ts||(ts={}));var ts;!function(e){var t;!function(t){function n(t){function n(t,n,r,a){if(t&&n&&r){var i={textSpan:e.createTextSpanFromBounds(n.pos,r.end),hintSpan:e.createTextSpanFromBounds(t.getStart(),t.end),bannerText:_,autoCollapse:a};c.push(i)}}function r(t,n){if(t){var r={textSpan:e.createTextSpanFromBounds(t.pos,t.end),hintSpan:e.createTextSpanFromBounds(t.pos,t.end),bannerText:_,autoCollapse:n};c.push(r)}}function a(n){var a=e.getLeadingCommentRangesOfNode(n,t);if(a){for(var o=-1,s=-1,c=!0,_=0,u=0,l=a;u<l.length;u++){var d=l[u];2===d.kind?(c&&(o=d.pos),c=!1,s=d.end,_++):3===d.kind&&(i(_,o,s),r(d,!1),_=0,s=-1,c=!0)}i(_,o,s)}}function i(e,t,n){if(e>1){var a={pos:t,end:n,kind:2};r(a,!1)}}function o(t){return e.isFunctionBlock(t)&&177!==t.parent.kind}function s(r){if(!(u>l)){switch(e.isDeclaration(r)&&a(r),r.kind){case 195:if(!e.isFunctionBlock(r)){var i=r.parent,d=e.findChildOfKind(r,15,t),p=e.findChildOfKind(r,16,t);if(200===i.kind||203===i.kind||204===i.kind||202===i.kind||199===i.kind||201===i.kind||208===i.kind||247===i.kind){n(i,d,p,o(r));break}if(212===i.kind){var f=i;if(f.tryBlock===r){n(i,d,p,o(r));break}if(f.finallyBlock===r){var m=e.findChildOfKind(f,85,t);if(m){n(m,d,p,o(r));break}}}var g=e.createTextSpanFromBounds(r.getStart(),r.end);c.push({textSpan:g,hintSpan:g,bannerText:_,autoCollapse:o(r)});break}case 222:var d=e.findChildOfKind(r,15,t),p=e.findChildOfKind(r,16,t);n(r.parent,d,p,o(r));break;case 217:case 218:case 220:case 168:case 223:var d=e.findChildOfKind(r,15,t),p=e.findChildOfKind(r,16,t);n(r,d,p,o(r));break;case 167:var y=e.findChildOfKind(r,19,t),h=e.findChildOfKind(r,20,t);n(r,y,h,o(r))}u++,e.forEachChild(r,s),u--}}var c=[],_="...",u=0,l=20;return s(t),c}t.collectElements=n}(t=e.OutliningElementsCollector||(e.OutliningElementsCollector={}))}(ts||(ts={}));var ts;!function(e){var t;!function(t){function n(t,n,r,a){function i(t){e.Debug.assert(t.length>0);for(var n=0,r=t;n<r.length;n++){var a=r[n];if(!a.isCaseSensitive)return!1}return!0}function o(e){return!e||69!==e.kind&&9!==e.kind&&8!==e.kind?void 0:e.text}function s(e,t){if(e&&e.name){var n=o(e.name);if(void 0===n)return 137===e.name.kind?c(e.name.expression,t,!0):!1;t.unshift(n)}return!0}function c(e,t,n){var r=o(e);if(void 0!==r)return n&&t.unshift(r),!0;if(169===e.kind){var a=e;return n&&t.unshift(a.name.text),c(a.expression,t,!0)}return!1}function _(t){var n=[];if(137!==t.name.kind||c(t.name.expression,n,!1)){for(t=e.getContainerNode(t);t;){if(!s(t,n))return;t=e.getContainerNode(t)}return n}}function u(t){e.Debug.assert(t.length>0);for(var n=e.PatternMatchKind.camelCase,r=0,a=t;r<a.length;r++){var i=a[r],o=i.kind;n>o&&(n=o)}return n}function l(e,t){return e.matchKind-t.matchKind||e.name.localeCompare(t.name,void 0,m)||e.name.localeCompare(t.name)}function d(t){var n=t.declaration,r=e.getContainerNode(n);return{name:t.name,kind:e.getNodeKind(n),kindModifiers:e.getNodeModifiers(n),matchKind:e.PatternMatchKind[t.matchKind],isCaseSensitive:t.isCaseSensitive,fileName:t.fileName,textSpan:e.createTextSpanFromBounds(n.getStart(),n.getEnd()),containerName:r&&r.name?r.name.text:"",containerKind:r&&r.name?e.getNodeKind(r):""}}var p=e.createPatternMatcher(r),f=[],m={sensitivity:"base"};e.forEach(t.getSourceFiles(),function(t){n.throwIfCancellationRequested();var r=t.getNamedDeclarations();for(var a in r){var o=e.getProperty(r,a);if(o){var s=p.getMatchesForLastSegmentOfPattern(a);if(!s)continue;for(var c=0,l=o;c<l.length;c++){var d=l[c];if(p.patternContainsDots){var m=_(d);if(!m)return;if(s=p.getMatches(m,a),!s)continue}var g=t.fileName,y=u(s);f.push({name:a,fileName:g,matchKind:y,isCaseSensitive:i(s),declaration:d})}}}}),f.sort(l),void 0!==a&&(f=f.slice(0,a));var g=e.map(f,d);return g}t.getNavigateToItems=n}(t=e.NavigateTo||(e.NavigateTo={}))}(ts||(ts={}));var ts;!function(e){var t;!function(t){function n(t,n){function a(e){for(var t=b?1:0,n=e.parent;n;){switch(n.kind){case 221:do n=n.parent;while(221===n.kind);case 217:case 220:case 218:case 216:t++}n=n.parent}return t}function i(t){function n(t){switch(t.kind){case 196:e.forEach(t.declarationList.declarations,n);break;case 164:case 165:e.forEach(t.elements,n);break;case 231:t.exportClause&&e.forEach(t.exportClause.elements,n);break;case 225:var a=t.importClause;a&&(a.name&&r.push(a),a.namedBindings&&(227===a.namedBindings.kind?r.push(a.namedBindings):e.forEach(a.namedBindings.elements,n)));break;case 166:case 214:if(e.isBindingPattern(t.name)){n(t.name);break}case 217:case 220:case 218:case 221:case 216:case 224:case 229:case 233:r.push(t)}}var r=[];return e.forEach(t,n),s(r)}function o(e){var t=[];return t.push(e),c(e.statements,t),t}function s(t){return t.slice(0).sort(function(t,n){return t.name&&n.name?e.getPropertyNameForPropertyNameNode(t.name).localeCompare(e.getPropertyNameForPropertyNameNode(n.name)):t.name?1:n.name?-1:t.kind-n.kind})}function c(e,t){e=s(e);for(var n=0,r=e;n<r.length;n++){var a=r[n];switch(a.kind){case 217:case 220:case 218:t.push(a);break;case 221:var i=a;t.push(a),c(h(i).body.statements,t);break;case 216:var o=a;_(o)&&(t.push(a),c(o.body.statements,t))}}}function _(t){if(216===t.kind&&t.body&&195===t.body.kind){if(e.forEach(t.body.statements,function(e){return 216===e.kind&&!p(e.name.text)}))return!0;if(!e.isFunctionBlock(t.parent))return!0}return!1}function u(e,t){for(var n=[],r={},a=0,i=e;a<i.length;a++){var o=i[a],s=t(o);if(void 0!==s&&s.text.length>0){var c=s.text+"-"+s.kind+"-"+s.indent,_=r[c];_?l(_,s):(r[c]=s,n.push(s))}}return n}function l(t,n){if(e.addRange(t.spans,n.spans),n.childItems){t.childItems||(t.childItems=[]);e:for(var r=0,a=n.childItems;r<a.length;r++){for(var i=a[r],o=0,s=t.childItems;o<s.length;o++){var c=s[o];if(c.text===i.text&&c.kind===i.kind){l(c,i);continue e}}t.childItems.push(i)}}}function d(t){function n(t,n,r){return f(n,r,e.getNodeModifiers(t),[v(t)])}switch(t.kind){case 139:if(e.isBindingPattern(t.name))break;if(0===(1022&t.flags))return;return n(t,k(t.name),e.ScriptElementKind.memberVariableElement);case 144:case 143:return n(t,k(t.name),e.ScriptElementKind.memberFunctionElement);case 146:return n(t,k(t.name),e.ScriptElementKind.memberGetAccessorElement);case 147:return n(t,k(t.name),e.ScriptElementKind.memberSetAccessorElement);case 150:return n(t,"[]",e.ScriptElementKind.indexSignatureElement);case 250:return n(t,k(t.name),e.ScriptElementKind.memberVariableElement);case 148:return n(t,"()",e.ScriptElementKind.callSignatureElement);case 149:return n(t,"new()",e.ScriptElementKind.constructSignatureElement);case 142:case 141:return n(t,k(t.name),e.ScriptElementKind.memberVariableElement);case 216:return n(t,k(t.name),e.ScriptElementKind.functionElement);case 214:case 166:var r,a=void 0;if(166===t.kind){for(r=t.name,a=t;a&&214!==a.kind;)a=a.parent;e.Debug.assert(void 0!==a)}else e.Debug.assert(!e.isBindingPattern(t.name)),a=t,r=t.name;return e.isConst(a)?n(t,k(r),e.ScriptElementKind.constElement):e.isLet(a)?n(t,k(r),e.ScriptElementKind.letElement):n(t,k(r),e.ScriptElementKind.variableElement);case 145:return n(t,"constructor",e.ScriptElementKind.constructorImplementationElement);case 233:case 229:case 224:case 226:case 227:return n(t,k(t.name),e.ScriptElementKind.alias)}}function p(e){return!e||""===e.trim()}function f(e,t,n,r,a,i){return void 0===a&&(a=[]),void 0===i&&(i=0),p(e)?void 0:{text:e,kind:t,kindModifiers:n,spans:r,childItems:a,indent:i,bolded:!1,grayed:!1}}function m(t){function n(t){if(e.isAmbientModule(t))return k(t.name);var n=[];for(n.push(t.name.text);t.body&&221===t.body.kind;)t=t.body,n.push(t.name.text);return n.join(".")}function r(t){var r=n(t),o=u(i(h(t).body.statements),d);return f(r,e.ScriptElementKind.moduleElement,e.getNodeModifiers(t),[v(t)],o,a(t))}function o(t){if(t.body&&195===t.body.kind){var n=u(s(t.body.statements),d);return f(t.name?t.name.text:"default",e.ScriptElementKind.functionElement,e.getNodeModifiers(t),[v(t)],n,a(t))}}function c(t){var n=u(i(t.statements),d);if(void 0!==n&&0!==n.length){b=!0;var r=e.isExternalModule(t)?'"'+e.escapeString(e.getBaseFileName(e.removeFileExtension(e.normalizePath(t.fileName))))+'"':"<global>";return f(r,e.ScriptElementKind.moduleElement,e.ScriptElementKindModifier.none,[v(t)],n)}}function _(t){var n;if(t.members){var r=e.forEach(t.members,function(e){return 145===e.kind&&e}),i=y(t);r&&e.addRange(i,e.filter(r.parameters,function(t){return!e.isBindingPattern(t.name)})),n=u(s(i),d)}var o=t.name?t.name.text:"default";return f(o,e.ScriptElementKind.classElement,e.getNodeModifiers(t),[v(t)],n,a(t))}function l(t){var n=u(s(g(t)),d);return f(t.name.text,e.ScriptElementKind.enumElement,e.getNodeModifiers(t),[v(t)],n,a(t))}function p(t){var n=u(s(y(t)),d);return f(t.name.text,e.ScriptElementKind.interfaceElement,e.getNodeModifiers(t),[v(t)],n,a(t))}switch(t.kind){case 251:return c(t);case 217:return _(t);case 220:return l(t);case 218:return p(t);case 221:return r(t);case 216:return o(t)}}function g(t){return e.filter(t.members,function(e){return void 0===e.name||137!==e.name.kind})}function y(t){return e.filter(t.members,function(t){return!e.hasDynamicName(t)})}function h(e){for(;221===e.body.kind;)e=e.body;return e}function v(t){return 251===t.kind?e.createTextSpanFromBounds(t.getFullStart(),t.getEnd()):e.createTextSpanFromBounds(t.getStart(),t.getEnd())}function k(n){return e.getTextOfNodeFromSourceText(t.text,n)}if(e.isSourceFileJavaScript(t))return r(t,n);var b=!1;return u(o(t),m)}function r(t,n){function r(t){var n=a(t);if(n&&m.childItems.push(n),n&&(e.isFunctionLike(t)||e.isClassLike(t))){var i=m;d++,m=n,e.forEachChild(t,r),m=i,d--,n&&n.text===u&&0===n.childItems.length&&m.childItems.pop()}else e.forEachChild(t,r)}function a(t){switch(t.kind){case 214:if(251!==t.parent.parent.parent.kind)return;var n=t;if(n.initializer&&(176===n.initializer.kind||177===n.initializer.kind||189===n.initializer.kind))return;case 216:case 217:case 145:case 146:case 147:var r=t.flags&&512&t.flags&&!t.name?"default":145===t.kind?"constructor":e.declarationNameToString(t.name);return i(r,_(t.kind),[c(t)]);case 176:case 177:case 189:return o(t)||s(t);case 144:var a=t;return i(e.declarationNameToString(a.name),e.ScriptElementKind.memberFunctionElement,[c(t)]);case 230:return i("default",e.ScriptElementKind.variableElement,[c(t)]);case 226:if(!t.name)return;case 229:case 227:case 233:if(233===t.kind&&!t.parent.parent.moduleSpecifier&&!t.propertyName)return;var u=t;if(!u.name)return;var l=e.declarationNameToString(u.name);return i(l,e.ScriptElementKind.constElement,[c(t)]);default:return}}function i(t,n,r,a){return void 0===a&&(a=e.ScriptElementKindModifier.none),{text:t,kind:n,kindModifiers:a,spans:r,childItems:[],indent:d,bolded:!1,grayed:!1}}function o(t){if((176===t.kind||177===t.kind)&&171===t.parent.kind){var n=t.parent;if(69===n.expression.kind&&"define"===n.expression.getText()){var r=t.getSourceFile().fileName;return 9===n.arguments[0].kind&&(r=n.arguments[0].text),i(r,e.ScriptElementKind.moduleElement,[c(t.parent)])}}}function s(t){if(176===t.kind||177===t.kind||189===t.kind){var n,r=t;r.name&&e.getFullWidth(r.name)>0?n=e.declarationNameToString(r.name):214===r.parent.kind?n=e.declarationNameToString(r.parent.name):184===r.parent.kind&&56===r.parent.operatorToken.kind?(n=r.parent.left.getText(),n.length>20&&(n=n.substring(0,17)+"...")):n=248===r.parent.kind&&r.parent.name?r.parent.name.getText():189===t.kind?l:u;var a=189===t.kind?e.ScriptElementKind.classElement:e.ScriptElementKind.functionElement;return i(n,a,[c(t)])}}function c(t){return 251===t.kind?e.createTextSpanFromBounds(t.getFullStart(),t.getEnd()):e.createTextSpanFromBounds(t.getStart(),t.getEnd())}function _(t){switch(t){case 214:return e.ScriptElementKind.variableElement;case 216:return e.ScriptElementKind.functionElement;case 217:return e.ScriptElementKind.classElement;case 145:return e.ScriptElementKind.constructorImplementationElement;case 146:return e.ScriptElementKind.memberGetAccessorElement;case 147:return e.ScriptElementKind.memberSetAccessorElement;default:return"unknown"}}var u="<function>",l="<class>",d=0,p=e.isExternalModule(t)?'"'+e.escapeString(e.getBaseFileName(e.removeFileExtension(e.normalizePath(t.fileName))))+'"':"<global>",f=i(p,e.ScriptElementKind.moduleElement,[c(t)]),m=f;return e.forEachChild(t,r),f.childItems}t.getNavigationBarItems=n,t.getJsNavigationBarItems=r}(t=e.NavigationBar||(e.NavigationBar={}))}(ts||(ts={}));var ts;!function(e){function t(e,t,n,r){return{kind:e,punctuationStripped:t,isCaseSensitive:n,camelCaseWeight:r}}function n(n){function o(e){return b||!e}function _(t){return o(t)?void 0:m(t,e.lastOrUndefined(k))}function l(t,n){if(!o(n)){var r=m(n,e.lastOrUndefined(k));if(r&&(t=t||[],!(k.length-1>t.length))){for(var a=r,i=k.length-2,s=t.length-1;i>=0;i-=1,s-=1){var c=k[i],_=t[s],u=m(_,c);if(!u)return;e.addRange(a,u)}return a}}}function d(t){return e.hasProperty(v,t)||(v[t]=g(t)),v[t]}function p(e,n,r){var a=c(e,n.textLowerCase);if(0===a)return n.text.length===e.length?t(x.exact,r,e===n.text):t(x.prefix,r,s(e,n.text));var o=n.isLowerCase;if(o){if(a>0)for(var _=d(e),u=0,l=_;u<l.length;u++){var p=l[u];if(y(e,p,n.text,!0))return t(x.substring,r,y(e,p,n.text,!1))}}else if(e.indexOf(n.text)>0)return t(x.substring,r,!0);if(!o&&n.characterSpans.length>0){var f=d(e),m=h(e,f,n,!1);if(void 0!==m)return t(x.camelCase,r,!0,m);if(m=h(e,f,n,!0),void 0!==m)return t(x.camelCase,r,!1,m)}return o&&n.text.length<e.length&&a>0&&i(e.charCodeAt(a))?t(x.substring,r,!1):void 0}function f(e){for(var t=0;t<e.length;t++){var n=e.charCodeAt(t);if(32===n||42===n)return!0}return!1}function m(e,t){if(!f(t.totalTextChunk.text)){var n=p(e,t.totalTextChunk,!1);if(n)return[n]}for(var r=t.subWordTextChunks,a=void 0,i=0,o=r;i<o.length;i++){var s=o[i],c=p(e,s,!0);if(!c)return;a=a||[],a.push(c)}return a}function y(e,t,n,r,a){var i=a?a.start:0,o=a?a.length:n.length;if(o>t.length)return!1;if(r)for(var s=0;o>s;s++){var c=n.charCodeAt(i+s),_=e.charCodeAt(t.start+s);if(u(c)!==u(_))return!1}else for(var s=0;o>s;s++){var c=n.charCodeAt(i+s),_=e.charCodeAt(t.start+s);if(c!==_)return!1}return!0}function h(t,n,r,a){for(var o=r.characterSpans,s=0,c=0,_=void 0,u=void 0;;){if(c===o.length){var l=0;return u&&(l+=1),0===_&&(l+=2),l}if(s===n.length)return;for(var d=n[s],p=!1;c<o.length;c++){var f=o[c];if(p&&(!i(r.text.charCodeAt(o[c-1].start))||!i(r.text.charCodeAt(o[c].start))))break;if(!y(t,d,r.text,a,f))break;p=!0,_=void 0===_?s:_,u=void 0===u?!0:u,d=e.createTextSpan(d.start+f.length,d.length-f.length)}p||void 0===u||(u=!1),s++}}var v={};n=n.trim();var k=n.split(".").map(function(e){return r(e.trim())}),b=0===k.length||e.forEach(k,a);return{getMatches:l,getMatchesForLastSegmentOfPattern:_,patternContainsDots:k.length>1}}function r(e){return{totalTextChunk:f(e),subWordTextChunks:p(e)}}function a(e){return 0===e.subWordTextChunks.length}function i(t){if(t>=65&&90>=t)return!0;if(127>t||!e.isUnicodeIdentifierStart(t,2))return!1;var n=String.fromCharCode(t);return n===n.toUpperCase()}function o(t){if(t>=97&&122>=t)return!0;if(127>t||!e.isUnicodeIdentifierStart(t,2))return!1;var n=String.fromCharCode(t);return n===n.toLowerCase()}function s(e,t){for(var n=0,r=t.length;r>n;n++)if(e.charCodeAt(n)!==t.charCodeAt(n))return!1;return!0}function c(e,t){for(var n=0,r=e.length-t.length;r>=n;n++)if(_(e,t,n))return n;return-1}function _(e,t,n){for(var r=0,a=t.length;a>r;r++){var i=u(e.charCodeAt(r+n)),o=t.charCodeAt(r);if(i!==o)return!1}return!0}function u(e){return e>=65&&90>=e?97+(e-65):127>e?e:String.fromCharCode(e).toLowerCase().charCodeAt(0)}function l(e){return e>=48&&57>=e}function d(e){return i(e)||o(e)||l(e)||95===e||36===e}function p(e){for(var t=[],n=0,r=0,a=0;a<e.length;a++){var i=e.charCodeAt(a);d(i)?(0===r&&(n=a),r++):r>0&&(t.push(f(e.substr(n,r))),r=0)}return r>0&&t.push(f(e.substr(n,r))),t}function f(e){var t=e.toLowerCase();return{text:e,textLowerCase:t,isLowerCase:e===t,characterSpans:m(e)}}function m(e){return y(e,!1)}function g(e){return y(e,!0)}function y(t,n){for(var r=[],a=0,i=1,o=t.length;o>i;i++){var s=l(t.charCodeAt(i-1)),c=l(t.charCodeAt(i)),_=b(t,n,i),u=k(t,n,i,a);(h(t.charCodeAt(i-1))||h(t.charCodeAt(i))||s!==c||_||u)&&(v(t,a,i)||r.push(e.createTextSpan(a,i-a)),a=i)}return v(t,a,t.length)||r.push(e.createTextSpan(a,t.length-a)),r}function h(e){switch(e){case 33:case 34:case 35:case 37:case 38:case 39:case 40:case 41:case 42:case 44:case 45:case 46:case 47:case 58:case 59:case 63:case 64:case 91:case 92:case 93:case 95:case 123:case 125:return!0}return!1}function v(e,t,n){for(var r=t;n>r;r++){var a=e.charCodeAt(r);if(!h(a)||95===a||36===a)return!1}return!0}function k(e,t,n,r){if(t&&n!==r&&n+1<e.length){var a=i(e.charCodeAt(n)),s=o(e.charCodeAt(n+1));if(a&&s){for(var c=r;n>c;c++)if(!i(e.charCodeAt(c)))return!1;return!0}}return!1}function b(e,t,n){var r=i(e.charCodeAt(n-1)),a=i(e.charCodeAt(n)),o=t?a&&!r:a;return o}!function(e){e[e.exact=0]="exact",e[e.prefix=1]="prefix",e[e.substring=2]="substring",e[e.camelCase=3]="camelCase"}(e.PatternMatchKind||(e.PatternMatchKind={}));var x=e.PatternMatchKind;e.createPatternMatcher=n,e.breakIntoCharacterSpans=m,e.breakIntoWordSpans=g}(ts||(ts={}));var ts;!function(e){var t;!function(t){function n(t,n,r,i){function o(n){if(171===n.invocation.kind){var r=n.invocation,a=r.expression,i=69===a.kind?a:169===a.kind?a.name:void 0;if(i&&i.text)for(var o=t.getTypeChecker(),s=0,c=t.getSourceFiles();s<c.length;s++){var _=c[s],u=_.getNamedDeclarations(),l=e.getProperty(u,i.text);if(l)for(var d=0,p=l;d<p.length;d++){var f=p[d],m=f.symbol;if(m){var g=o.getTypeOfSymbolAtLocation(m,f);if(g){var h=g.getCallSignatures();if(h&&h.length)return y(h,h[0],n)}}}}}}function s(t){if(171===t.parent.kind||172===t.parent.kind){var a=t.parent;if(25===t.kind||17===t.kind){var i=m(a,t,n),o=a.typeArguments&&a.typeArguments.pos===i.pos;return e.Debug.assert(void 0!==i),{kind:o?0:1,invocation:a,argumentsSpan:d(i),argumentIndex:0,argumentCount:_(i)}}var s=e.findListItemInfo(t);if(s){var i=s.list,o=a.typeArguments&&a.typeArguments.pos===i.pos,p=c(i,t),f=_(i);return e.Debug.assert(0===p||f>p,"argumentCount < argumentIndex, "+f+" < "+p),{kind:o?0:1,invocation:a,argumentsSpan:d(i),argumentIndex:p,argumentCount:f}}}else if(11===t.kind&&173===t.parent.kind){if(e.isInsideTemplateLiteral(t,r))return l(t.parent,0)}else{if(12===t.kind&&173===t.parent.parent.kind){var g=t.parent,y=g.parent;e.Debug.assert(186===g.kind);var p=e.isInsideTemplateLiteral(t,r)?0:1;return l(y,p)}if(193===t.parent.kind&&173===t.parent.parent.parent.kind){var h=t.parent,g=h.parent,y=g.parent;if(e.Debug.assert(186===g.kind),14===t.kind&&!e.isInsideTemplateLiteral(t,r))return;var v=g.templateSpans.indexOf(h),p=u(v,t);return l(y,p)}}}function c(e,t){for(var n=0,r=e.getChildren(),a=0,i=r;a<i.length;a++){var o=i[a];if(o===t)break;24!==o.kind&&n++}return n}function _(t){var n=t.getChildren(),r=e.countWhere(n,function(e){return 24!==e.kind});return n.length>0&&24===e.lastOrUndefined(n).kind&&r++,r}function u(t,n){return e.Debug.assert(r>=n.getStart(),"Assumed 'position' could not occur before node."),e.isTemplateLiteralKind(n.kind)?e.isInsideTemplateLiteral(n,r)?0:t+2:t+1}function l(t,n){var r=11===t.template.kind?1:t.template.templateSpans.length+1;return e.Debug.assert(0===n||r>n,"argumentCount < argumentIndex, "+r+" < "+n),{kind:2,invocation:t,argumentsSpan:p(t),argumentIndex:n,argumentCount:r}}function d(t){var r=t.getFullStart(),a=e.skipTrivia(n.text,t.getEnd(),!1);return e.createTextSpan(r,a-r)}function p(t){var r=t.template,a=r.getStart(),i=r.getEnd();if(186===r.kind){var o=e.lastOrUndefined(r.templateSpans);0===o.literal.getFullWidth()&&(i=e.skipTrivia(n.text,i,!1))}return e.createTextSpan(a,i-a)}function f(t){for(var n=t;251!==n.kind;n=n.parent){if(e.isFunctionBlock(n))return;(n.pos<n.parent.pos||n.end>n.parent.end)&&e.Debug.fail("Node of kind "+n.kind+" is not a subspan of its parent of kind "+n.parent.kind);var r=s(n);if(r)return r}}function m(t,n,r){var a=t.getChildren(r),i=a.indexOf(n);return e.Debug.assert(i>=0&&a.length>i+1),a[i+1]}function g(e,t){for(var n=-1,r=-1,a=0;a<e.length;a++){var i=e[a];if(i.hasRestParameter||i.parameters.length>=t)return a;i.parameters.length>r&&(r=i.parameters.length,n=a)}return n}function y(t,n,r){function i(t){var n=e.mapToDisplayParts(function(e){return h.getSymbolDisplayBuilder().buildParameterDisplay(t,e,_)});return{name:t.name,documentation:t.getDocumentationComment(),displayParts:n,isOptional:h.isOptionalParameter(t.valueDeclaration)}}function o(t){var n=e.mapToDisplayParts(function(e){return h.getSymbolDisplayBuilder().buildTypeParameterDisplay(t,e,_)});return{name:t.symbol.name,documentation:a,displayParts:n,isOptional:!1}}var s=r.argumentsSpan,c=0===r.kind,_=r.invocation,u=e.getInvokedExpression(_),l=h.getSymbolAtLocation(u),d=l&&e.symbolToDisplayParts(h,l,void 0,void 0),p=e.map(t,function(t){var n,r=[],s=[];if(d&&e.addRange(r,d),c){r.push(e.punctuationPart(25));var u=t.typeParameters;n=u&&u.length>0?e.map(u,o):a,s.push(e.punctuationPart(27));var l=e.mapToDisplayParts(function(e){return h.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(t.parameters,e,_)});e.addRange(s,l)}else{var p=e.mapToDisplayParts(function(e){return h.getSymbolDisplayBuilder().buildDisplayForTypeParametersAndDelimiters(t.typeParameters,e,_)});e.addRange(r,p),r.push(e.punctuationPart(17));var f=t.parameters;n=f.length>0?e.map(f,i):a,s.push(e.punctuationPart(18))}var m=e.mapToDisplayParts(function(e){return h.getSymbolDisplayBuilder().buildReturnTypeDisplay(t,e,_)});return e.addRange(s,m),{isVariadic:t.hasRestParameter,prefixDisplayParts:r,suffixDisplayParts:s,separatorDisplayParts:[e.punctuationPart(24),e.spacePart()],parameters:n,documentation:t.getDocumentationComment()}}),f=r.argumentIndex,m=r.argumentCount,y=t.indexOf(n);return 0>y&&(y=g(t,m)),e.Debug.assert(0===f||m>f,"argumentCount < argumentIndex, "+m+" < "+f),{items:p,applicableSpan:s,selectedItemIndex:y,argumentIndex:f,argumentCount:m}}var h=t.getTypeChecker(),v=e.findTokenOnLeftOfPosition(n,r);if(v){var k=f(v);if(i.throwIfCancellationRequested(),k){var b=k.invocation,x=[],C=h.getResolvedSignature(b,x);if(i.throwIfCancellationRequested(),x.length)return y(x,C,k);if(e.isSourceFileJavaScript(n))return o(k)}}}var r,a=[];!function(e){e[e.TypeArguments=0]="TypeArguments",e[e.CallArguments=1]="CallArguments",e[e.TaggedTemplateArguments=2]="TaggedTemplateArguments"}(r||(r={})),t.getSignatureHelpItems=n}(t=e.SignatureHelp||(e.SignatureHelp={}))}(ts||(ts={}));var ts;!function(e){function t(t,n){e.Debug.assert(t>=0);var r=n.getLineStarts(),a=t;if(a+1===r.length)return n.text.length-1;var i=r[a],o=r[a+1]-1;for(e.Debug.assert(e.isLineBreak(n.text.charCodeAt(o)));o>=i&&e.isLineBreak(n.text.charCodeAt(o));)o--;return o}function n(e,t){var n=t.getLineStarts(),r=t.getLineAndCharacterOfPosition(e).line;return n[r]}function r(e,t){return a(e.pos,e.end,t)}function a(e,t,n){return e<=n.pos&&t>=n.end}function i(e,t,n){return e.pos<=t&&e.end>=n}function o(e,t,n){return s(e.pos,e.end,t,n)}function s(e,t,n,r){var a=Math.max(e,n),i=Math.min(t,r);return i>a}function c(e,t,n){return e.end>t||!_(e,n)}function _(t,n){if(e.nodeIsMissing(t))return!1;switch(t.kind){case 217:case 218:case 220:case 168:case 164:case 156:case 195:case 222:case 223:return u(t,16,n);case 247:return _(t.block,n);case 172:if(!t.arguments)return!0;case 171:case 175:case 161:return u(t,18,n);case 153:case 154:return _(t.type,n);case 145:case 146:case 147:case 216:case 176:case 144:case 143:case 149:case 148:case 177:return t.body?_(t.body,n):t.type?_(t.type,n):d(t,18,n);case 221:return t.body&&_(t.body,n);case 199:return t.elseStatement?_(t.elseStatement,n):_(t.thenStatement,n);case 198:return _(t.expression,n)||d(t,23);case 167:case 165:case 170:case 137:case 158:return u(t,20,n);case 150:return t.type?_(t.type,n):d(t,20,n);case 244:case 245:return!1;case 202:case 203:case 204:case 201:return _(t.statement,n);case 200:var r=p(t,104,n);return r?u(t,18,n):_(t.statement,n);case 155:return _(t.exprName,n);case 179:case 178:case 180:case 187:case 188:var a=t;return _(a.expression,n);case 173:return _(t.template,n);case 186:var i=e.lastOrUndefined(t.templateSpans);return _(i,n);case 193:return e.nodeIsPresent(t.literal);case 182:return _(t.operand,n);case 184:return _(t.right,n);case 185:return _(t.whenFalse,n);default:return!0}}function u(t,n,r){var a=t.getChildren(r);if(a.length){var i=e.lastOrUndefined(a);if(i.kind===n)return!0;if(23===i.kind&&1!==a.length)return a[a.length-2].kind===n}return!1}function l(t){var n=f(t);if(n){var r=n.getChildren(),a=e.indexOf(r,t);return{listItemIndex:a,list:n}}}function d(e,t,n){return!!p(e,t,n)}function p(t,n,r){return e.forEach(t.getChildren(r),function(e){return e.kind===n&&e})}function f(t){var n=e.forEach(t.parent.getChildren(),function(e){return 274===e.kind&&e.pos<=t.pos&&e.end>=t.end?e:void 0});return e.Debug.assert(!n||e.contains(n.getChildren(),t)),n}function m(e,t){return y(e,t,function(e){return O(e.kind)})}function g(e,t){return y(e,t,function(e){return R(e.kind)})}function y(e,t,n){return v(e,t,!1,n)}function h(e,t){return v(e,t,!0,void 0)}function v(e,t,n,r){var a=e;e:for(;;){if(N(a))return a;for(var i=0,o=a.getChildCount(e);o>i;i++){var s=a.getChildAt(i),c=n?s.getFullStart():s.getStart(e);if(t>=c){var _=s.getEnd();if(_>t||t===_&&1===s.kind){a=s;continue e}if(r&&_===t){var u=x(t,e,s);if(u&&r(u))return u}}}return a}}function k(e,t){var n=h(e,t);return N(n)&&t>n.getStart(e)&&t<n.getEnd()?n:x(t,e)}function b(e,t){function n(t){if(N(t)&&t.pos===e.end)return t;for(var r=t.getChildren(),a=0,i=r;a<i.length;a++){var o=i[a],s=o.pos<=e.pos&&o.end>e.end||o.pos===e.end;if(s&&w(o))return n(o)}}return n(t)}function x(t,n,r){function a(e){if(N(e)||239===e.kind)return e;var t=e.getChildren(),n=o(t,t.length);return n&&a(n)}function i(s){if(N(s)||239===s.kind)return s;for(var c=s.getChildren(),_=0,u=c.length;u>_;_++){var l=c[_];if(t<l.end&&(w(l)||239===l.kind)){var d=l.getStart(n),p=d>=t||239===l.kind&&d===l.end;if(p){var f=o(c,_);return f&&a(f)}return i(l)}}if(e.Debug.assert(void 0!==r||251===s.kind),c.length){var f=o(c,c.length);return f&&a(f)}}function o(e,t){for(var n=t-1;n>=0;--n)if(w(e[n]))return e[n]}return i(r||n)}function C(e,t){var n=h(e,t);return n&&(9===n.kind||163===n.kind)&&t>n.getStart()}function D(e,t){return S(e,t,void 0)}function S(t,n,r){var a=h(t,n);if(a&&n<=a.getStart()){var i=e.getLeadingCommentRanges(t.text,a.pos);return r?e.forEach(i,function(e){return e.pos<n&&(2==e.kind?n<=e.end:n<e.end)&&r(e)}):e.forEach(i,function(e){return e.pos<n&&(2==e.kind?n<=e.end:n<e.end)})}return!1}function T(t,n){function r(e){var n=t.text;return n.length>=e.pos+3&&"/"===n[e.pos]&&"*"===n[e.pos+1]&&"*"===n[e.pos+2]}var a=h(t,n),i=e.getLeadingCommentRanges(t.text,a.pos);return e.forEach(i,r)}function E(t,n){var r=e.getTokenAtPosition(t,n);if(N(r))switch(r.kind){case 102:case 108:case 74:r=void 0===r.parent?void 0:r.parent.parent;break;default:r=r.parent}if(r){var a=r.jsDocComment;if(a)for(var i=0,o=a.tags;i<o.length;i++){var s=o[i];if(s.pos<=n&&n<=s.end)return s}}}function w(e){return 0!==e.getWidth()}function A(t){var n=e.getCombinedNodeFlags(t),r=[];return 16&n&&r.push(e.ScriptElementKindModifier.privateMemberModifier),32&n&&r.push(e.ScriptElementKindModifier.protectedMemberModifier),8&n&&r.push(e.ScriptElementKindModifier.publicMemberModifier),64&n&&r.push(e.ScriptElementKindModifier.staticModifier),128&n&&r.push(e.ScriptElementKindModifier.abstractModifier),2&n&&r.push(e.ScriptElementKindModifier.exportedModifier),e.isInAmbientContext(t)&&r.push(e.ScriptElementKindModifier.ambientModifier),r.length>0?r.join(","):e.ScriptElementKindModifier.none}function P(t){return 152===t.kind||171===t.kind?t.typeArguments:e.isFunctionLike(t)||217===t.kind||218===t.kind?t.typeParameters:void 0}function N(e){return e.kind>=0&&e.kind<=135}function O(t){return 69===t||e.isKeyword(t)}function R(e){return 9===e||8===e||O(e)}function I(e){return 2===e||3===e}function F(t){
return!(9!==t&&163!==t&&10!==t&&!e.isTemplateLiteralKind(t))}function L(e){return e>=15&&68>=e}function M(t,n){return e.isTemplateLiteralKind(t.kind)&&t.getStart()<n&&n<t.getEnd()||!!t.isUnterminated&&n===t.getEnd()}function B(e){switch(e){case 112:case 110:case 111:return!0}return!1}function z(e,t){for(var n in e)if("object"==typeof e[n]){if(!z(e[n],t[n]))return!1}else if("function"!=typeof e[n]&&e[n]!==t[n])return!1;return!0}function K(e){if(167===e.kind||168===e.kind){if(184===e.parent.kind&&e.parent.left===e&&56===e.parent.operatorToken.kind)return!0;if(204===e.parent.kind&&e.parent.initializer===e)return!0;if(K(248===e.parent.kind?e.parent.parent:e.parent))return!0}return!1}e.getEndLinePosition=t,e.getLineStartPositionForPosition=n,e.rangeContainsRange=r,e.startEndContainsRange=a,e.rangeContainsStartEnd=i,e.rangeOverlapsWithStartEnd=o,e.startEndOverlapsWithStartEnd=s,e.positionBelongsToNode=c,e.isCompletedNode=_,e.findListItemInfo=l,e.hasChildOfKind=d,e.findChildOfKind=p,e.findContainingList=f,e.getTouchingWord=m,e.getTouchingPropertyName=g,e.getTouchingToken=y,e.getTokenAtPosition=h,e.findTokenOnLeftOfPosition=k,e.findNextToken=b,e.findPrecedingToken=x,e.isInString=C,e.isInComment=D,e.isInCommentHelper=S,e.hasDocComment=T,e.getJsDocTagAtPosition=E,e.getNodeModifiers=A,e.getTypeArgumentOrTypeParameterList=P,e.isToken=N,e.isWord=O,e.isComment=I,e.isStringOrRegularExpressionOrTemplateLiteral=F,e.isPunctuation=L,e.isInsideTemplateLiteral=M,e.isAccessibilityModifier=B,e.compareDataObjects=z,e.isArrayLiteralOrObjectLiteralDestructuringPattern=K}(ts||(ts={}));var ts;!function(e){function t(e){return e.declarations&&e.declarations.length>0&&139===e.declarations[0].kind}function n(){function t(){if(_){var t=e.getIndentString(u);t&&c.push(a(t,e.SymbolDisplayPartKind.space)),_=!1}}function n(e,n){t(),c.push(a(e,n))}function i(e,n){t(),c.push(r(e,n))}function o(){c.push(d()),_=!0}function s(){c=[],_=!0,u=0}var c,_,u;return s(),{displayParts:function(){return c},writeKeyword:function(t){return n(t,e.SymbolDisplayPartKind.keyword)},writeOperator:function(t){return n(t,e.SymbolDisplayPartKind.operator)},writePunctuation:function(t){return n(t,e.SymbolDisplayPartKind.punctuation)},writeSpace:function(t){return n(t,e.SymbolDisplayPartKind.space)},writeStringLiteral:function(t){return n(t,e.SymbolDisplayPartKind.stringLiteral)},writeParameter:function(t){return n(t,e.SymbolDisplayPartKind.parameterName)},writeSymbol:i,writeLine:o,increaseIndent:function(){u++},decreaseIndent:function(){u--},clear:s,trackSymbol:function(){},reportInaccessibleThisError:function(){}}}function r(n,r){function i(n){var r=n.flags;return 3&r?t(n)?e.SymbolDisplayPartKind.parameterName:e.SymbolDisplayPartKind.localName:4&r?e.SymbolDisplayPartKind.propertyName:32768&r?e.SymbolDisplayPartKind.propertyName:65536&r?e.SymbolDisplayPartKind.propertyName:8&r?e.SymbolDisplayPartKind.enumMemberName:16&r?e.SymbolDisplayPartKind.functionName:32&r?e.SymbolDisplayPartKind.className:64&r?e.SymbolDisplayPartKind.interfaceName:384&r?e.SymbolDisplayPartKind.enumName:1536&r?e.SymbolDisplayPartKind.moduleName:8192&r?e.SymbolDisplayPartKind.methodName:262144&r?e.SymbolDisplayPartKind.typeParameterName:524288&r?e.SymbolDisplayPartKind.aliasName:8388608&r?e.SymbolDisplayPartKind.aliasName:e.SymbolDisplayPartKind.text}return a(n,i(r),r)}function a(t,n,r){return{text:t,kind:e.SymbolDisplayPartKind[n]}}function i(){return a(" ",e.SymbolDisplayPartKind.space)}function o(t){return a(e.tokenToString(t),e.SymbolDisplayPartKind.keyword)}function s(t){return a(e.tokenToString(t),e.SymbolDisplayPartKind.punctuation)}function c(t){return a(e.tokenToString(t),e.SymbolDisplayPartKind.operator)}function _(t){var n=e.stringToToken(t);return void 0===n?u(t):o(n)}function u(t){return a(t,e.SymbolDisplayPartKind.text)}function l(e){return e.getNewLine?e.getNewLine():C}function d(){return a("\n",e.SymbolDisplayPartKind.lineBreak)}function p(e){e(x);var t=x.displayParts();return x.clear(),t}function f(e,t,n,r){return p(function(a){e.getSymbolDisplayBuilder().buildTypeDisplay(t,a,n,r)})}function m(e,t,n,r,a){return p(function(i){e.getSymbolDisplayBuilder().buildSymbolDisplay(t,i,n,r,a)})}function g(e,t,n,r){return p(function(a){e.getSymbolDisplayBuilder().buildSignatureDisplay(t,a,n,r)})}function y(t,n,r){if(h(r))return r.getText();var a=e.getLocalSymbolForExportDefault(n),i=t.symbolToString(a||n);return i}function h(e){return e.parent&&(229===e.parent.kind||233===e.parent.kind)&&e.parent.propertyName===e}function v(e){var t=e.length;return t>=2&&e.charCodeAt(0)===e.charCodeAt(t-1)&&(34===e.charCodeAt(0)||39===e.charCodeAt(0))?e.substring(1,t-1):e}function k(t,n){for(var r=[],a=2;a<arguments.length;a++)r[a-2]=arguments[a];var i=b(t,n);return e.forEach(r,function(e){return e===i})}function b(t,n){var r=e.getScriptKindFromFileName(t);return 0===r&&n&&n.getScriptKind&&(r=n.getScriptKind(t)),e.ensureScriptKind(t,r)}e.isFirstDeclarationOfSymbolParameter=t;var x=n();e.symbolPart=r,e.displayPart=a,e.spacePart=i,e.keywordPart=o,e.punctuationPart=s,e.operatorPart=c,e.textOrKeywordPart=_,e.textPart=u;var C="\r\n";e.getNewLineOrDefaultFromHost=l,e.lineBreakPart=d,e.mapToDisplayParts=p,e.typeToDisplayParts=f,e.symbolToDisplayParts=m,e.signatureToDisplayParts=g,e.getDeclaredName=y,e.isImportOrExportSpecifierName=h,e.stripQuotes=v,e.scriptKindIs=k,e.getScriptKind=b}(ts||(ts={}));var ts;!function(e){var t;!function(t){function n(t,n,a,i,o,s,c){function _(t){if(t)for(var n=0,r=t;n<r.length;n++){var a=r[n];e.hasProperty(p,a)||(p[a]=void 0)}}function u(n,r){var a=e.readConfigFile(n,function(e){return t.readFile(e)});if(a.config){var i=a.config;r.push(n),i.dependencies&&_(e.getKeys(i.dependencies)),i.devDependencies&&_(e.getKeys(i.devDependencies)),i.optionalDependencies&&_(e.getKeys(i.optionalDependencies)),i.peerDependencies&&_(e.getKeys(i.peerDependencies))}}function l(t){var n=e.filter(t,e.hasJavaScriptFileExtension),a=e.map(n,function(t){return e.removeFileExtension(e.getBaseFileName(t.toLowerCase()))}),i=e.map(a,function(e){return e.replace(/((?:\.|-)min(?=\.|$))|((?:-|\.)\d+)/g,"")});_(void 0===r?i:e.filter(i,function(t){return e.hasProperty(r,t)}));var o=e.forEach(t,function(t){return e.scriptKindIs(t,void 0,2)});o&&_(["react"])}function d(n){if(t.directoryExists(n)){for(var r=[],a=t.readDirectory(n,"*.json",void 0,2),i=0,o=a;i<o.length;i++){var s=o[i],c=e.normalizePath(s);if("package.json"===e.getBaseFileName(c)){var u=e.readConfigFile(c,function(e){return t.readFile(e)});if(u.config){var l=u.config;if((!l._requiredBy||0!==e.filter(l._requiredBy,function(e){return"#"===e[0]||"/"===e}).length)&&l.name)if(l.typings){var d=e.getNormalizedAbsolutePath(l.typings,e.getDirectoryPath(c));p[l.name]=d}else r.push(l.name)}}}_(r)}}var p={};if(!s||!s.enableAutoDiscovery)return{cachedTypingPaths:[],newTypingNames:[],filesToWatch:[]};if(n=e.filter(e.map(n,e.normalizePath),function(t){return e.scriptKindIs(t,void 0,1,2)}),!r){var f=e.readConfigFile(i,function(e){return t.readFile(e)});r=f.config?f.config:{}}var m=[],g=[],y=[];_(s.include),y=s.exclude||[];var h=e.map(n,e.getDirectoryPath);void 0!==a&&h.push(a),g=e.deduplicate(h);for(var v=0,k=g;v<k.length;v++){var b=k[v],x=e.combinePaths(b,"package.json");u(x,m);var C=e.combinePaths(b,"bower.json");u(C,m);var D=e.combinePaths(b,"node_modules");d(D)}l(n);for(var S in o)e.hasProperty(p,S)&&!p[S]&&(p[S]=o[S]);for(var T=0,E=y;T<E.length;T++){var w=E[T];delete p[w]}var A=[],P=[];for(var N in p)void 0!==p[N]?P.push(p[N]):A.push(N);return{cachedTypingPaths:P,newTypingNames:A,filesToWatch:m}}var r;t.discoverTypings=n}(t=e.JsTyping||(e.JsTyping={}))}(ts||(ts={}));var ts;!function(e){var t;!function(t){function n(t,n,a){function s(){e.Debug.assert(void 0!==r),k=void 0;var t=r.getStartPos()!==n;t&&(y?(e.Debug.assert(0!==y.length),b=4===e.lastOrUndefined(y).kind):b=!1),g=void 0,y=void 0,t||r.scan();for(var i=r.getStartPos();a>i;){var o=r.getToken();if(!e.isTrivia(o))break;r.scan();var s={pos:i,end:r.getStartPos(),kind:o};i=r.getStartPos(),g||(g=[]),g.push(s)}h=r.getStartPos()}function c(e){if(e)switch(e.kind){case 29:case 64:case 65:case 45:case 44:return!0}return!1}function _(e){if(e.parent)switch(e.parent.kind){case 241:case 238:case 240:case 237:return 69===e.kind}return!1}function u(e){return 10===e.kind}function l(e){return 13===e.kind||14===e.kind}function d(e){return 39===e||61===e}function p(t){if(e.Debug.assert(void 0!==r),!f())return{leadingTrivia:g,trailingTrivia:void 0,token:void 0};var n=c(t)?1:u(t)?2:l(t)?3:_(t)?4:0;if(k&&n===v)return m(k,t);r.getStartPos()!==h&&(e.Debug.assert(void 0!==k),r.setTextPos(h),r.scan());var i=r.getToken();1===n&&27===i?(i=r.reScanGreaterToken(),e.Debug.assert(t.kind===i),v=1):2===n&&d(i)?(i=r.reScanSlashToken(),e.Debug.assert(t.kind===i),v=2):3===n&&16===i?(i=r.reScanTemplateToken(),v=3):4===n&&69===i?(i=r.scanJsxIdentifier(),v=4):v=0;var o={pos:r.getStartPos(),end:r.getTextPos(),kind:i};for(y&&(y=void 0);r.getStartPos()<a&&(i=r.scan(),e.isTrivia(i));){var s={pos:r.getStartPos(),end:r.getTextPos(),kind:i};if(y||(y=[]),y.push(s),4===i){r.scan();break}}return k={leadingTrivia:g,trailingTrivia:y,token:o},m(k,t)}function f(){e.Debug.assert(void 0!==r);var t=k&&k.token.kind||r.getToken(),n=k&&k.token.pos||r.getStartPos();return a>n&&1!==t&&!e.isTrivia(t)}function m(t,n){return e.isToken(n)&&t.token.kind!==n.kind&&(t.token.kind=n.kind),t}e.Debug.assert(void 0===r),r=1===t.languageVariant?o:i,r.setText(t.text),r.setTextPos(n);var g,y,h,v,k,b=!0;return{advance:s,readTokenInfo:p,isOnToken:f,getCurrentLeadingTrivia:function(){return g},lastTrailingTriviaWasNewLine:function(){return b},close:function(){e.Debug.assert(void 0!==r),k=void 0,r.setText(void 0),r=void 0}}}var r,a,i=e.createScanner(2,!1,0),o=e.createScanner(2,!1,1);!function(e){e[e.Scan=0]="Scan",e[e.RescanGreaterThanToken=1]="RescanGreaterThanToken",e[e.RescanSlashToken=2]="RescanSlashToken",e[e.RescanTemplateToken=3]="RescanTemplateToken",e[e.RescanJsxIdentifier=4]="RescanJsxIdentifier"}(a||(a={})),t.getFormattingScanner=n}(t=e.formatting||(e.formatting={}))}(ts||(ts={}));var ts;!function(e){var t;!function(t){var n=function(){function t(e,t){this.sourceFile=e,this.formattingRequestKind=t}return t.prototype.updateContext=function(t,n,r,a,i){e.Debug.assert(void 0!==t,"currentTokenSpan is null"),e.Debug.assert(void 0!==n,"currentTokenParent is null"),e.Debug.assert(void 0!==r,"nextTokenSpan is null"),e.Debug.assert(void 0!==a,"nextTokenParent is null"),e.Debug.assert(void 0!==i,"commonParent is null"),this.currentTokenSpan=t,this.currentTokenParent=n,this.nextTokenSpan=r,this.nextTokenParent=a,this.contextNode=i,this.contextNodeAllOnSameLine=void 0,this.nextNodeAllOnSameLine=void 0,this.tokensAreOnSameLine=void 0,this.contextNodeBlockIsOnOneLine=void 0,this.nextNodeBlockIsOnOneLine=void 0},t.prototype.ContextNodeAllOnSameLine=function(){return void 0===this.contextNodeAllOnSameLine&&(this.contextNodeAllOnSameLine=this.NodeIsOnOneLine(this.contextNode)),this.contextNodeAllOnSameLine},t.prototype.NextNodeAllOnSameLine=function(){return void 0===this.nextNodeAllOnSameLine&&(this.nextNodeAllOnSameLine=this.NodeIsOnOneLine(this.nextTokenParent)),this.nextNodeAllOnSameLine},t.prototype.TokensAreOnSameLine=function(){if(void 0===this.tokensAreOnSameLine){var e=this.sourceFile.getLineAndCharacterOfPosition(this.currentTokenSpan.pos).line,t=this.sourceFile.getLineAndCharacterOfPosition(this.nextTokenSpan.pos).line;this.tokensAreOnSameLine=e===t}return this.tokensAreOnSameLine},t.prototype.ContextNodeBlockIsOnOneLine=function(){return void 0===this.contextNodeBlockIsOnOneLine&&(this.contextNodeBlockIsOnOneLine=this.BlockIsOnOneLine(this.contextNode)),this.contextNodeBlockIsOnOneLine},t.prototype.NextNodeBlockIsOnOneLine=function(){return void 0===this.nextNodeBlockIsOnOneLine&&(this.nextNodeBlockIsOnOneLine=this.BlockIsOnOneLine(this.nextTokenParent)),this.nextNodeBlockIsOnOneLine},t.prototype.NodeIsOnOneLine=function(e){var t=this.sourceFile.getLineAndCharacterOfPosition(e.getStart(this.sourceFile)).line,n=this.sourceFile.getLineAndCharacterOfPosition(e.getEnd()).line;return t===n},t.prototype.BlockIsOnOneLine=function(t){var n=e.findChildOfKind(t,15,this.sourceFile),r=e.findChildOfKind(t,16,this.sourceFile);if(n&&r){var a=this.sourceFile.getLineAndCharacterOfPosition(n.getEnd()).line,i=this.sourceFile.getLineAndCharacterOfPosition(r.getStart(this.sourceFile)).line;return a===i}return!1},t}();t.FormattingContext=n}(t=e.formatting||(e.formatting={}))}(ts||(ts={}));var ts;!function(e){var t;!function(e){!function(e){e[e.FormatDocument=0]="FormatDocument",e[e.FormatSelection=1]="FormatSelection",e[e.FormatOnEnter=2]="FormatOnEnter",e[e.FormatOnSemicolon=3]="FormatOnSemicolon",e[e.FormatOnClosingCurlyBrace=4]="FormatOnClosingCurlyBrace"}(e.FormattingRequestKind||(e.FormattingRequestKind={}));e.FormattingRequestKind}(t=e.formatting||(e.formatting={}))}(ts||(ts={}));var ts;!function(e){var t;!function(e){var t=function(){function e(e,t,n){void 0===n&&(n=0),this.Descriptor=e,this.Operation=t,this.Flag=n}return e.prototype.toString=function(){return"[desc="+this.Descriptor+",operation="+this.Operation+",flag="+this.Flag+"]"},e}();e.Rule=t}(t=e.formatting||(e.formatting={}))}(ts||(ts={}));var ts;!function(e){var t;!function(e){!function(e){e[e.Ignore=1]="Ignore",e[e.Space=2]="Space",e[e.NewLine=4]="NewLine",e[e.Delete=8]="Delete"}(e.RuleAction||(e.RuleAction={}));e.RuleAction}(t=e.formatting||(e.formatting={}))}(ts||(ts={}));var ts;!function(e){var t;!function(e){var t=function(){function t(e,t){this.LeftTokenRange=e,this.RightTokenRange=t}return t.prototype.toString=function(){return"[leftRange="+this.LeftTokenRange+",rightRange="+this.RightTokenRange+"]"},t.create1=function(n,r){return t.create4(e.Shared.TokenRange.FromToken(n),e.Shared.TokenRange.FromToken(r))},t.create2=function(n,r){return t.create4(n,e.Shared.TokenRange.FromToken(r))},t.create3=function(n,r){return t.create4(e.Shared.TokenRange.FromToken(n),r)},t.create4=function(e,n){return new t(e,n)},t}();e.RuleDescriptor=t}(t=e.formatting||(e.formatting={}))}(ts||(ts={}));var ts;!function(e){var t;!function(e){!function(e){e[e.None=0]="None",e[e.CanDeleteNewLines=1]="CanDeleteNewLines"}(e.RuleFlags||(e.RuleFlags={}));e.RuleFlags}(t=e.formatting||(e.formatting={}))}(ts||(ts={}));var ts;!function(e){var t;!function(e){var t=function(){function t(){this.Context=null,this.Action=null}return t.prototype.toString=function(){return"[context="+this.Context+",action="+this.Action+"]"},t.create1=function(n){return t.create2(e.RuleOperationContext.Any,n)},t.create2=function(e,n){var r=new t;return r.Context=e,r.Action=n,r},t}();e.RuleOperation=t}(t=e.formatting||(e.formatting={}))}(ts||(ts={}));var ts;!function(e){var t;!function(e){var t=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t-0]=arguments[t];this.customContextChecks=e}return e.prototype.IsAny=function(){return this===e.Any},e.prototype.InContext=function(e){if(this.IsAny())return!0;for(var t=0,n=this.customContextChecks;t<n.length;t++){var r=n[t];if(!r(e))return!1}return!0},e.Any=new e,e}();e.RuleOperationContext=t}(t=e.formatting||(e.formatting={}))}(ts||(ts={}));var ts;!function(e){var t;!function(t){var n=function(){function n(){this.IgnoreBeforeComment=new t.Rule(t.RuleDescriptor.create4(t.Shared.TokenRange.Any,t.Shared.TokenRange.Comments),t.RuleOperation.create1(1)),this.IgnoreAfterLineComment=new t.Rule(t.RuleDescriptor.create3(2,t.Shared.TokenRange.Any),t.RuleOperation.create1(1)),this.NoSpaceBeforeSemicolon=new t.Rule(t.RuleDescriptor.create2(t.Shared.TokenRange.Any,23),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),8)),this.NoSpaceBeforeColon=new t.Rule(t.RuleDescriptor.create2(t.Shared.TokenRange.Any,54),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsNotBinaryOpContext),8)),this.NoSpaceBeforeQuestionMark=new t.Rule(t.RuleDescriptor.create2(t.Shared.TokenRange.Any,53),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsNotBinaryOpContext),8)),this.SpaceAfterColon=new t.Rule(t.RuleDescriptor.create3(54,t.Shared.TokenRange.Any),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsNotBinaryOpContext),2)),this.SpaceAfterQuestionMarkInConditionalOperator=new t.Rule(t.RuleDescriptor.create3(53,t.Shared.TokenRange.Any),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsConditionalOperatorContext),2)),this.NoSpaceAfterQuestionMark=new t.Rule(t.RuleDescriptor.create3(53,t.Shared.TokenRange.Any),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),8)),this.SpaceAfterSemicolon=new t.Rule(t.RuleDescriptor.create3(23,t.Shared.TokenRange.Any),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),2)),this.SpaceAfterCloseBrace=new t.Rule(t.RuleDescriptor.create3(16,t.Shared.TokenRange.Any),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsAfterCodeBlockContext),2)),this.SpaceBetweenCloseBraceAndElse=new t.Rule(t.RuleDescriptor.create1(16,80),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),2)),this.SpaceBetweenCloseBraceAndWhile=new t.Rule(t.RuleDescriptor.create1(16,104),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),2)),this.NoSpaceAfterCloseBrace=new t.Rule(t.RuleDescriptor.create3(16,t.Shared.TokenRange.FromTokens([18,20,24,23])),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),8)),this.NoSpaceBeforeDot=new t.Rule(t.RuleDescriptor.create2(t.Shared.TokenRange.Any,21),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),8)),this.NoSpaceAfterDot=new t.Rule(t.RuleDescriptor.create3(21,t.Shared.TokenRange.Any),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),8)),this.NoSpaceBeforeOpenBracket=new t.Rule(t.RuleDescriptor.create2(t.Shared.TokenRange.Any,19),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),8)),this.NoSpaceAfterCloseBracket=new t.Rule(t.RuleDescriptor.create3(20,t.Shared.TokenRange.Any),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsNotBeforeBlockInFunctionDeclarationContext),8)),this.FunctionOpenBraceLeftTokenRange=t.Shared.TokenRange.AnyIncludingMultilineComments,this.SpaceBeforeOpenBraceInFunction=new t.Rule(t.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange,15),t.RuleOperation.create2(new t.RuleOperationContext(n.IsFunctionDeclContext,n.IsBeforeBlockContext,n.IsNotFormatOnEnter,n.IsSameLineTokenOrBeforeMultilineBlockContext),2),1),this.TypeScriptOpenBraceLeftTokenRange=t.Shared.TokenRange.FromTokens([69,3,73]),this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock=new t.Rule(t.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange,15),t.RuleOperation.create2(new t.RuleOperationContext(n.IsTypeScriptDeclWithBlockContext,n.IsNotFormatOnEnter,n.IsSameLineTokenOrBeforeMultilineBlockContext),2),1),this.ControlOpenBraceLeftTokenRange=t.Shared.TokenRange.FromTokens([18,3,79,100,85,80]),this.SpaceBeforeOpenBraceInControl=new t.Rule(t.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange,15),t.RuleOperation.create2(new t.RuleOperationContext(n.IsControlDeclContext,n.IsNotFormatOnEnter,n.IsSameLineTokenOrBeforeMultilineBlockContext),2),1),this.SpaceAfterOpenBrace=new t.Rule(t.RuleDescriptor.create3(15,t.Shared.TokenRange.Any),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSingleLineBlockContext),2)),this.SpaceBeforeCloseBrace=new t.Rule(t.RuleDescriptor.create2(t.Shared.TokenRange.Any,16),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSingleLineBlockContext),2)),this.NoSpaceBetweenEmptyBraceBrackets=new t.Rule(t.RuleDescriptor.create1(15,16),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsObjectContext),8)),this.NewLineAfterOpenBraceInBlockContext=new t.Rule(t.RuleDescriptor.create3(15,t.Shared.TokenRange.Any),t.RuleOperation.create2(new t.RuleOperationContext(n.IsMultilineBlockContext),4)),this.NewLineBeforeCloseBraceInBlockContext=new t.Rule(t.RuleDescriptor.create2(t.Shared.TokenRange.AnyIncludingMultilineComments,16),t.RuleOperation.create2(new t.RuleOperationContext(n.IsMultilineBlockContext),4)),this.NoSpaceAfterUnaryPrefixOperator=new t.Rule(t.RuleDescriptor.create4(t.Shared.TokenRange.UnaryPrefixOperators,t.Shared.TokenRange.UnaryPrefixExpressions),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsNotBinaryOpContext),8)),this.NoSpaceAfterUnaryPreincrementOperator=new t.Rule(t.RuleDescriptor.create3(41,t.Shared.TokenRange.UnaryPreincrementExpressions),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),8)),this.NoSpaceAfterUnaryPredecrementOperator=new t.Rule(t.RuleDescriptor.create3(42,t.Shared.TokenRange.UnaryPredecrementExpressions),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),8)),this.NoSpaceBeforeUnaryPostincrementOperator=new t.Rule(t.RuleDescriptor.create2(t.Shared.TokenRange.UnaryPostincrementExpressions,41),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),8)),this.NoSpaceBeforeUnaryPostdecrementOperator=new t.Rule(t.RuleDescriptor.create2(t.Shared.TokenRange.UnaryPostdecrementExpressions,42),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),8)),this.SpaceAfterPostincrementWhenFollowedByAdd=new t.Rule(t.RuleDescriptor.create1(41,35),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsBinaryOpContext),2)),this.SpaceAfterAddWhenFollowedByUnaryPlus=new t.Rule(t.RuleDescriptor.create1(35,35),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsBinaryOpContext),2)),this.SpaceAfterAddWhenFollowedByPreincrement=new t.Rule(t.RuleDescriptor.create1(35,41),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsBinaryOpContext),2)),this.SpaceAfterPostdecrementWhenFollowedBySubtract=new t.Rule(t.RuleDescriptor.create1(42,36),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsBinaryOpContext),2)),this.SpaceAfterSubtractWhenFollowedByUnaryMinus=new t.Rule(t.RuleDescriptor.create1(36,36),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsBinaryOpContext),2)),this.SpaceAfterSubtractWhenFollowedByPredecrement=new t.Rule(t.RuleDescriptor.create1(36,42),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsBinaryOpContext),2)),this.NoSpaceBeforeComma=new t.Rule(t.RuleDescriptor.create2(t.Shared.TokenRange.Any,24),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),8)),this.SpaceAfterCertainKeywords=new t.Rule(t.RuleDescriptor.create4(t.Shared.TokenRange.FromTokens([102,98,92,78,94,101,119]),t.Shared.TokenRange.Any),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),2)),this.SpaceAfterLetConstInVariableDeclaration=new t.Rule(t.RuleDescriptor.create4(t.Shared.TokenRange.FromTokens([108,74]),t.Shared.TokenRange.Any),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsStartOfVariableDeclarationList),2)),this.NoSpaceBeforeOpenParenInFuncCall=new t.Rule(t.RuleDescriptor.create2(t.Shared.TokenRange.Any,17),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsFunctionCallOrNewContext,n.IsPreviousTokenNotComma),8)),this.SpaceAfterFunctionInFuncDecl=new t.Rule(t.RuleDescriptor.create3(87,t.Shared.TokenRange.Any),t.RuleOperation.create2(new t.RuleOperationContext(n.IsFunctionDeclContext),2)),this.NoSpaceBeforeOpenParenInFuncDecl=new t.Rule(t.RuleDescriptor.create2(t.Shared.TokenRange.Any,17),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsFunctionDeclContext),8)),this.SpaceAfterVoidOperator=new t.Rule(t.RuleDescriptor.create3(103,t.Shared.TokenRange.Any),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsVoidOpContext),2)),this.NoSpaceBetweenReturnAndSemicolon=new t.Rule(t.RuleDescriptor.create1(94,23),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),8)),this.SpaceBetweenStatements=new t.Rule(t.RuleDescriptor.create4(t.Shared.TokenRange.FromTokens([18,79,80,71]),t.Shared.TokenRange.Any),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsNotForContext),2)),this.SpaceAfterTryFinally=new t.Rule(t.RuleDescriptor.create2(t.Shared.TokenRange.FromTokens([100,85]),15),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),2)),this.SpaceAfterGetSetInMember=new t.Rule(t.RuleDescriptor.create2(t.Shared.TokenRange.FromTokens([123,129]),69),t.RuleOperation.create2(new t.RuleOperationContext(n.IsFunctionDeclContext),2)),this.SpaceBeforeBinaryKeywordOperator=new t.Rule(t.RuleDescriptor.create4(t.Shared.TokenRange.Any,t.Shared.TokenRange.BinaryKeywordOperators),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsBinaryOpContext),2)),this.SpaceAfterBinaryKeywordOperator=new t.Rule(t.RuleDescriptor.create4(t.Shared.TokenRange.BinaryKeywordOperators,t.Shared.TokenRange.Any),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsBinaryOpContext),2)),this.NoSpaceAfterConstructor=new t.Rule(t.RuleDescriptor.create1(121,17),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),8)),this.NoSpaceAfterModuleImport=new t.Rule(t.RuleDescriptor.create2(t.Shared.TokenRange.FromTokens([125,127]),17),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),8)),this.SpaceAfterCertainTypeScriptKeywords=new t.Rule(t.RuleDescriptor.create4(t.Shared.TokenRange.FromTokens([115,73,122,77,81,82,83,123,106,89,107,125,126,110,112,111,129,113,132]),t.Shared.TokenRange.Any),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),2)),this.SpaceBeforeCertainTypeScriptKeywords=new t.Rule(t.RuleDescriptor.create4(t.Shared.TokenRange.Any,t.Shared.TokenRange.FromTokens([83,106])),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),2)),this.SpaceAfterModuleName=new t.Rule(t.RuleDescriptor.create1(9,15),t.RuleOperation.create2(new t.RuleOperationContext(n.IsModuleDeclContext),2)),this.SpaceBeforeArrow=new t.Rule(t.RuleDescriptor.create2(t.Shared.TokenRange.Any,34),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),2)),this.SpaceAfterArrow=new t.Rule(t.RuleDescriptor.create3(34,t.Shared.TokenRange.Any),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),2)),this.NoSpaceAfterEllipsis=new t.Rule(t.RuleDescriptor.create1(22,69),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),8)),this.NoSpaceAfterOptionalParameters=new t.Rule(t.RuleDescriptor.create3(53,t.Shared.TokenRange.FromTokens([18,24])),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsNotBinaryOpContext),8)),this.NoSpaceBeforeOpenAngularBracket=new t.Rule(t.RuleDescriptor.create2(t.Shared.TokenRange.TypeNames,25),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsTypeArgumentOrParameterOrAssertionContext),8)),this.NoSpaceBetweenCloseParenAndAngularBracket=new t.Rule(t.RuleDescriptor.create1(18,25),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsTypeArgumentOrParameterOrAssertionContext),8)),this.NoSpaceAfterOpenAngularBracket=new t.Rule(t.RuleDescriptor.create3(25,t.Shared.TokenRange.Any),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsTypeArgumentOrParameterOrAssertionContext),8)),this.NoSpaceBeforeCloseAngularBracket=new t.Rule(t.RuleDescriptor.create2(t.Shared.TokenRange.Any,27),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsTypeArgumentOrParameterOrAssertionContext),8)),this.NoSpaceAfterCloseAngularBracket=new t.Rule(t.RuleDescriptor.create3(27,t.Shared.TokenRange.FromTokens([17,19,27,24])),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsTypeArgumentOrParameterOrAssertionContext),8)),this.NoSpaceAfterTypeAssertion=new t.Rule(t.RuleDescriptor.create3(27,t.Shared.TokenRange.Any),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsTypeAssertionContext),8)),this.NoSpaceBetweenEmptyInterfaceBraceBrackets=new t.Rule(t.RuleDescriptor.create1(15,16),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsObjectTypeContext),8)),this.SpaceBeforeAt=new t.Rule(t.RuleDescriptor.create2(t.Shared.TokenRange.Any,55),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),2)),this.NoSpaceAfterAt=new t.Rule(t.RuleDescriptor.create3(55,t.Shared.TokenRange.Any),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),8)),this.SpaceAfterDecorator=new t.Rule(t.RuleDescriptor.create4(t.Shared.TokenRange.Any,t.Shared.TokenRange.FromTokens([115,69,82,77,73,113,112,110,111,123,129,19,37])),t.RuleOperation.create2(new t.RuleOperationContext(n.IsEndOfDecoratorContextOnSameLine),2)),this.NoSpaceBetweenFunctionKeywordAndStar=new t.Rule(t.RuleDescriptor.create1(87,37),t.RuleOperation.create2(new t.RuleOperationContext(n.IsFunctionDeclarationOrFunctionExpressionContext),8)),this.SpaceAfterStarInGeneratorDeclaration=new t.Rule(t.RuleDescriptor.create3(37,t.Shared.TokenRange.FromTokens([69,17])),t.RuleOperation.create2(new t.RuleOperationContext(n.IsFunctionDeclarationOrFunctionExpressionContext),2)),this.NoSpaceBetweenYieldKeywordAndStar=new t.Rule(t.RuleDescriptor.create1(114,37),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsYieldOrYieldStarWithOperand),8)),this.SpaceBetweenYieldOrYieldStarAndOperand=new t.Rule(t.RuleDescriptor.create4(t.Shared.TokenRange.FromTokens([114,37]),t.Shared.TokenRange.Any),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsYieldOrYieldStarWithOperand),2)),this.SpaceBetweenAsyncAndOpenParen=new t.Rule(t.RuleDescriptor.create1(118,17),t.RuleOperation.create2(new t.RuleOperationContext(n.IsArrowFunctionContext,n.IsSameLineTokenContext),2)),this.SpaceBetweenAsyncAndFunctionKeyword=new t.Rule(t.RuleDescriptor.create1(118,87),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),2)),this.NoSpaceBetweenTagAndTemplateString=new t.Rule(t.RuleDescriptor.create3(69,t.Shared.TokenRange.FromTokens([11,12])),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),8)),this.HighPriorityCommonRules=[this.IgnoreBeforeComment,this.IgnoreAfterLineComment,this.NoSpaceBeforeColon,this.SpaceAfterColon,this.NoSpaceBeforeQuestionMark,this.SpaceAfterQuestionMarkInConditionalOperator,this.NoSpaceAfterQuestionMark,this.NoSpaceBeforeDot,this.NoSpaceAfterDot,this.NoSpaceAfterUnaryPrefixOperator,this.NoSpaceAfterUnaryPreincrementOperator,this.NoSpaceAfterUnaryPredecrementOperator,this.NoSpaceBeforeUnaryPostincrementOperator,this.NoSpaceBeforeUnaryPostdecrementOperator,this.SpaceAfterPostincrementWhenFollowedByAdd,this.SpaceAfterAddWhenFollowedByUnaryPlus,this.SpaceAfterAddWhenFollowedByPreincrement,this.SpaceAfterPostdecrementWhenFollowedBySubtract,this.SpaceAfterSubtractWhenFollowedByUnaryMinus,this.SpaceAfterSubtractWhenFollowedByPredecrement,this.NoSpaceAfterCloseBrace,this.SpaceAfterOpenBrace,this.SpaceBeforeCloseBrace,this.NewLineBeforeCloseBraceInBlockContext,this.SpaceAfterCloseBrace,this.SpaceBetweenCloseBraceAndElse,this.SpaceBetweenCloseBraceAndWhile,this.NoSpaceBetweenEmptyBraceBrackets,this.NoSpaceBetweenFunctionKeywordAndStar,this.SpaceAfterStarInGeneratorDeclaration,this.SpaceAfterFunctionInFuncDecl,this.NewLineAfterOpenBraceInBlockContext,this.SpaceAfterGetSetInMember,this.NoSpaceBetweenYieldKeywordAndStar,this.SpaceBetweenYieldOrYieldStarAndOperand,this.NoSpaceBetweenReturnAndSemicolon,this.SpaceAfterCertainKeywords,this.SpaceAfterLetConstInVariableDeclaration,this.NoSpaceBeforeOpenParenInFuncCall,this.SpaceBeforeBinaryKeywordOperator,this.SpaceAfterBinaryKeywordOperator,this.SpaceAfterVoidOperator,this.SpaceBetweenAsyncAndOpenParen,this.SpaceBetweenAsyncAndFunctionKeyword,this.NoSpaceBetweenTagAndTemplateString,this.NoSpaceAfterConstructor,this.NoSpaceAfterModuleImport,this.SpaceAfterCertainTypeScriptKeywords,this.SpaceBeforeCertainTypeScriptKeywords,this.SpaceAfterModuleName,this.SpaceBeforeArrow,this.SpaceAfterArrow,this.NoSpaceAfterEllipsis,this.NoSpaceAfterOptionalParameters,this.NoSpaceBetweenEmptyInterfaceBraceBrackets,this.NoSpaceBeforeOpenAngularBracket,this.NoSpaceBetweenCloseParenAndAngularBracket,this.NoSpaceAfterOpenAngularBracket,this.NoSpaceBeforeCloseAngularBracket,this.NoSpaceAfterCloseAngularBracket,this.NoSpaceAfterTypeAssertion,this.SpaceBeforeAt,this.NoSpaceAfterAt,this.SpaceAfterDecorator],
this.LowPriorityCommonRules=[this.NoSpaceBeforeSemicolon,this.SpaceBeforeOpenBraceInControl,this.SpaceBeforeOpenBraceInFunction,this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock,this.NoSpaceBeforeComma,this.NoSpaceBeforeOpenBracket,this.NoSpaceAfterCloseBracket,this.SpaceAfterSemicolon,this.NoSpaceBeforeOpenParenInFuncDecl,this.SpaceBetweenStatements,this.SpaceAfterTryFinally],this.SpaceAfterComma=new t.Rule(t.RuleDescriptor.create3(24,t.Shared.TokenRange.Any),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsNextTokenNotCloseBracket),2)),this.NoSpaceAfterComma=new t.Rule(t.RuleDescriptor.create3(24,t.Shared.TokenRange.Any),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),8)),this.SpaceBeforeBinaryOperator=new t.Rule(t.RuleDescriptor.create4(t.Shared.TokenRange.Any,t.Shared.TokenRange.BinaryOperators),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsBinaryOpContext),2)),this.SpaceAfterBinaryOperator=new t.Rule(t.RuleDescriptor.create4(t.Shared.TokenRange.BinaryOperators,t.Shared.TokenRange.Any),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsBinaryOpContext),2)),this.NoSpaceBeforeBinaryOperator=new t.Rule(t.RuleDescriptor.create4(t.Shared.TokenRange.Any,t.Shared.TokenRange.BinaryOperators),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsBinaryOpContext),8)),this.NoSpaceAfterBinaryOperator=new t.Rule(t.RuleDescriptor.create4(t.Shared.TokenRange.BinaryOperators,t.Shared.TokenRange.Any),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsBinaryOpContext),8)),this.SpaceAfterKeywordInControl=new t.Rule(t.RuleDescriptor.create2(t.Shared.TokenRange.Keywords,17),t.RuleOperation.create2(new t.RuleOperationContext(n.IsControlDeclContext),2)),this.NoSpaceAfterKeywordInControl=new t.Rule(t.RuleDescriptor.create2(t.Shared.TokenRange.Keywords,17),t.RuleOperation.create2(new t.RuleOperationContext(n.IsControlDeclContext),8)),this.NewLineBeforeOpenBraceInFunction=new t.Rule(t.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange,15),t.RuleOperation.create2(new t.RuleOperationContext(n.IsFunctionDeclContext,n.IsBeforeMultilineBlockContext),4),1),this.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock=new t.Rule(t.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange,15),t.RuleOperation.create2(new t.RuleOperationContext(n.IsTypeScriptDeclWithBlockContext,n.IsBeforeMultilineBlockContext),4),1),this.NewLineBeforeOpenBraceInControl=new t.Rule(t.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange,15),t.RuleOperation.create2(new t.RuleOperationContext(n.IsControlDeclContext,n.IsBeforeMultilineBlockContext),4),1),this.SpaceAfterSemicolonInFor=new t.Rule(t.RuleDescriptor.create3(23,t.Shared.TokenRange.Any),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsForContext),2)),this.NoSpaceAfterSemicolonInFor=new t.Rule(t.RuleDescriptor.create3(23,t.Shared.TokenRange.Any),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext,n.IsForContext),8)),this.SpaceAfterOpenParen=new t.Rule(t.RuleDescriptor.create3(17,t.Shared.TokenRange.Any),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),2)),this.SpaceBeforeCloseParen=new t.Rule(t.RuleDescriptor.create2(t.Shared.TokenRange.Any,18),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),2)),this.NoSpaceBetweenParens=new t.Rule(t.RuleDescriptor.create1(17,18),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),8)),this.NoSpaceAfterOpenParen=new t.Rule(t.RuleDescriptor.create3(17,t.Shared.TokenRange.Any),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),8)),this.NoSpaceBeforeCloseParen=new t.Rule(t.RuleDescriptor.create2(t.Shared.TokenRange.Any,18),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),8)),this.SpaceAfterOpenBracket=new t.Rule(t.RuleDescriptor.create3(19,t.Shared.TokenRange.Any),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),2)),this.SpaceBeforeCloseBracket=new t.Rule(t.RuleDescriptor.create2(t.Shared.TokenRange.Any,20),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),2)),this.NoSpaceBetweenBrackets=new t.Rule(t.RuleDescriptor.create1(19,20),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),8)),this.NoSpaceAfterOpenBracket=new t.Rule(t.RuleDescriptor.create3(19,t.Shared.TokenRange.Any),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),8)),this.NoSpaceBeforeCloseBracket=new t.Rule(t.RuleDescriptor.create2(t.Shared.TokenRange.Any,20),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),8)),this.NoSpaceAfterTemplateHeadAndMiddle=new t.Rule(t.RuleDescriptor.create4(t.Shared.TokenRange.FromTokens([12,13]),t.Shared.TokenRange.Any),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),8)),this.SpaceAfterTemplateHeadAndMiddle=new t.Rule(t.RuleDescriptor.create4(t.Shared.TokenRange.FromTokens([12,13]),t.Shared.TokenRange.Any),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),2)),this.NoSpaceBeforeTemplateMiddleAndTail=new t.Rule(t.RuleDescriptor.create4(t.Shared.TokenRange.Any,t.Shared.TokenRange.FromTokens([13,14])),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),8)),this.SpaceBeforeTemplateMiddleAndTail=new t.Rule(t.RuleDescriptor.create4(t.Shared.TokenRange.Any,t.Shared.TokenRange.FromTokens([13,14])),t.RuleOperation.create2(new t.RuleOperationContext(n.IsSameLineTokenContext),2)),this.SpaceAfterAnonymousFunctionKeyword=new t.Rule(t.RuleDescriptor.create1(87,17),t.RuleOperation.create2(new t.RuleOperationContext(n.IsFunctionDeclContext),2)),this.NoSpaceAfterAnonymousFunctionKeyword=new t.Rule(t.RuleDescriptor.create1(87,17),t.RuleOperation.create2(new t.RuleOperationContext(n.IsFunctionDeclContext),8))}return n.prototype.getRuleName=function(e){var t=this;for(var n in t)if(t[n]===e)return n;throw new Error("Unknown rule")},n.IsForContext=function(e){return 202===e.contextNode.kind},n.IsNotForContext=function(e){return!n.IsForContext(e)},n.IsBinaryOpContext=function(e){switch(e.contextNode.kind){case 184:case 185:case 192:case 151:case 159:case 160:return!0;case 166:case 219:case 224:case 214:case 139:case 250:case 142:case 141:return 56===e.currentTokenSpan.kind||56===e.nextTokenSpan.kind;case 203:return 90===e.currentTokenSpan.kind||90===e.nextTokenSpan.kind;case 204:return 135===e.currentTokenSpan.kind||135===e.nextTokenSpan.kind}return!1},n.IsNotBinaryOpContext=function(e){return!n.IsBinaryOpContext(e)},n.IsConditionalOperatorContext=function(e){return 185===e.contextNode.kind},n.IsSameLineTokenOrBeforeMultilineBlockContext=function(e){return e.TokensAreOnSameLine()||n.IsBeforeMultilineBlockContext(e)},n.IsBeforeMultilineBlockContext=function(e){return n.IsBeforeBlockContext(e)&&!(e.NextNodeAllOnSameLine()||e.NextNodeBlockIsOnOneLine())},n.IsMultilineBlockContext=function(e){return n.IsBlockContext(e)&&!(e.ContextNodeAllOnSameLine()||e.ContextNodeBlockIsOnOneLine())},n.IsSingleLineBlockContext=function(e){return n.IsBlockContext(e)&&(e.ContextNodeAllOnSameLine()||e.ContextNodeBlockIsOnOneLine())},n.IsBlockContext=function(e){return n.NodeIsBlockContext(e.contextNode)},n.IsBeforeBlockContext=function(e){return n.NodeIsBlockContext(e.nextTokenParent)},n.NodeIsBlockContext=function(e){if(n.NodeIsTypeScriptDeclWithBlockContext(e))return!0;switch(e.kind){case 195:case 223:case 168:case 222:return!0}return!1},n.IsFunctionDeclContext=function(e){switch(e.contextNode.kind){case 216:case 144:case 143:case 146:case 147:case 148:case 176:case 145:case 177:case 218:return!0}return!1},n.IsFunctionDeclarationOrFunctionExpressionContext=function(e){return 216===e.contextNode.kind||176===e.contextNode.kind},n.IsTypeScriptDeclWithBlockContext=function(e){return n.NodeIsTypeScriptDeclWithBlockContext(e.contextNode)},n.NodeIsTypeScriptDeclWithBlockContext=function(e){switch(e.kind){case 217:case 189:case 218:case 220:case 156:case 221:return!0}return!1},n.IsAfterCodeBlockContext=function(e){switch(e.currentTokenParent.kind){case 217:case 221:case 220:case 195:case 247:case 222:case 209:return!0}return!1},n.IsControlDeclContext=function(e){switch(e.contextNode.kind){case 199:case 209:case 202:case 203:case 204:case 201:case 212:case 200:case 208:case 247:return!0;default:return!1}},n.IsObjectContext=function(e){return 168===e.contextNode.kind},n.IsFunctionCallContext=function(e){return 171===e.contextNode.kind},n.IsNewContext=function(e){return 172===e.contextNode.kind},n.IsFunctionCallOrNewContext=function(e){return n.IsFunctionCallContext(e)||n.IsNewContext(e)},n.IsPreviousTokenNotComma=function(e){return 24!==e.currentTokenSpan.kind},n.IsNextTokenNotCloseBracket=function(e){return 20!==e.nextTokenSpan.kind},n.IsArrowFunctionContext=function(e){return 177===e.contextNode.kind},n.IsSameLineTokenContext=function(e){return e.TokensAreOnSameLine()},n.IsNotBeforeBlockInFunctionDeclarationContext=function(e){return!n.IsFunctionDeclContext(e)&&!n.IsBeforeBlockContext(e)},n.IsEndOfDecoratorContextOnSameLine=function(e){return e.TokensAreOnSameLine()&&e.contextNode.decorators&&n.NodeIsInDecoratorContext(e.currentTokenParent)&&!n.NodeIsInDecoratorContext(e.nextTokenParent)},n.NodeIsInDecoratorContext=function(t){for(;e.isExpression(t);)t=t.parent;return 140===t.kind},n.IsStartOfVariableDeclarationList=function(e){return 215===e.currentTokenParent.kind&&e.currentTokenParent.getStart(e.sourceFile)===e.currentTokenSpan.pos},n.IsNotFormatOnEnter=function(e){return 2!==e.formattingRequestKind},n.IsModuleDeclContext=function(e){return 221===e.contextNode.kind},n.IsObjectTypeContext=function(e){return 156===e.contextNode.kind},n.IsTypeArgumentOrParameterOrAssertion=function(e,t){if(25!==e.kind&&27!==e.kind)return!1;switch(t.kind){case 152:case 174:case 217:case 189:case 218:case 216:case 176:case 177:case 144:case 143:case 148:case 149:case 171:case 172:case 191:return!0;default:return!1}},n.IsTypeArgumentOrParameterOrAssertionContext=function(e){return n.IsTypeArgumentOrParameterOrAssertion(e.currentTokenSpan,e.currentTokenParent)||n.IsTypeArgumentOrParameterOrAssertion(e.nextTokenSpan,e.nextTokenParent)},n.IsTypeAssertionContext=function(e){return 174===e.contextNode.kind},n.IsVoidOpContext=function(e){return 103===e.currentTokenSpan.kind&&180===e.currentTokenParent.kind},n.IsYieldOrYieldStarWithOperand=function(e){return 187===e.contextNode.kind&&void 0!==e.contextNode.expression},n}();t.Rules=n}(t=e.formatting||(e.formatting={}))}(ts||(ts={}));var ts;!function(e){var t;!function(t){var n=function(){function e(){this.map=[],this.mapRowLength=0}return e.create=function(t){var n=new e;return n.Initialize(t),n},e.prototype.Initialize=function(e){this.mapRowLength=136,this.map=new Array(this.mapRowLength*this.mapRowLength);var t=new Array(this.map.length);return this.FillRules(e,t),this.map},e.prototype.FillRules=function(e,t){var n=this;e.forEach(function(e){n.FillRule(e,t)})},e.prototype.GetRuleBucketIndex=function(e,t){var n=e*this.mapRowLength+t;return n},e.prototype.FillRule=function(e,n){var r=this,a=e.Descriptor.LeftTokenRange!==t.Shared.TokenRange.Any&&e.Descriptor.RightTokenRange!==t.Shared.TokenRange.Any;e.Descriptor.LeftTokenRange.GetTokens().forEach(function(t){e.Descriptor.RightTokenRange.GetTokens().forEach(function(i){var o=r.GetRuleBucketIndex(t,i),c=r.map[o];void 0===c&&(c=r.map[o]=new s),c.AddRule(e,a,n,o)})})},e.prototype.GetRule=function(e){var t=this.GetRuleBucketIndex(e.currentTokenSpan.kind,e.nextTokenSpan.kind),n=this.map[t];if(null!=n)for(var r=0,a=n.Rules();r<a.length;r++){var i=a[r];if(i.Operation.Context.InContext(e))return i}return null},e}();t.RulesMap=n;var r=5,a=31;!function(e){e[e.IgnoreRulesSpecific=0]="IgnoreRulesSpecific",e[e.IgnoreRulesAny=1*r]="IgnoreRulesAny",e[e.ContextRulesSpecific=2*r]="ContextRulesSpecific",e[e.ContextRulesAny=3*r]="ContextRulesAny",e[e.NoContextRulesSpecific=4*r]="NoContextRulesSpecific",e[e.NoContextRulesAny=5*r]="NoContextRulesAny"}(t.RulesPosition||(t.RulesPosition={}));var i=t.RulesPosition,o=function(){function t(){this.rulesInsertionIndexBitmap=0}return t.prototype.GetInsertionIndex=function(e){for(var t=0,n=0,i=this.rulesInsertionIndexBitmap;e>=n;)t+=i&a,i>>=r,n+=r;return t},t.prototype.IncreaseInsertionIndex=function(t){var n=this.rulesInsertionIndexBitmap>>t&a;n++,e.Debug.assert((n&a)===n,"Adding more rules into the sub-bucket than allowed. Maximum allowed is 32 rules.");var r=this.rulesInsertionIndexBitmap&~(a<<t);r|=n<<t,this.rulesInsertionIndexBitmap=r},t}();t.RulesBucketConstructionState=o;var s=function(){function e(){this.rules=[]}return e.prototype.Rules=function(){return this.rules},e.prototype.AddRule=function(e,t,n,r){var a;a=1===e.Operation.Action?t?i.IgnoreRulesSpecific:i.IgnoreRulesAny:e.Operation.Context.IsAny()?t?i.NoContextRulesSpecific:i.NoContextRulesAny:t?i.ContextRulesSpecific:i.ContextRulesAny;var s=n[r];void 0===s&&(s=n[r]=new o);var c=s.GetInsertionIndex(a);this.rules.splice(c,0,e),s.IncreaseInsertionIndex(a)},e}();t.RulesBucket=s}(t=e.formatting||(e.formatting={}))}(ts||(ts={}));var ts;!function(e){var t;!function(t){var n;!function(t){var n=function(){function t(t,n,r){this.tokens=[];for(var a=t;n>=a;a++)e.indexOf(r,a)<0&&this.tokens.push(a)}return t.prototype.GetTokens=function(){return this.tokens},t.prototype.Contains=function(e){return this.tokens.indexOf(e)>=0},t}();t.TokenRangeAccess=n;var r=function(){function e(e){this.tokens=e&&e.length?e:[]}return e.prototype.GetTokens=function(){return this.tokens},e.prototype.Contains=function(e){return this.tokens.indexOf(e)>=0},e}();t.TokenValuesAccess=r;var a=function(){function e(e){this.token=e}return e.prototype.GetTokens=function(){return[this.token]},e.prototype.Contains=function(e){return e===this.token},e}();t.TokenSingleValueAccess=a;var i=function(){function e(){}return e.prototype.GetTokens=function(){for(var e=[],t=0;135>=t;t++)e.push(t);return e},e.prototype.Contains=function(e){return!0},e.prototype.toString=function(){return"[allTokens]"},e}();t.TokenAllAccess=i;var o=function(){function e(e){this.tokenAccess=e}return e.FromToken=function(t){return new e(new a(t))},e.FromTokens=function(t){return new e(new r(t))},e.FromRange=function(t,r,a){return void 0===a&&(a=[]),new e(new n(t,r,a))},e.AllTokens=function(){return new e(new i)},e.prototype.GetTokens=function(){return this.tokenAccess.GetTokens()},e.prototype.Contains=function(e){return this.tokenAccess.Contains(e)},e.prototype.toString=function(){return this.tokenAccess.toString()},e.Any=e.AllTokens(),e.AnyIncludingMultilineComments=e.FromTokens(e.Any.GetTokens().concat([3])),e.Keywords=e.FromRange(70,135),e.BinaryOperators=e.FromRange(25,68),e.BinaryKeywordOperators=e.FromTokens([90,91,135,116,124]),e.UnaryPrefixOperators=e.FromTokens([41,42,50,49]),e.UnaryPrefixExpressions=e.FromTokens([8,69,17,19,15,97,92]),e.UnaryPreincrementExpressions=e.FromTokens([69,17,97,92]),e.UnaryPostincrementExpressions=e.FromTokens([69,18,20,92]),e.UnaryPredecrementExpressions=e.FromTokens([69,17,97,92]),e.UnaryPostdecrementExpressions=e.FromTokens([69,18,20,92]),e.Comments=e.FromTokens([2,3]),e.TypeNames=e.FromTokens([69,128,130,120,131,103,117]),e}();t.TokenRange=o}(n=t.Shared||(t.Shared={}))}(t=e.formatting||(e.formatting={}))}(ts||(ts={}));var ts;!function(e){var t;!function(t){var n=function(){function n(){this.globalRules=new t.Rules}return n.prototype.getRuleName=function(e){return this.globalRules.getRuleName(e)},n.prototype.getRuleByName=function(e){return this.globalRules[e]},n.prototype.getRulesMap=function(){return this.rulesMap},n.prototype.ensureUpToDate=function(n){if(null==this.options||!e.compareDataObjects(this.options,n)){var r=this.createActiveRules(n),a=t.RulesMap.create(r);this.activeRules=r,this.rulesMap=a,this.options=e.clone(n)}},n.prototype.createActiveRules=function(e){var t=this.globalRules.HighPriorityCommonRules.slice(0);return e.InsertSpaceAfterCommaDelimiter?t.push(this.globalRules.SpaceAfterComma):t.push(this.globalRules.NoSpaceAfterComma),e.InsertSpaceAfterFunctionKeywordForAnonymousFunctions?t.push(this.globalRules.SpaceAfterAnonymousFunctionKeyword):t.push(this.globalRules.NoSpaceAfterAnonymousFunctionKeyword),e.InsertSpaceAfterKeywordsInControlFlowStatements?t.push(this.globalRules.SpaceAfterKeywordInControl):t.push(this.globalRules.NoSpaceAfterKeywordInControl),e.InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?(t.push(this.globalRules.SpaceAfterOpenParen),t.push(this.globalRules.SpaceBeforeCloseParen),t.push(this.globalRules.NoSpaceBetweenParens)):(t.push(this.globalRules.NoSpaceAfterOpenParen),t.push(this.globalRules.NoSpaceBeforeCloseParen),t.push(this.globalRules.NoSpaceBetweenParens)),e.InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?(t.push(this.globalRules.SpaceAfterOpenBracket),t.push(this.globalRules.SpaceBeforeCloseBracket),t.push(this.globalRules.NoSpaceBetweenBrackets)):(t.push(this.globalRules.NoSpaceAfterOpenBracket),t.push(this.globalRules.NoSpaceBeforeCloseBracket),t.push(this.globalRules.NoSpaceBetweenBrackets)),e.InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?(t.push(this.globalRules.SpaceAfterTemplateHeadAndMiddle),t.push(this.globalRules.SpaceBeforeTemplateMiddleAndTail)):(t.push(this.globalRules.NoSpaceAfterTemplateHeadAndMiddle),t.push(this.globalRules.NoSpaceBeforeTemplateMiddleAndTail)),e.InsertSpaceAfterSemicolonInForStatements?t.push(this.globalRules.SpaceAfterSemicolonInFor):t.push(this.globalRules.NoSpaceAfterSemicolonInFor),e.InsertSpaceBeforeAndAfterBinaryOperators?(t.push(this.globalRules.SpaceBeforeBinaryOperator),t.push(this.globalRules.SpaceAfterBinaryOperator)):(t.push(this.globalRules.NoSpaceBeforeBinaryOperator),t.push(this.globalRules.NoSpaceAfterBinaryOperator)),e.PlaceOpenBraceOnNewLineForControlBlocks&&t.push(this.globalRules.NewLineBeforeOpenBraceInControl),e.PlaceOpenBraceOnNewLineForFunctions&&(t.push(this.globalRules.NewLineBeforeOpenBraceInFunction),t.push(this.globalRules.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock)),t=t.concat(this.globalRules.LowPriorityCommonRules)},n}();t.RulesProvider=n}(t=e.formatting||(e.formatting={}))}(ts||(ts={}));var ts;!function(e){var t;!function(t){function n(t,n,r,a){var i=n.getLineAndCharacterOfPosition(t).line;if(0===i)return[];for(var o=e.getEndLinePosition(i,n);e.isWhiteSpace(n.text.charCodeAt(o))&&!e.isLineBreak(n.text.charCodeAt(o));)o--;var s={pos:e.getStartPositionOfLine(i-1,n),end:o+1};return f(s,n,a,r,2)}function r(e,t,n,r){return s(e,23,t,r,n,3)}function a(e,t,n,r){return s(e,16,t,r,n,4)}function i(e,t,n){var r={pos:0,end:e.text.length};return f(r,e,n,t,0)}function o(t,n,r,a,i){var o={pos:e.getLineStartPositionForPosition(t,r),end:n};return f(o,r,i,a,1)}function s(t,n,r,a,i,o){var s=c(t,n,r);if(!s)return[];var _={pos:e.getLineStartPositionForPosition(s.getStart(r),r),end:s.end};return f(_,r,a,i,o)}function c(t,n,r){var a=e.findPrecedingToken(t,r);if(a&&a.kind===n&&t===a.getEnd()){for(var i=a;i&&i.parent&&i.parent.end===a.end&&!_(i.parent,i);)i=i.parent;return i}}function _(t,n){switch(t.kind){case 217:case 218:return e.rangeContainsRange(t.members,n);case 221:var r=t.body;return r&&195===r.kind&&e.rangeContainsRange(r.statements,n);case 251:case 195:case 222:return e.rangeContainsRange(t.statements,n);case 247:return e.rangeContainsRange(t.block.statements,n)}return!1}function u(t,n){function r(a){var i=e.forEachChild(a,function(r){return e.startEndContainsRange(r.getStart(n),r.end,t)&&r});if(i){var o=r(i);if(o)return o}return a}return r(n)}function l(t,n){function r(e){return!1}if(!t.length)return r;var a=t.filter(function(t){return e.rangeOverlapsWithStartEnd(n,t.start,t.start+t.length)}).sort(function(e,t){return e.start-t.start});if(!a.length)return r;var i=0;return function(t){for(;;){if(i>=a.length)return!1;var n=a[i];if(t.end<=n.start)return!1;if(e.startEndOverlapsWithStartEnd(t.pos,t.end,n.start,n.start+n.length))return!0;i++}}}function d(t,n,r){var a=t.getStart(r);if(a===n.pos&&t.end===n.end)return a;var i=e.findPrecedingToken(n.pos,r);return i?i.end>=n.pos?t.pos:i.end:t.pos}function p(e,n,r){for(var a,i=-1;e;){var o=r.getLineAndCharacterOfPosition(e.getStart(r)).line;if(-1!==i&&o!==i)break;if(t.SmartIndenter.shouldIndentChildNode(e,a))return n.IndentSize;i=o,a=e,e=e.parent}return 0}function f(n,r,a,i,o){function s(n,i,o,s,c){if(e.rangeOverlapsWithStartEnd(s,n,i)||e.rangeContainsStartEnd(s,n,i)){if(-1!==c)return c}else{var _=r.getLineAndCharacterOfPosition(n).line,u=e.getLineStartPositionForPosition(n,r),l=t.SmartIndenter.findFirstNonWhitespaceColumn(u,n,r,a);if(_!==o||n===l)return l}return-1}function c(e,n,i,o,s,c){var _=i,u=t.SmartIndenter.shouldIndentChildNode(e)?a.IndentSize:0;return c===n?(_=n===F?L:s.getIndentation(),u=Math.min(a.IndentSize,s.getDelta(e)+u)):-1===_&&(_=t.SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement(o,e,n,r)?s.getIndentation():s.getIndentation()+s.getDelta(e)),{indentation:_,delta:u}}function _(e){if(e.modifiers&&e.modifiers.length)return e.modifiers[0].kind;switch(e.kind){case 217:return 73;case 218:return 107;case 216:return 87;case 220:return 220;case 146:return 123;case 147:return 129;case 144:if(e.asteriskToken)return 37;case 142:case 139:return e.name.kind}}function f(e,n,r,i){function o(n,r){return t.SmartIndenter.nodeWillIndentChild(e,r,!0)?n:0}return{getIndentationForComment:function(e,t,n){switch(e){case 16:case 20:case 18:return r+o(i,n)}return-1!==t?t:r},getIndentationForToken:function(t,a,s){if(n!==t&&e.decorators&&a===_(e))return r;switch(a){case 15:case 16:case 19:case 20:case 17:case 18:case 80:case 104:case 55:return r;default:return n!==t?r+o(i,s):r}},getIndentation:function(){return r},getDelta:function(e){return o(i,e)},recomputeIndentation:function(n){e.parent&&t.SmartIndenter.shouldIndentChildNode(e.parent,e)&&(n?r+=a.IndentSize:r-=a.IndentSize,i=t.SmartIndenter.shouldIndentChildNode(e)?a.IndentSize:0)}}}function h(t,a,i,o,_,u){function l(a,i,o,_,u,l,d){var f=a.getStart(r),m=r.getLineAndCharacterOfPosition(f).line,g=m;a.decorators&&(g=r.getLineAndCharacterOfPosition(e.getNonDecoratorTokenPosOfNode(a,r)).line);var y=-1;if(d&&(y=s(f,a.end,u,n,i),-1!==y&&(i=y)),!e.rangeOverlapsWithStartEnd(n,a.pos,a.end))return i;if(0===a.getFullWidth())return i;for(;K.isOnToken();){var v=K.readTokenInfo(t);if(v.token.end>f)break;p(v,t,_)}if(!K.isOnToken())return i;if(e.isToken(a)){var v=K.readTokenInfo(a);return e.Debug.assert(v.token.end===a.end),p(v,t,_,a),i}var k=140===a.kind?m:l,x=c(a,m,y,t,_,k);return h(a,b,m,g,x.indentation,x.delta),b=t,i}function d(n,a,i,o){var s=m(a,n),_=g(s),u=o,d=i;if(0!==s)for(;K.isOnToken();){var y=K.readTokenInfo(a);if(y.token.end>n.pos)break;if(y.token.kind===s){d=r.getLineAndCharacterOfPosition(y.token.pos).line;var h=c(y.token,d,-1,a,o,i);u=f(a,i,h.indentation,h.delta),p(y,a,u)}else p(y,a,o)}for(var v=-1,k=0,b=n;k<b.length;k++){var x=b[k];v=l(x,v,t,u,d,d,!0)}if(0!==_&&K.isOnToken()){var y=K.readTokenInfo(a);y.token.kind===_&&e.rangeContainsRange(a,y.token)&&p(y,a,u)}}function p(t,a,i,o){e.Debug.assert(e.rangeContainsRange(a,t.token));var s=K.lastTrailingTriviaWasNewLine(),c=!1;t.leadingTrivia&&v(t.leadingTrivia,a,b,i);var _,u=e.rangeContainsRange(n,t.token),l=r.getLineAndCharacterOfPosition(t.token.pos);if(u){var d=M(t.token),p=O;if(_=k(t.token,l,a,b,i),d)c=!1;else if(void 0!==_)c=_;else{var f=p&&r.getLineAndCharacterOfPosition(p.end).line;c=s&&l.line!==f}}if(t.trailingTrivia&&v(t.trailingTrivia,a,b,i),c){var m=u&&!M(t.token)?i.getIndentationForToken(l.line,t.token.kind,o):-1;if(t.leadingTrivia)for(var g=i.getIndentationForComment(t.token.kind,m,o),y=!0,h=0,D=t.leadingTrivia;h<D.length;h++){var S=D[h];if(e.rangeContainsRange(n,S))switch(S.kind){case 3:C(S,g,!y),y=!1;break;case 2:y&&(x(S.pos,g,!1),y=!1);break;case 4:y=!0}}-1!==m&&(x(t.token.pos,m,_),F=l.line,L=m)}K.advance(),b=a}if(e.rangeOverlapsWithStartEnd(n,t.getStart(r),t.getEnd())){var y=f(t,i,_,u),b=a;for(e.forEachChild(t,function(e){l(e,-1,t,y,i,o,!1)},function(e){d(e,t,i,y)});K.isOnToken();){var D=K.readTokenInfo(t);if(D.token.end>t.end)break;p(D,t,y)}}}function v(t,a,i,o){for(var s=0,c=t;s<c.length;s++){var _=c[s];if(e.isComment(_.kind)&&e.rangeContainsRange(n,_)){var u=r.getLineAndCharacterOfPosition(_.pos);k(_,u,a,i,o)}}}function k(e,t,a,i,o){var s,c=M(e);if(!c&&!N)if(O)s=b(e,t.line,a,O,I,R,i,o);else{var _=r.getLineAndCharacterOfPosition(n.pos);D(_.line,t.line)}return O=e,R=a,I=t.line,N=c,s}function b(e,t,n,a,o,s,c,_){B.updateContext(a,s,e,n,c);var u,l,d=i.getRulesMap().GetRule(B);return d?(P(d,a,o,e,t),10&d.Operation.Action&&t!==o?(l=!1,n.getStart(r)===e.pos&&_.recomputeIndentation(!1)):4&d.Operation.Action&&t===o&&(l=!0,n.getStart(r)===e.pos&&_.recomputeIndentation(!0)),u=!(8&d.Operation.Action)&&1!==d.Flag):u=!0,t!==o&&u&&D(o,t,a),l}function x(t,n,i){var o=y(n,a);if(i)A(t,0,o);else{var s=r.getLineAndCharacterOfPosition(t);if(n!==s.character){var c=e.getStartPositionOfLine(s.line,r);A(c,s.character,o)}}}function C(n,i,o){var s,c=r.getLineAndCharacterOfPosition(n.pos).line,_=r.getLineAndCharacterOfPosition(n.end).line;if(c===_)return void(o||x(n.pos,i,!1));s=[];for(var u=n.pos,l=c;_>l;++l){var d=e.getEndLinePosition(l,r);s.push({pos:u,end:d}),u=e.getStartPositionOfLine(l+1,r)}s.push({pos:u,end:n.end});var p=e.getStartPositionOfLine(c,r),f=t.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(p,s[0].pos,r,a);if(i!==f.column){var m=0;o&&(m=1,c++);for(var g=i-f.column,h=m,v=s.length;v>h;++h,++c){var k=e.getStartPositionOfLine(c,r),b=0===h?f:t.SmartIndenter.findFirstNonWhitespaceCharacterAndColumn(s[h].pos,s[h].end,r,a),C=b.column+g;if(C>0){var D=y(C,a);A(k,b.character,D)}else w(k,b.character)}}}function D(t,n,a){for(var i=t;n>i;++i){var o=e.getStartPositionOfLine(i,r),s=e.getEndLinePosition(i,r);if(!(a&&(e.isComment(a.kind)||e.isStringOrRegularExpressionOrTemplateLiteral(a.kind))&&a.pos<=s&&a.end>s)){var c=S(o,s);-1!==c&&(e.Debug.assert(c===o||!e.isWhiteSpace(r.text.charCodeAt(c-1))),w(c,s+1-c))}}}function S(t,n){for(var a=n;a>=t&&e.isWhiteSpace(r.text.charCodeAt(a));)a--;return a!==n?a+1:-1}function T(){var e=O?O.end:n.pos,t=r.getLineAndCharacterOfPosition(e).line,a=r.getLineAndCharacterOfPosition(n.end).line;D(t,a+1,O)}function E(t,n,r){return{span:e.createTextSpan(t,n),newText:r}}function w(e,t){t&&J.push(E(e,t,""))}function A(e,t,n){(t||n)&&J.push(E(e,t,n))}function P(e,t,n,i,o){switch(e.Operation.Action){case 1:return;case 8:t.end!==i.pos&&w(t.end,i.pos-t.end);break;case 4:if(1!==e.Flag&&n!==o)return;var s=o-n;1!==s&&A(t.end,i.pos-t.end,a.NewLineCharacter);break;case 2:if(1!==e.Flag&&n!==o)return;var c=i.pos-t.end;1===c&&32===r.text.charCodeAt(t.end)||A(t.end,i.pos-t.end," ")}}var N,O,R,I,F,L,M=l(r.parseDiagnostics,n),B=new t.FormattingContext(r,o),z=u(n,r),K=t.getFormattingScanner(r,d(z,n,r),n.end),j=t.SmartIndenter.getIndentationForNode(z,n,r,a),J=[];if(K.advance(),K.isOnToken()){var U=r.getLineAndCharacterOfPosition(z.getStart(r)).line,q=U;z.decorators&&(q=r.getLineAndCharacterOfPosition(e.getNonDecoratorTokenPosOfNode(z,r)).line);var W=p(z,a,r);h(z,z,U,q,j,W)}if(!K.isOnToken()){var V=K.getCurrentLeadingTrivia();V&&(v(V,z,z,void 0),T())}return K.close(),J}function m(e,t){switch(e.kind){case 145:case 216:case 176:case 144:case 143:case 177:if(e.typeParameters===t)return 25;if(e.parameters===t)return 17;break;case 171:case 172:if(e.typeArguments===t)return 25;if(e.arguments===t)return 17;break;case 152:if(e.typeArguments===t)return 25}return 0}function g(e){switch(e){case 17:return 18;case 25:return 27}return 0}function y(e,t){function n(e,t){for(var n="",r=0;t>r;++r)n+=e;return n}var r=!v||v.tabSize!==t.TabSize||v.indentSize!==t.IndentSize;if(r&&(v={tabSize:t.TabSize,indentSize:t.IndentSize},k=b=void 0),t.ConvertTabsToSpaces){var a=void 0,i=Math.floor(e/t.IndentSize),o=e%t.IndentSize;return b||(b=[]),void 0===b[i]?(a=n(" ",t.IndentSize*i),b[i]=a):a=b[i],o?a+n(" ",o):a}var s=Math.floor(e/t.TabSize),c=e-s*t.TabSize,_=void 0;return k||(k=[]),void 0===k[s]?k[s]=_=n(" ",s):_=k[s],c?_+n(" ",c):_}var h;!function(e){e[e.Unknown=-1]="Unknown"}(h||(h={})),t.formatOnEnter=n,t.formatOnSemicolon=r,t.formatOnClosingCurly=a,t.formatDocument=i,t.formatSelection=o;var v,k,b;t.getIndentationString=y}(t=e.formatting||(e.formatting={}))}(ts||(ts={}));var ts;!function(e){var t;!function(t){var n;!function(t){function n(n,r,i){if(n>r.text.length)return 0;if(i.IndentStyle===e.IndentStyle.None)return 0;var s=e.findPrecedingToken(n,r);if(!s)return 0;var u=e.isStringOrRegularExpressionOrTemplateLiteral(s.kind);if(u&&s.getStart(r)<=n&&s.end>n)return 0;var l=r.getLineAndCharacterOfPosition(n).line;if(i.IndentStyle===e.IndentStyle.Block){for(var f=n;f>0;){var m=r.text.charCodeAt(f);if(!e.isWhiteSpace(m)&&!e.isLineBreak(m))break;f--}var g=e.getLineStartPositionForPosition(f,r);return t.findFirstNonWhitespaceColumn(g,f,r,i)}if(24===s.kind&&184!==s.parent.kind){var y=o(s,r,i);if(-1!==y)return y}for(var h,v,b,x=s;x;){if(e.positionBelongsToNode(x,n,r)&&k(x,h)){v=_(x,r),b=c(s,x,l,r)?0:l!==v.line?i.IndentSize:0;break}var y=d(x,r,i);if(-1!==y)return y;if(y=p(x,r,i),-1!==y)return y+i.IndentSize;h=x,x=x.parent}return x?a(x,v,void 0,b,r,i):0}function r(e,t,n,r){var i=n.getLineAndCharacterOfPosition(e.getStart(n));return a(e,i,t,0,n,r)}function a(e,t,n,r,a,o){for(var c,_=e.parent;_;){var l=!0;if(n){var f=e.getStart(a);l=f<n.pos||f>n.end}if(l){var m=d(e,a,o);if(-1!==m)return m+r}c=i(_,e,a);var g=c.line===t.line||u(_,e,t.line,a);if(l){var m=s(e,_,t,g,a,o);if(-1!==m)return m+r;if(m=p(e,a,o),-1!==m)return m+r}k(_,e)&&!g&&(r+=o.IndentSize),e=_,t=c,_=e.parent}return r}function i(e,t,n){var r=l(t,n);return r?n.getLineAndCharacterOfPosition(r.pos):n.getLineAndCharacterOfPosition(e.getStart(n))}function o(t,n,r){var a=e.findListItemInfo(t);return a&&a.listItemIndex>0?f(a.list.getChildren(),a.listItemIndex-1,n,r):-1}function s(t,n,r,a,i,o){var s=(e.isDeclaration(t)||e.isStatement(t))&&(251===n.kind||!a);return s?m(r,i,o):-1}function c(t,n,r,a){var i=e.findNextToken(t,n);if(!i)return!1;if(15===i.kind)return!0;if(16===i.kind){var o=_(i,a).line;return r===o}return!1}function _(e,t){return t.getLineAndCharacterOfPosition(e.getStart(t))}function u(t,n,r,a){if(199===t.kind&&t.elseStatement===n){var i=e.findChildOfKind(t,80,a);e.Debug.assert(void 0!==i);var o=_(i,a).line;return o===r}return!1}function l(t,n){if(t.parent)switch(t.parent.kind){case 152:if(t.parent.typeArguments&&e.rangeContainsStartEnd(t.parent.typeArguments,t.getStart(n),t.getEnd()))return t.parent.typeArguments;break;case 168:return t.parent.properties;case 167:return t.parent.elements;case 216:case 176:case 177:case 144:case 143:case 148:case 149:var r=t.getStart(n);if(t.parent.typeParameters&&e.rangeContainsStartEnd(t.parent.typeParameters,r,t.getEnd()))return t.parent.typeParameters;if(e.rangeContainsStartEnd(t.parent.parameters,r,t.getEnd()))return t.parent.parameters;break;case 172:case 171:var r=t.getStart(n);if(t.parent.typeArguments&&e.rangeContainsStartEnd(t.parent.typeArguments,r,t.getEnd()))return t.parent.typeArguments;if(t.parent.arguments&&e.rangeContainsStartEnd(t.parent.arguments,r,t.getEnd()))return t.parent.arguments}}function d(t,n,r){function a(a){var i=e.indexOf(a,t);return-1!==i?f(a,i,n,r):-1}var i=l(t,n);return i?a(i):-1}function p(e,t,n){function r(e){for(;;)switch(e.kind){case 171:case 172:case 169:case 170:e=e.expression;break;default:return e}}if(18===e.kind)return-1;if(e.parent&&(171===e.parent.kind||172===e.parent.kind)&&e.parent.expression!==e){var a=e.parent.expression,i=r(a);if(a===i)return-1;var o=t.getLineAndCharacterOfPosition(a.end),s=t.getLineAndCharacterOfPosition(i.end);return o.line===s.line?-1:m(o,t,n)}return-1}function f(t,n,r,a){e.Debug.assert(n>=0&&n<t.length);for(var i=t[n],o=_(i,r),s=n-1;s>=0;--s)if(24!==t[s].kind){var c=r.getLineAndCharacterOfPosition(t[s].end).line;
if(c!==o.line)return m(o,r,a);o=_(t[s],r)}return-1}function m(e,t,n){var r=t.getPositionOfLineAndCharacter(e.line,0);return y(r,r+e.character,t,n)}function g(t,n,r,a){for(var i=0,o=0,s=t;n>s;++s){var c=r.text.charCodeAt(s);if(!e.isWhiteSpace(c))break;9===c?o+=a.TabSize+o%a.TabSize:o++,i++}return{column:o,character:i}}function y(e,t,n,r){return g(e,t,n,r).column}function h(e){switch(e){case 198:case 217:case 189:case 218:case 220:case 219:case 167:case 195:case 222:case 168:case 156:case 158:case 223:case 245:case 244:case 175:case 169:case 171:case 172:case 196:case 214:case 230:case 207:case 185:case 165:case 164:case 238:case 237:case 243:case 143:case 148:case 149:case 139:case 153:case 154:case 161:case 173:case 181:case 228:return!0}return!1}function v(e,t,n){var r=t?t.kind:0;switch(e.kind){case 200:case 201:case 203:case 204:case 202:case 199:case 216:case 176:case 144:case 177:case 145:case 146:case 147:return 195!==r;case 236:return 240!==r}return n}function k(e,t){return h(e.kind)||v(e,t,!1)}var b;!function(e){e[e.Unknown=-1]="Unknown"}(b||(b={})),t.getIndentation=n,t.getIndentationForNode=r,t.childStartsOnTheSameLineWithElseInIfStatement=u,t.findFirstNonWhitespaceCharacterAndColumn=g,t.findFirstNonWhitespaceColumn=y,t.nodeWillIndentChild=v,t.shouldIndentChildNode=k}(n=t.SmartIndenter||(t.SmartIndenter={}))}(t=e.formatting||(e.formatting={}))}(ts||(ts={}));var ts;!function(e){function t(e,t,n,r,a){var i=new J(e,t,n);return i.flags=r,i.parent=a,i}function n(t,n,r){function a(){function a(t,n){return e.map(e.getJsDocComments(t,n),function(e){return{pos:e.pos+"/*".length,end:e.end-"*/".length}})}function i(t,n,r,a){for(void 0!==a&&(n=Math.min(n,t+a));n>t;t++){var i=r.text.charCodeAt(t);if(!e.isWhiteSpace(i)||e.isLineBreak(i))return t}return n}function o(t,n,r){for(;n>t&&e.isLineBreak(r.text.charCodeAt(t));)t++;return t}function s(t,n,r,a){return t+a.length<n&&r.text.substr(t,a.length)===a&&(e.isWhiteSpace(r.text.charCodeAt(t+a.length))||e.isLineBreak(r.text.charCodeAt(t+a.length)))}function c(e,t,n){return s(e,t,n,d)}function _(t,n,r){for(;r;)r--,t.push(e.textPart(""));t.push(e.textPart(n))}function u(t,n,r){for(var a,s=[],u=0,l=!1;n>t;){var p="";if(t=i(t,n,r),n>t&&42===r.text.charCodeAt(t)){var f=t+1;t=i(t+1,n,r,a),void 0===a&&n>t&&!e.isLineBreak(r.text.charCodeAt(t))&&(a=t-f)}else void 0===a&&(a=0);for(;n>t&&!e.isLineBreak(r.text.charCodeAt(t));){var m=r.text.charAt(t);if("@"===m){if(c(t,n,r)){l=!0,t+=d.length;continue}l=!1}l||(p+=m),t++}t=o(t,n,r),p?(_(s,p,u),u=0):!l&&s.length&&u++}return s}function l(t,r,a){function u(t){for(;r>t&&e.isWhiteSpace(a.text.charCodeAt(t));)t++;return t}function l(e){if(t=o(t,r,a),!(t>=r)){void 0===p&&(p=a.getLineAndCharacterOfPosition(e).character);var n=t;if(t=i(t,r,a,p),!(t>=r)){var s=t-n;if(p>s){var c=a.text.charCodeAt(t);42===c&&(t=i(t+1,r,a,p-s-1))}}}}for(var p,f=[];r>t;){if(c(t,r,a)){var m=0,g=!1;if(t=u(t+d.length),t>=r)break;if(123===a.text.charCodeAt(t)){t++;for(var y=1;r>t;t++){var h=a.text.charCodeAt(t);if(123!==h){if(125!==h){if(64===h)break}else if(y--,0===y){t++;break}}else y++}if(t=u(t),t>=r)break}if(s(t,r,a,n)){if(t=u(t+n.length),t>=r)break;for(var v="",k=t;r>t;){var b=a.text.charCodeAt(t);if(e.isLineBreak(b))v?(_(f,v,m),v="",m=0,g=!0):g&&m++,l(k);else{if(64===b)break;v+=a.text.charAt(t),t++}}v&&_(f,v,m),p=void 0}if(64===a.text.charCodeAt(t))continue}t++}return f}var d="@param",p=[];return e.forEach(t,function(n,i){if(e.indexOf(t,n)===i){var o=e.getSourceFileOfNode(n);if(r&&139===n.kind&&e.forEach(a(n.parent,o),function(t){var n=l(t.pos,t.end,o);n&&e.addRange(p,n)}),221===n.kind&&221===n.body.kind)return;for(;221===n.kind&&221===n.parent.kind;)n=n.parent;e.forEach(a(214===n.kind?n.parent.parent:n,o),function(t){var n=u(t.pos,t.end,o);n&&e.addRange(p,n)})}}),p}var i=[],o=a();return e.forEach(o,function(t){i.length&&i.push(e.lineBreakPart()),i.push(t)}),i}function r(t){return t?e.map(t,function(e){return e.text}).join(""):""}function a(t){return t.parent?!1:e.forEach(t.declarations,function(t){if(176===t.kind)return!0;if(214!==t.kind&&216!==t.kind)return!1;for(var n=t.parent;!e.isFunctionBlock(n);n=n.parent)if(251===n.kind||222===n.kind)return!1;return!0})}function i(){return{target:1,jsx:1}}function o(e,t,n){e.version=n,e.scriptSnapshot=t}function s(t,n){var r=n.compilerOptions?e.clone(n.compilerOptions):i();r.isolatedModules=!0,r.suppressOutputPathCheck=!0,r.allowNonTsExtensions=!0,r.noLib=!0,r.noResolve=!0;var a=n.fileName||(r.jsx?"module.tsx":"module.ts"),o=e.createSourceFile(a,t,r.target);n.moduleName&&(o.moduleName=n.moduleName),o.renamedDependencies=n.renamedDependencies;var s,c,_,u=e.getNewLineCharacter(r),l={getSourceFile:function(t,n){return t===e.normalizeSlashes(a)?o:void 0},writeFile:function(t,n,r){e.fileExtensionIs(t,".map")?(e.Debug.assert(void 0===c,"Unexpected multiple source map outputs for the file '"+t+"'"),c=n):(e.Debug.assert(void 0===s,"Unexpected multiple outputs for the file: '"+t+"'"),s=n)},getDefaultLibFileName:function(){return"lib.d.ts"},useCaseSensitiveFileNames:function(){return!1},getCanonicalFileName:function(e){return e},getCurrentDirectory:function(){return""},getNewLine:function(){return u},fileExists:function(e){return e===a},readFile:function(e){return""},directoryExists:function(e){return!0}},d=e.createProgram([a],r,l);return n.reportDiagnostics&&(_=[],e.addRange(_,d.getSyntacticDiagnostics(o)),e.addRange(_,d.getOptionsDiagnostics())),d.emit(),e.Debug.assert(void 0!==s,"Output generation failed"),{outputText:s,diagnostics:_,sourceMapText:c}}function c(t,n,r,a,i){var o=s(t,{compilerOptions:n,fileName:r,reportDiagnostics:!!a,moduleName:i});return e.addRange(a,o.diagnostics),o.outputText}function _(t,n,r,a,i,s){var c=n.getText(0,n.getLength()),_=e.createSourceFile(t,c,r,i,s);return o(_,n,a),_}function u(t,n,r,a,i){if(a&&r!==t.version&&!e.disableIncrementalParsing){var s=void 0,c=0!==a.span.start?t.text.substr(0,a.span.start):"",u=e.textSpanEnd(a.span)!==t.text.length?t.text.substr(e.textSpanEnd(a.span)):"";if(0===a.newLength)s=c&&u?c+u:c||u;else{var l=n.getText(a.span.start,a.span.start+a.newLength);s=c&&u?c+l+u:c?c+l:l+u}var d=e.updateSourceFile(t,s,a,i);return o(d,n,r),d.nameTable=void 0,t!==d&&t.scriptSnapshot&&(t.scriptSnapshot.dispose&&t.scriptSnapshot.dispose(),t.scriptSnapshot=void 0),d}return _(t.fileName,n,t.languageVersion,r,!0,t.scriptKind)}function l(t,n){function r(e){return"_"+e.target+"|"+e.module+"|"+e.noResolve+"|"+e.jsx+NaN+e.allowJs}function a(t,n){var a=r(t),i=e.lookUp(d,a);return!i&&n&&(d[a]=i=e.createFileMap()),i}function i(){var t=Object.keys(d).filter(function(e){return e&&"_"===e.charAt(0)}).map(function(t){var n=e.lookUp(d,t),r=[];return n.forEachValue(function(e,t){r.push({name:e,refCount:t.languageServiceRefCount,references:t.owners.slice(0)})}),r.sort(function(e,t){return t.refCount-e.refCount}),{bucket:t,sourceFiles:r}});return JSON.stringify(t,void 0,2)}function o(e,t,n,r,a){return c(e,t,n,r,!0,a)}function s(e,t,n,r,a){return c(e,t,n,r,!1,a)}function c(t,r,i,o,s,c){var l=a(r,!0),d=e.toPath(t,n,p),f=l.get(d);if(f)f.sourceFile.version!==o&&(f.sourceFile=u(f.sourceFile,i,o,i.getChangeRange(f.sourceFile.scriptSnapshot)));else{e.Debug.assert(s,"How could we be trying to update a document that the registry doesn't have?");var m=_(t,i,r.target,o,!1,c);f={sourceFile:m,languageServiceRefCount:0,owners:[]},l.set(d,f)}return s&&f.languageServiceRefCount++,f.sourceFile}function l(t,r){var i=a(r,!1);e.Debug.assert(void 0!==i);var o=e.toPath(t,n,p),s=i.get(o);s.languageServiceRefCount--,e.Debug.assert(s.languageServiceRefCount>=0),0===s.languageServiceRefCount&&i.remove(o)}void 0===n&&(n="");var d={},p=e.createGetCanonicalFileName(!!t);return{acquireDocument:o,updateDocument:s,releaseDocument:l,reportStats:i}}function d(t,n,r){function a(){var n=e.getLeadingCommentRanges(t,0);e.forEach(n,function(n){var r=t.substring(n.pos,n.end),a=e.getFileReferenceFromReferencePath(r,n);if(a){g=a.isNoDefaultLib;var i=a.fileReference;i&&f.push(i)}})}function i(){p||(p=[]),p.push(z.getTokenValue())}function o(){var e=z.getTokenValue(),t=z.getTokenPos();m.push({fileName:e,pos:t,end:t+e.length})}function s(){var e=z.getToken();return 122===e?(e=z.scan(),125===e&&(e=z.scan(),9===e&&i()),!0):!1}function c(){var t=z.getToken();if(89===t){if(t=z.scan(),9===t)return o(),!0;if(69===t||e.isKeyword(t))if(t=z.scan(),133===t){if(t=z.scan(),9===t)return o(),!0}else if(56===t){if(u(!0))return!0}else{if(24!==t)return!0;t=z.scan()}if(15===t){for(t=z.scan();16!==t&&1!==t;)t=z.scan();16===t&&(t=z.scan(),133===t&&(t=z.scan(),9===t&&o()))}else 37===t&&(t=z.scan(),116===t&&(t=z.scan(),(69===t||e.isKeyword(t))&&(t=z.scan(),133===t&&(t=z.scan(),9===t&&o()))));return!0}return!1}function _(){var t=z.getToken();if(82===t){if(t=z.scan(),15===t){for(t=z.scan();16!==t&&1!==t;)t=z.scan();16===t&&(t=z.scan(),133===t&&(t=z.scan(),9===t&&o()))}else if(37===t)t=z.scan(),133===t&&(t=z.scan(),9===t&&o());else if(89===t&&(t=z.scan(),(69===t||e.isKeyword(t))&&(t=z.scan(),56===t&&u(!0))))return!0;return!0}return!1}function u(e){var t=e?z.scan():z.getToken();return 127===t?(t=z.scan(),17===t&&(t=z.scan(),9===t&&o()),!0):!1}function l(){var e=z.getToken();if(69===e&&"define"===z.getTokenValue()){if(e=z.scan(),17!==e)return!0;if(e=z.scan(),9===e){if(e=z.scan(),24!==e)return!0;e=z.scan()}if(19!==e)return!0;e=z.scan();for(var t=0;20!==e&&1!==e;)9===e&&(o(),t++),e=z.scan();return!0}return!1}function d(){for(z.setText(t),z.scan();;){if(1===z.getToken())break;s()||c()||_()||r&&(u(!1)||l())||z.scan()}z.setText(void 0)}void 0===n&&(n=!0),void 0===r&&(r=!1);var p,f=[],m=[],g=!1;return n&&d(),a(),{referencedFiles:f,importedFiles:m,isLibFile:g,ambientExternalModules:p}}function p(e,t){for(;e;){if(210===e.kind&&e.label.text===t)return e.label;e=e.parent}}function f(e){return 69===e.kind&&(206===e.parent.kind||205===e.parent.kind)&&e.parent.label===e}function m(e){return 69===e.kind&&210===e.parent.kind&&e.parent.label===e}function g(e,t){for(var n=e.parent;210===n.kind;n=n.parent)if(n.label.text===t)return!0;return!1}function y(e){return m(e)||f(e)}function h(e){return 136===e.parent.kind&&e.parent.right===e}function v(e){return e&&e.parent&&169===e.parent.kind&&e.parent.name===e}function k(e){return v(e)&&(e=e.parent),e&&e.parent&&171===e.parent.kind&&e.parent.expression===e}function b(e){return v(e)&&(e=e.parent),e&&e.parent&&172===e.parent.kind&&e.parent.expression===e}function x(e){return 221===e.parent.kind&&e.parent.name===e}function C(t){return 69===t.kind&&e.isFunctionLike(t.parent)&&t.parent.name===t}function D(e){return!(69!==e.kind&&9!==e.kind&&8!==e.kind||248!==e.parent.kind&&249!==e.parent.kind||e.parent.name!==e)}function S(e){if(9===e.kind||8===e.kind)switch(e.parent.kind){case 142:case 141:case 248:case 250:case 144:case 143:case 146:case 147:case 221:return e.parent.name===e;case 170:return e.parent.argumentExpression===e}return!1}function T(t){return 9===t.kind?x(t)||e.isExternalModuleImportEqualsDeclaration(t.parent.parent)&&e.getExternalModuleImportEqualsDeclarationExpression(t.parent.parent)===t:!1}function E(t,n,r){function a(n){return e.forEach(n,function(e){if(e.pos<r&&r<e.end)return!0;if(r===e.end){var n=t.text,a=e.end-e.pos;return 2>=a||47===n.charCodeAt(e.pos+1)?!0:!(47===n.charCodeAt(e.end-1)&&42===n.charCodeAt(e.end-2))}return!1})}return r<=n.getStart(t)&&(a(e.getTrailingCommentRanges(t.text,n.getFullStart()))||a(e.getLeadingCommentRanges(t.text,n.getFullStart())))}function w(e){for(;;){if(e=e.parent,!e)return;switch(e.kind){case 251:case 144:case 143:case 216:case 176:case 146:case 147:case 217:case 218:case 220:case 221:return e}}}function A(t){switch(t.kind){case 221:return Q.moduleElement;case 217:return Q.classElement;case 218:return Q.interfaceElement;case 219:return Q.typeElement;case 220:return Q.enumElement;case 214:return e.isConst(t)?Q.constElement:e.isLet(t)?Q.letElement:Q.variableElement;case 216:return Q.functionElement;case 146:return Q.memberGetAccessorElement;case 147:return Q.memberSetAccessorElement;case 144:case 143:return Q.memberFunctionElement;case 142:case 141:return Q.memberVariableElement;case 150:return Q.indexSignatureElement;case 149:return Q.constructSignatureElement;case 148:return Q.callSignatureElement;case 145:return Q.constructorImplementationElement;case 138:return Q.typeParameterElement;case 250:return Q.variableElement;case 139:return 56&t.flags?Q.memberVariableElement:Q.parameterElement;case 224:case 229:case 226:case 233:case 227:return Q.alias}return Q.unknown}function P(t,n){function r(e){t.log&&t.log(e)}function i(e){var t=Ge.getSourceFile(e);if(!t)throw new Error("Could not find file: '"+e+"'.");return t}function o(t){return He||(He=new e.formatting.RulesProvider),He.ensureUpToDate(t),He}function s(){function r(t){e.Debug.assert(void 0!==s);var r=s.getOrCreateEntry(t);if(r){if(!u){var a=Ge&&Ge.getSourceFile(t);if(a)return e.Debug.assert(r.scriptKind===a.scriptKind,"Registered script kind ("+a.scriptKind+") should match new script kind ("+r.scriptKind+") for file: "+t),n.updateDocument(t,_,r.scriptSnapshot,r.version,r.scriptKind)}return n.acquireDocument(t,_,r.scriptSnapshot,r.version,r.scriptKind)}}function a(t){if(!t)return!1;var n=t.path||e.toPath(t.fileName,Ze,et);return t.version===s.getVersion(n)}function i(){if(!Ge)return!1;var t=s.getRootFileNames();if(Ge.getSourceFiles().length!==t.length)return!1;for(var n=0,r=t;n<r.length;n++){var i=r[n];if(!a(Ge.getSourceFile(i)))return!1}return e.compareDataObjects(Ge.getCompilerOptions(),s.compilationSettings())}if(t.getProjectVersion){var o=t.getProjectVersion();if(o){if(Xe===o)return;Xe=o}}var s=new ee(t,et);if(!i()){var c=Ge&&Ge.getCompilerOptions(),_=s.compilationSettings(),u=c&&(c.target!==_.target||c.module!==_.module||c.noResolve!==_.noResolve||c.jsx!==_.jsx||c.allowJs!==_.allowJs||c.disableSizeLimit!==c.disableSizeLimit),l={getSourceFile:r,getCancellationToken:function(){return $e},getCanonicalFileName:et,useCaseSensitiveFileNames:function(){return Ye},getNewLine:function(){return e.getNewLineOrDefaultFromHost(t)},getDefaultLibFileName:function(e){return t.getDefaultLibFileName(e)},writeFile:function(e,t,n){},getCurrentDirectory:function(){return Ze},fileExists:function(n){return e.Debug.assert(!t.resolveModuleNames),void 0!==s.getOrCreateEntry(n)},readFile:function(e){var t=s.getOrCreateEntry(e);return t&&t.scriptSnapshot.getText(0,t.scriptSnapshot.getLength())},directoryExists:function(n){return e.Debug.assert(!t.resolveModuleNames),e.directoryProbablyExists(n,t)}};t.resolveModuleNames&&(l.resolveModuleNames=function(e,n){return t.resolveModuleNames(e,n)});var d=e.createProgram(s.getRootFileNames(),_,l,Ge);if(Ge)for(var p=Ge.getSourceFiles(),f=0,m=p;f<m.length;f++){var g=m[f];d.getSourceFile(g.fileName)&&!u||n.releaseDocument(g.fileName,c)}s=void 0,Ge=d,Ge.getTypeChecker()}}function c(){return s(),Ge}function _(){}function u(){Ge&&e.forEach(Ge.getSourceFiles(),function(e){return n.releaseDocument(e.fileName,Ge.getCompilerOptions())})}function d(e){return s(),Ge.getSyntacticDiagnostics(i(e),$e)}function m(t){s();var n=i(t),r=Ge.getSemanticDiagnostics(n,$e);if(!Ge.getCompilerOptions().declaration)return r;var a=Ge.getDeclarationDiagnostics(n,$e);return e.concatenate(r,a)}function A(){return s(),Ge.getOptionsDiagnostics($e).concat(Ge.getGlobalDiagnostics($e))}function P(t,n,r,a){var i=e.getDeclaredName(Ge.getTypeChecker(),t,a);if(i){var o=i.charCodeAt(0);if(1536&t.flags&&(39===o||34===o))return}return O(i,n,r)}function O(t,n,r){return t&&(t=e.stripQuotes(t),t&&(!r||e.isIdentifier(t,n)))?t:void 0}function R(t,n){function a(){if(V=!0,H=!1,69===B.kind||136===B.kind||169===B.kind){var t=D.getSymbolAtLocation(B);if(t&&8388608&t.flags&&(t=D.getAliasedSymbol(t)),t&&1952&t.flags){var n=D.getExportsOfModule(t);e.forEach(n,function(e){D.isValidPropertyAccess(B.parent,e.name)&&X.push(e)})}}var r=D.getTypeAtLocation(B);o(r)}function o(e){if(e){for(var t=0,n=e.getApparentProperties();t<n.length;t++){var r=n[t];D.isValidPropertyAccess(B.parent,r.name)&&X.push(r)}if(T&&16384&e.flags)for(var a=e,i=0,s=a.types;i<s.length;i++){var c=s[i];o(c)}}}function s(){var t,r,a;if(t=m(L))return p(t);if(r=g(L))return f(r);if(a=y(L)){var i=void 0;if((237===a.kind||238===a.kind)&&(i=D.getJsxElementAttributesType(a)))return X=C(D.getPropertiesOfType(i),a.attributes),V=!0,H=!1,!0}V=!1,H=l(L),F!==L&&e.Debug.assert(!!F,"Expected 'contextToken' to be defined when different from 'previousToken'.");var o=F!==L?F.getStart():n,s=c(L,o,S)||S,_=9289727;return X=D.getSymbolsInScope(s,_),!0}function c(t,n,r){for(var a=t;a&&!e.positionBelongsToNode(a,n,r);)a=a.parent;return a}function _(e){var t=(new Date).getTime(),n=d(e)||v(e)||k(e)||u(e);return r("getCompletionsAtPosition: isCompletionListBlocker: "+((new Date).getTime()-t)),n}function u(e){if(239===e.kind)return!0;if(27===e.kind&&e.parent){if(238===e.parent.kind)return!0;if(240===e.parent.kind||237===e.parent.kind)return e.parent.parent&&236===e.parent.parent.kind}return!1}function l(e){if(e){var t=e.parent.kind;switch(e.kind){case 24:return 171===t||145===t||172===t||167===t||184===t||153===t;case 17:return 171===t||145===t||172===t||175===t||161===t;case 19:return 167===t||150===t||137===t;case 125:case 126:return!0;case 21:return 221===t;case 15:return 217===t;case 56:return 214===t||184===t;case 12:return 186===t;case 13:return 193===t;case 112:case 110:case 111:return 142===t}switch(e.getText()){case"public":case"protected":case"private":return!0}}return!1}function d(t){if(9===t.kind||163===t.kind||10===t.kind||e.isTemplateLiteralKind(t.kind)){var r=t.getStart(),a=t.getEnd();if(n>r&&a>n)return!0;if(n===a)return!!t.isUnterminated||10===t.kind}return!1}function p(t){V=!0;var n,r;if(168===t.kind)H=!0,n=D.getContextualType(t),r=t.properties;else if(164===t.kind){H=!1;var a=e.getRootDeclaration(t.parent);e.isVariableLike(a)?(a.initializer||a.type)&&(n=D.getTypeAtLocation(t),r=t.elements):e.Debug.fail("Root declaration is not variable-like.")}else e.Debug.fail("Expected object literal or binding pattern, got "+t.kind);if(!n)return!1;var i=D.getPropertiesOfType(n);return i&&i.length>0&&(X=x(i,r)),!0}function f(t){var n=228===t.kind?225:231,r=e.getAncestor(t,n),a=r.moduleSpecifier;if(!a)return!1;V=!0,H=!1;var i,o=D.getSymbolAtLocation(r.moduleSpecifier);return o&&(i=D.getExportsOfModule(o)),X=i?b(i,t.elements):K,!0}function m(e){if(e)switch(e.kind){case 15:case 24:var t=e.parent;if(t&&(168===t.kind||164===t.kind))return t}}function g(e){if(e)switch(e.kind){case 15:case 24:switch(e.parent.kind){case 228:case 232:return e.parent}}}function y(e){if(e){var t=e.parent;switch(e.kind){case 26:case 39:case 69:case 241:case 242:if(t&&(237===t.kind||238===t.kind))return t;if(241===t.kind)return t.parent;break;case 9:if(t&&(241===t.kind||242===t.kind))return t.parent;break;case 16:if(t&&243===t.kind&&t.parent&&241===t.parent.kind)return t.parent.parent;if(t&&242===t.kind)return t.parent}}}function h(e){switch(e){case 176:case 177:case 216:case 144:case 143:case 146:case 147:case 148:case 149:case 150:return!0}return!1}function v(e){var t=e.parent.kind;switch(e.kind){case 24:return 214===t||215===t||196===t||220===t||h(t)||217===t||189===t||218===t||165===t||219===t;case 21:return 165===t;case 54:return 166===t;case 19:return 165===t;case 17:return 247===t||h(t);case 15:return 220===t||218===t||156===t;case 23:return 141===t&&e.parent&&e.parent.parent&&(218===e.parent.parent.kind||156===e.parent.parent.kind);case 25:return 217===t||189===t||218===t||219===t||h(t);case 113:return 142===t;case 22:return 139===t||e.parent&&e.parent.parent&&165===e.parent.parent.kind;case 112:case 110:case 111:return 139===t;case 116:return 229===t||233===t||227===t;case 73:case 81:case 107:case 87:case 102:case 123:case 129:case 89:case 108:case 74:case 114:case 132:return!0}switch(e.getText()){case"abstract":case"async":case"class":case"const":case"declare":case"enum":case"function":case"interface":case"let":case"private":case"protected":case"public":case"static":case"var":case"yield":return!0}return!1}function k(e){if(8===e.kind){var t=e.getFullText();return"."===t.charAt(t.length-1)}return!1}function b(t,r){for(var a={},i=0,o=r;i<o.length;i++){var s=o[i];if(!(s.getStart()<=n&&n<=s.getEnd())){var c=s.propertyName||s.name;a[c.text]=!0}}return e.isEmpty(a)?t:e.filter(t,function(t){return!e.lookUp(a,t.name)})}function x(t,r){if(!r||0===r.length)return t;for(var a={},i=0,o=r;i<o.length;i++){var s=o[i];if(!(248!==s.kind&&249!==s.kind&&166!==s.kind&&144!==s.kind||s.getStart()<=n&&n<=s.getEnd())){var c=void 0;166===s.kind&&s.propertyName?69===s.propertyName.kind&&(c=s.propertyName.text):c=s.name.text,a[c]=!0}}return e.filter(t,function(t){return!e.lookUp(a,t.name)})}function C(t,r){for(var a={},i=0,o=r;i<o.length;i++){var s=o[i];s.getStart()<=n&&n<=s.getEnd()||241===s.kind&&(a[s.name.text]=!0)}return e.filter(t,function(t){return!e.lookUp(a,t.name)})}var D=Ge.getTypeChecker(),S=i(t),T=e.isSourceFileJavaScript(S),w=!1,A=(new Date).getTime(),P=e.getTokenAtPosition(S,n);r("getCompletionData: Get current token: "+((new Date).getTime()-A)),A=(new Date).getTime();var N=E(S,P,n);if(r("getCompletionData: Is inside comment: "+((new Date).getTime()-A)),N){e.hasDocComment(S,n)&&64===S.text.charCodeAt(n-1)&&(w=!0);var O=!1,R=e.getJsDocTagAtPosition(S,n);if(R)switch(R.tagName.pos<=n&&n<=R.tagName.end&&(w=!0),R.kind){case 272:case 270:case 271:var I=R;I.typeExpression&&(O=I.typeExpression.pos<n&&n<I.typeExpression.end)}if(w)return{symbols:void 0,isMemberCompletion:!1,isNewIdentifierLocation:!1,location:void 0,isRightOfDot:!1,isJsDocTagName:w};if(!O)return void r("Returning an empty list because completion was inside a regular comment or plain text part of a JsDoc comment.")}A=(new Date).getTime();var F=e.findPrecedingToken(n,S);r("getCompletionData: Get previous token 1: "+((new Date).getTime()-A));var L=F;if(L&&n<=L.end&&e.isWord(L.kind)){var M=(new Date).getTime();L=e.findPrecedingToken(L.getFullStart(),S),r("getCompletionData: Get previous token 2: "+((new Date).getTime()-M))}var B=P,z=!1,j=!1,J=!1,U=e.getTouchingPropertyName(S,n);if(L){if(_(L))return void r("Returning an empty list because completion was requested in an invalid position.");var q=L.parent,W=L.kind;if(21===W)if(169===q.kind)B=L.parent.expression,z=!0;else{if(136!==q.kind)return;B=L.parent.left,z=!0}else 1===S.languageVariant&&(25===W?(j=!0,U=L):39===W&&240===L.parent.kind&&(J=!0,U=L))}var V,H,G=(new Date).getTime(),X=[];if(z)a();else if(j){var Q=D.getJsxIntrinsicTagNames();X=s()?Q.concat(X.filter(function(e){return!!(107455&e.flags)})):Q,V=!0,H=!1}else if(J){var Y=L.parent.parent.openingElement.tagName,$=D.getSymbolAtLocation(Y);D.isUnknownSymbol($)||(X=[$]),V=!0,H=!1}else if(!s())return;return r("getCompletionData: Semantic work: "+((new Date).getTime()-G)),{symbols:X,isMemberCompletion:V,isNewIdentifierLocation:H,location:U,isRightOfDot:z||j,isJsDocTagName:w}}function I(t,n){function a(e,t,n){var r=[],a=Ge.getCompilerOptions().target,i=N(e);for(var o in i)if(i[o]!==t&&!n[o]){n[o]=o;var s=O(o,a,!0);if(s){var c={name:s,kind:Q.warning,kindModifiers:"",sortText:"1"};r.push(c)}}return r}function o(){return B||(B=e.map(j,function(e){return{name:e,kind:Q.keyword,kindModifiers:"",sortText:"0"}}))}function c(e,t){var n=P(e,Ge.getCompilerOptions().target,!0,t);if(n)return{name:n,kind:L(e,t),kindModifiers:z(e),sortText:"0"}}function _(t,n){var a=(new Date).getTime(),i={};if(t)for(var o=0,s=t;o<s.length;o++){var _=s[o],u=c(_,f);if(u){var l=e.escapeIdentifier(u.name);e.lookUp(i,l)||(n.push(u),i[l]=l)}}return r("getCompletionsAtPosition: getCompletionEntriesFromSymbols: "+((new Date).getTime()-a)),i}s();var u=R(t,n);if(u){var l=u.symbols,d=u.isMemberCompletion,p=u.isNewIdentifierLocation,f=u.location,m=u.isJsDocTagName;if(m)return{isMemberCompletion:!1,isNewIdentifierLocation:!1,entries:o()};var g=i(t),y=[];if(e.isSourceFileJavaScript(g)){var h=_(l,y);e.addRange(y,a(g,f.pos,h))}else{if(!l||0===l.length){if(1!==g.languageVariant||!f.parent||240!==f.parent.kind)return;var v=f.parent.parent.openingElement.tagName;y.push({name:v.text,kind:void 0,kindModifiers:void 0,sortText:"0"})}_(l,y)}return d||m||e.addRange(y,ae),{isMemberCompletion:d,isNewIdentifierLocation:p,entries:y}}}function F(t,n,r){s();var a=R(t,n);if(a){var o=a.symbols,c=a.location,_=Ge.getCompilerOptions().target,u=e.forEach(o,function(e){return P(e,_,!1,c)===r?e:void 0});if(u){var l=J(u,i(t),c,c,7),d=l.displayParts,p=l.documentation,f=l.symbolKind;return{name:r,kindModifiers:z(u),kind:f,displayParts:d,documentation:p}}}var m=e.forEach(ae,function(e){return e.name===r});return m?{name:r,kind:Q.keyword,kindModifiers:$.none,displayParts:[e.displayPart(r,X.keyword)],documentation:void 0}:void 0}function L(t,n){var r=t.getFlags();if(32&r)return e.getDeclarationOfKind(t,189)?Q.localClassElement:Q.classElement;if(384&r)return Q.enumElement;if(524288&r)return Q.typeElement;if(64&r)return Q.interfaceElement;if(262144&r)return Q.typeParameterElement;var a=M(t,r,n);if(a===Q.unknown){if(262144&r)return Q.typeParameterElement;if(8&r)return Q.variableElement;if(8388608&r)return Q.alias;if(1536&r)return Q.moduleElement}return a}function M(t,n,r){var i=Ge.getTypeChecker();if(i.isUndefinedSymbol(t))return Q.variableElement;if(i.isArgumentsSymbol(t))return Q.localVariableElement;if(3&n)return e.isFirstDeclarationOfSymbolParameter(t)?Q.parameterElement:t.valueDeclaration&&e.isConst(t.valueDeclaration)?Q.constElement:e.forEach(t.declarations,e.isLet)?Q.letElement:a(t)?Q.localVariableElement:Q.variableElement;if(16&n)return a(t)?Q.localFunctionElement:Q.functionElement;if(32768&n)return Q.memberGetAccessorElement;if(65536&n)return Q.memberSetAccessorElement;if(8192&n)return Q.memberFunctionElement;if(16384&n)return Q.constructorImplementationElement;if(4&n){if(268435456&n){var o=e.forEach(i.getRootSymbols(t),function(t){var n=t.getFlags();return 98311&n?Q.memberVariableElement:void e.Debug.assert(!!(8192&n))});if(!o){var s=i.getTypeOfSymbolAtLocation(t,r);return s.getCallSignatures().length?Q.memberFunctionElement:Q.memberVariableElement}return o}return Q.memberVariableElement}return Q.unknown}function z(t){return t&&t.declarations&&t.declarations.length>0?e.getNodeModifiers(t.declarations[0]):$.none}function J(t,n,r,a,i){function o(){g.length&&g.push(e.lineBreakPart())}function s(t,r){var a=e.symbolToDisplayParts(m,t,r||n,void 0,3);e.addRange(g,a)}function c(t,n){o(),n&&(_(n),g.push(e.spacePart()),s(t))}function _(t){switch(t){case Q.variableElement:case Q.functionElement:case Q.letElement:case Q.constElement:case Q.constructorImplementationElement:return void g.push(e.textOrKeywordPart(t));default:return g.push(e.punctuationPart(17)),g.push(e.textOrKeywordPart(t)),void g.push(e.punctuationPart(18))}}function u(t,n,a){e.addRange(g,e.signatureToDisplayParts(m,t,r,32|a)),n.length>1&&(g.push(e.spacePart()),g.push(e.punctuationPart(17)),g.push(e.operatorPart(35)),g.push(e.displayPart((n.length-1).toString(),X.numericLiteral)),g.push(e.spacePart()),g.push(e.textPart(2===n.length?"overload":"overloads")),g.push(e.punctuationPart(18))),d=t.getDocumentationComment()}function l(t,n){var r=e.mapToDisplayParts(function(e){m.getSymbolDisplayBuilder().buildTypeParameterDisplayFromSymbol(t,e,n)});e.addRange(g,r)}void 0===i&&(i=Ce(a));var d,p,f,m=Ge.getTypeChecker(),g=[],y=t.flags,h=M(t,y,a);if(h!==Q.unknown||32&y||8388608&y){h!==Q.memberGetAccessorElement&&h!==Q.memberSetAccessorElement||(h=Q.memberVariableElement);var v=void 0;if(f=m.getTypeOfSymbolAtLocation(t,a)){if(a.parent&&169===a.parent.kind){var x=a.parent.name;(x===a||x&&0===x.getFullWidth())&&(a=a.parent)}var D=void 0;if(171===a.kind||172===a.kind?D=a:(k(a)||b(a))&&(D=a.parent),D){var S=[];v=m.getResolvedSignature(D,S),!v&&S.length&&(v=S[0]);var T=172===D.kind||95===D.expression.kind,E=T?f.getConstructSignatures():f.getCallSignatures();if(e.contains(E,v.target)||e.contains(E,v)||(v=E.length?E[0]:void 0),v){switch(T&&32&y?(h=Q.constructorImplementationElement,c(f.symbol,h)):8388608&y?(h=Q.alias,_(h),g.push(e.spacePart()),T&&(g.push(e.keywordPart(92)),g.push(e.spacePart())),s(t)):c(t,h),h){case Q.memberVariableElement:case Q.variableElement:case Q.constElement:case Q.letElement:case Q.parameterElement:case Q.localVariableElement:g.push(e.punctuationPart(54)),g.push(e.spacePart()),T&&(g.push(e.keywordPart(92)),g.push(e.spacePart())),65536&f.flags||e.addRange(g,e.symbolToDisplayParts(m,f.symbol,r,void 0,1)),u(v,E,8);break;default:u(v,E)}p=!0}}else if(C(a)&&!(98304&t.flags)||121===a.kind&&145===a.parent.kind){var w=a.parent,E=145===w.kind?f.getConstructSignatures():f.getCallSignatures();v=m.isImplementationOfOverload(w)?E[0]:m.getSignatureFromDeclaration(w),145===w.kind?(h=Q.constructorImplementationElement,c(f.symbol,h)):c(148!==w.kind||2048&f.symbol.flags||4096&f.symbol.flags?t:f.symbol,h),u(v,E),p=!0}}}if(32&y&&!p&&(e.getDeclarationOfKind(t,189)?_(Q.localClassElement):g.push(e.keywordPart(73)),g.push(e.spacePart()),s(t),l(t,n)),64&y&&2&i&&(o(),g.push(e.keywordPart(107)),g.push(e.spacePart()),s(t),l(t,n)),524288&y&&(o(),g.push(e.keywordPart(132)),g.push(e.spacePart()),s(t),l(t,n),g.push(e.spacePart()),g.push(e.operatorPart(56)),g.push(e.spacePart()),e.addRange(g,e.typeToDisplayParts(m,m.getDeclaredTypeOfSymbol(t),r))),384&y&&(o(),e.forEach(t.declarations,e.isConstEnumDeclaration)&&(g.push(e.keywordPart(74)),g.push(e.spacePart())),g.push(e.keywordPart(81)),g.push(e.spacePart()),s(t)),1536&y){o();var A=e.getDeclarationOfKind(t,221),P=A&&A.name&&69===A.name.kind;g.push(e.keywordPart(P?126:125)),g.push(e.spacePart()),s(t)}if(262144&y&&2&i)if(o(),g.push(e.punctuationPart(17)),g.push(e.textPart("type parameter")),g.push(e.punctuationPart(18)),g.push(e.spacePart()),s(t),g.push(e.spacePart()),g.push(e.keywordPart(90)),g.push(e.spacePart()),t.parent)s(t.parent,r),l(t.parent,r);else{var A=e.getDeclarationOfKind(t,138);if(e.Debug.assert(void 0!==A),A=A.parent)if(e.isFunctionLikeKind(A.kind)){var v=m.getSignatureFromDeclaration(A);149===A.kind?(g.push(e.keywordPart(92)),g.push(e.spacePart())):148!==A.kind&&A.name&&s(A.symbol),e.addRange(g,e.signatureToDisplayParts(m,v,n,32))}else g.push(e.keywordPart(132)),g.push(e.spacePart()),s(A.symbol),l(A.symbol,n)}if(8&y){c(t,"enum member");var A=t.declarations[0];if(250===A.kind){var N=m.getConstantValue(A);void 0!==N&&(g.push(e.spacePart()),g.push(e.operatorPart(56)),g.push(e.spacePart()),g.push(e.displayPart(N.toString(),X.numericLiteral)))}}if(8388608&y&&(o(),g.push(e.keywordPart(89)),g.push(e.spacePart()),s(t),e.forEach(t.declarations,function(t){if(224===t.kind){var n=t;if(e.isExternalModuleImportEqualsDeclaration(n))g.push(e.spacePart()),g.push(e.operatorPart(56)),g.push(e.spacePart()),g.push(e.keywordPart(127)),g.push(e.punctuationPart(17)),g.push(e.displayPart(e.getTextOfNode(e.getExternalModuleImportEqualsDeclarationExpression(n)),X.stringLiteral)),g.push(e.punctuationPart(18));else{var a=m.getSymbolAtLocation(n.moduleReference);a&&(g.push(e.spacePart()),g.push(e.operatorPart(56)),g.push(e.spacePart()),s(a,r))}return!0}})),!p)if(h!==Q.unknown){if(f)if(c(t,h),h===Q.memberVariableElement||3&y||h===Q.localVariableElement)if(g.push(e.punctuationPart(54)),g.push(e.spacePart()),f.symbol&&262144&f.symbol.flags){var O=e.mapToDisplayParts(function(e){m.getSymbolDisplayBuilder().buildTypeParameterDisplay(f,e,r)});e.addRange(g,O)}else e.addRange(g,e.typeToDisplayParts(m,f,r));else if(16&y||8192&y||16384&y||131072&y||98304&y||h===Q.memberFunctionElement){var E=f.getCallSignatures();u(E[0],E)}}else h=L(t,a);return d||(d=t.getDocumentationComment()),{displayParts:g,documentation:d,symbolKind:h}}function U(t,n){s();var r=i(t),a=e.getTouchingPropertyName(r,n);if(a&&!y(a)){var o=Ge.getTypeChecker(),c=o.getSymbolAtLocation(a);if(c&&!o.isUnknownSymbol(c)){var _=J(c,r,w(a),a);return{kind:_.symbolKind,kindModifiers:z(c),textSpan:e.createTextSpan(a.getStart(),a.getWidth()),displayParts:_.displayParts,documentation:_.documentation}}switch(a.kind){case 69:case 169:case 136:case 97:case 162:case 95:var u=o.getTypeAtLocation(a);
if(u)return{kind:Q.unknown,kindModifiers:$.none,textSpan:e.createTextSpan(a.getStart(),a.getWidth()),displayParts:e.typeToDisplayParts(o,u,w(a)),documentation:u.symbol?u.symbol.getDocumentationComment():void 0}}}}function q(t,n,r,a){return{fileName:t.getSourceFile().fileName,textSpan:e.createTextSpanFromBounds(t.getStart(),t.getEnd()),kind:n,name:r,containerKind:void 0,containerName:a}}function W(t,n){function r(t,n,r,a,o,s){if((b(n)||121===n.kind)&&32&t.flags){for(var c=0,_=t.getDeclarations();c<_.length;c++){var u=_[c];if(e.isClassLike(u))return i(u.members,!0,r,a,o,s)}e.Debug.fail("Expected declaration to have at least one class-like declaration")}return!1}function a(e,t,n,r,a,o){return k(t)||b(t)||C(t)?i(e.declarations,!1,n,r,a,o):!1}function i(t,n,r,a,i,o){var s,c=[];return e.forEach(t,function(e){(n&&145===e.kind||!n&&(216===e.kind||144===e.kind||143===e.kind))&&(c.push(e),e.body&&(s=e))}),s?(o.push(q(s,r,a,i)),!0):c.length?(o.push(q(e.lastOrUndefined(c),r,a,i)),!0):!1}var o=Ge.getTypeChecker(),s=[],c=t.getDeclarations(),_=o.symbolToString(t),u=L(t,n),l=t.parent,d=l?o.symbolToString(l,n):"";return r(t,n,u,_,d,s)||a(t,n,u,_,d,s)||e.forEach(c,function(e){s.push(q(e,u,_,d))}),s}function V(t,n){s();var r=i(t),a=e.getTouchingPropertyName(r,n);if(a){if(f(a)){var o=a.text,c=p(a.parent,a.text);return c?[q(c,Q.label,o,void 0)]:void 0}var _=e.forEach(r.referencedFiles,function(e){return e.pos<=n&&n<e.end?e:void 0});if(_){var u=e.tryResolveScriptReference(Ge,r,_);if(u)return[{fileName:u.fileName,textSpan:e.createTextSpanFromBounds(0,0),kind:Q.scriptElement,name:_.fileName,containerName:void 0,containerKind:void 0}]}else{var l=Ge.getTypeChecker(),d=l.getSymbolAtLocation(a);if(d){if(8388608&d.flags){var m=d.declarations[0];69===a.kind&&a.parent===m&&(d=l.getAliasedSymbol(d))}if(249===a.parent.kind){var g=l.getShorthandAssignmentValueSymbol(d.valueDeclaration);if(!g)return[];var y=g.getDeclarations(),h=L(g,a),v=l.symbolToString(g),k=l.symbolToString(d.parent,a);return e.map(y,function(e){return q(e,h,v,k)})}return W(d,a)}}}}function H(t,n){s();var r=i(t),a=e.getTouchingPropertyName(r,n);if(a){var o=Ge.getTypeChecker(),c=o.getSymbolAtLocation(a);if(c){var _=o.getTypeOfSymbolAtLocation(c,a);if(_){if(16384&_.flags){var u=[];return e.forEach(_.types,function(t){t.symbol&&e.addRange(u,W(t.symbol,a))}),u}if(_.symbol)return W(_.symbol,a)}}}}function Y(t,n){var r=re(t,n);if(r){var a=et(e.normalizeSlashes(t));r=e.filter(r,function(t){return et(e.normalizeSlashes(t.fileName))===a})}return r}function ne(t,n,r){function a(t){var n=t.getStart(),r=t.getEnd();return{fileName:u.fileName,textSpan:e.createTextSpanFromBounds(n,r),kind:G.none}}function o(t){function n(t){if(t){for(var n={},r=[],a=0,i=t;a<i.length;a++)for(var o=i[a],s=0,c=o.references;s<c.length;s++){var _=c[s],u=_.fileName,l=e.getProperty(n,u);l||(l={fileName:u,highlightSpans:[]},n[u]=l,r.push(l)),l.highlightSpans.push({textSpan:_.textSpan,kind:_.isWriteAccess?G.writtenReference:G.reference})}return r}}if(69===t.kind||97===t.kind||162===t.kind||95===t.kind||S(t)||T(t)){var r=le(t,_,!1,!1);return n(r)}}function c(t){function n(e,t){return void 0!==e&&e.kind===t}function r(e){return e&&e.parent}function i(t){if(t)switch(t.kind){case 88:case 80:if(n(t.parent,199))return C(t.parent);break;case 94:if(n(t.parent,207))return x(t.parent);break;case 98:if(n(t.parent,211))return b(t.parent);break;case 72:if(n(r(r(t)),212))return k(t.parent.parent);break;case 100:case 85:if(n(r(t),212))return k(t.parent);break;case 96:if(n(t.parent,209))return v(t.parent);break;case 71:case 77:if(n(r(r(r(t))),209))return v(t.parent.parent.parent);break;case 70:case 75:if(n(t.parent,206)||n(t.parent,205))return h(t.parent);break;case 86:if(n(t.parent,202)||n(t.parent,203)||n(t.parent,204))return y(t.parent);break;case 104:case 79:if(n(t.parent,201)||n(t.parent,200))return y(t.parent);break;case 121:if(n(t.parent,145))return m(t.parent);break;case 123:case 129:if(n(t.parent,146)||n(t.parent,147))return f(t.parent);break;default:if(e.isModifierKind(t.kind)&&t.parent&&(e.isDeclaration(t.parent)||196===t.parent.kind))return d(t.kind,t.parent)}}function o(t){function n(t){if(211===t.kind)r.push(t);else if(212===t.kind){var a=t;n(a.catchClause?a.catchClause:a.tryBlock),a.finallyBlock&&n(a.finallyBlock)}else e.isFunctionLike(t)||e.forEachChild(t,n)}var r=[];return n(t),r}function s(t){for(var n=t;n.parent;){var r=n.parent;if(e.isFunctionBlock(r)||251===r.kind)return r;if(212===r.kind){var a=r;if(a.tryBlock===n&&a.catchClause)return n}n=r}}function c(t){function n(t){206===t.kind||205===t.kind?r.push(t):e.isFunctionLike(t)||e.forEachChild(t,n)}var r=[];return n(t),r}function _(e,t){var n=l(t);return n&&n===e}function l(t){for(var n=t.parent;n;n=n.parent)switch(n.kind){case 209:if(205===t.kind)continue;case 202:case 203:case 204:case 201:case 200:if(!t.label||g(n,t.label.text))return n;break;default:if(e.isFunctionLike(n))return}}function d(t,r){function i(t){switch(t){case 112:return 8;case 110:return 16;case 111:return 32;case 113:return 64;case 82:return 2;case 122:return 4;case 115:return 128;default:e.Debug.fail()}}var o=r.parent;if(e.isAccessibilityModifier(t)){if(!(217===o.kind||189===o.kind||139===r.kind&&n(o,145)))return}else if(113===t){if(217!==o.kind&&189!==o.kind)return}else if(82===t||122===t){if(222!==o.kind&&251!==o.kind)return}else{if(115!==t)return;if(217!==o.kind&&217!==r.kind)return}var s,c=[],_=i(t);switch(o.kind){case 222:case 251:s=128&_?r.members.concat(r):o.statements;break;case 145:s=o.parameters.concat(o.parent.members);break;case 217:case 189:if(s=o.members,56&_){var u=e.forEach(o.members,function(e){return 145===e.kind&&e});u&&(s=s.concat(u.parameters))}else 128&_&&(s=s.concat(o));break;default:e.Debug.fail("Invalid container kind.")}return e.forEach(s,function(n){n.modifiers&&n.flags&_&&e.forEach(n.modifiers,function(e){return p(c,e,t)})}),e.map(c,a)}function p(t,n){for(var r=[],a=2;a<arguments.length;a++)r[a-2]=arguments[a];return n&&e.contains(r,n.kind)?(t.push(n),!0):!1}function f(t){function n(t,n){var a=e.getDeclarationOfKind(t,n);a&&e.forEach(a.getChildren(),function(e){return p(r,e,123,129)})}var r=[];return n(t.symbol,146),n(t.symbol,147),e.map(r,a)}function m(t){var n=t.symbol.getDeclarations(),r=[];return e.forEach(n,function(t){e.forEach(t.getChildren(),function(e){return p(r,e,121)})}),e.map(r,a)}function y(t){var n=[];if(p(n,t.getFirstToken(),86,104,79)&&200===t.kind)for(var r=t.getChildren(),i=r.length-1;i>=0&&!p(n,r[i],104);i--);var o=c(t.statement);return e.forEach(o,function(e){_(t,e)&&p(n,e.getFirstToken(),70,75)}),e.map(n,a)}function h(e){var t=l(e);if(t)switch(t.kind){case 202:case 203:case 204:case 200:case 201:return y(t);case 209:return v(t)}}function v(t){var n=[];return p(n,t.getFirstToken(),96),e.forEach(t.caseBlock.clauses,function(r){p(n,r.getFirstToken(),71,77);var a=c(r);e.forEach(a,function(e){_(t,e)&&p(n,e.getFirstToken(),70)})}),e.map(n,a)}function k(t){var n=[];if(p(n,t.getFirstToken(),100),t.catchClause&&p(n,t.catchClause.getFirstToken(),72),t.finallyBlock){var r=e.findChildOfKind(t,85,u);p(n,r,85)}return e.map(n,a)}function b(t){var n=s(t);if(n){var r=[];return e.forEach(o(n),function(e){p(r,e.getFirstToken(),98)}),e.isFunctionBlock(n)&&e.forEachReturnStatement(n,function(e){p(r,e.getFirstToken(),94)}),e.map(r,a)}}function x(t){var r=e.getContainingFunction(t);if(r&&n(r.body,195)){var i=[];return e.forEachReturnStatement(r.body,function(e){p(i,e.getFirstToken(),94)}),e.forEach(o(r.body),function(e){p(i,e.getFirstToken(),98)}),e.map(i,a)}}function C(t){for(var r=[];n(t.parent,199)&&t.parent.elseStatement===t;)t=t.parent;for(;t;){var i=t.getChildren();p(r,i[0],88);for(var o=i.length-1;o>=0&&!p(r,i[o],80);o--);if(!n(t.elseStatement,199))break;t=t.elseStatement}for(var s=[],o=0;o<r.length;o++){if(80===r[o].kind&&o<r.length-1){for(var c=r[o],_=r[o+1],l=!0,d=_.getStart()-1;d>=c.end;d--)if(!e.isWhiteSpace(u.text.charCodeAt(d))){l=!1;break}if(l){s.push({fileName:D,textSpan:e.createTextSpanFromBounds(c.getStart(),_.end),kind:G.reference}),o++;continue}}s.push(a(r[o]))}return s}var D=u.fileName,S=i(t);return S&&0!==S.length?[{fileName:D,highlightSpans:S}]:void 0}s(),r=e.map(r,e.normalizeSlashes);var _=e.filter(Ge.getSourceFiles(),function(t){return e.contains(r,t.fileName)}),u=i(t),l=e.getTouchingWord(u,n);return l?o(l)||c(l):void 0}function re(e,t){function n(e){if(e){for(var t=[],n=0,r=e;n<r.length;n++)for(var a=r[n],i=0,o=a.highlightSpans;i<o.length;i++){var s=o[i];t.push({fileName:a.fileName,textSpan:s.textSpan,isWriteAccess:s.kind===G.writtenReference})}return t}}return s(),n(ne(e,t,[e]))}function ie(t){if(t){for(var n=[],r=0,a=t;r<a.length;r++){var i=a[r];e.addRange(n,i.references)}return n}}function se(e,t,n,r){var a=ue(e,t,n,r);return ie(a)}function ce(e,t){var n=ue(e,t,!1,!1);return ie(n)}function _e(t,n){var r=ue(t,n,!1,!1);return e.filter(r,function(e){return!!e.definition})}function ue(t,n,r,a){s();var o=i(t),c=e.getTouchingPropertyName(o,n);return c&&(69===c.kind||S(c)||T(c))?(e.Debug.assert(69===c.kind||8===c.kind||9===c.kind),le(c,Ge.getSourceFiles(),r,a)):void 0}function le(t,n,r,a){function i(n){var r=J(n,t.getSourceFile(),w(t),t),a=e.map(r.displayParts,function(e){return e.text}).join(""),i=n.declarations;return i&&0!==i.length?{containerKind:"",containerName:"",name:a,kind:r.symbolKind,fileName:i[0].getSourceFile().fileName,textSpan:e.createTextSpan(i[0].getStart(),0)}:void 0}function o(t){return 8388608&t.flags&&!!e.getDeclarationOfKind(t,229)}function s(t,n,r){if(e.isImportOrExportSpecifierName(n))return n.getText();var a=e.getLocalSymbolForExportDefault(t);return t=a||t,e.stripQuotes(t.name)}function c(t){var n=t.valueDeclaration;if(n&&(176===n.kind||189===n.kind))return n;if(8196&t.flags){var r=e.forEach(t.getDeclarations(),function(e){return 16&e.flags?e:void 0});if(r)return e.getAncestor(r,217)}if(!(8388608&t.flags||t.parent||268435456&t.flags)){var a,i=t.getDeclarations();if(i)for(var o=0,s=i;o<s.length;o++){var c=s[o],_=w(c);if(!_)return;if(a&&a!==_)return;if(251===_.kind&&!e.isExternalModule(_))return;a=_}return a}}function _(t,n,r,a){var i=[];if(!n||!n.length)return i;for(var o=t.text,s=o.length,c=n.length,_=o.indexOf(n,r);_>=0&&($e.throwIfCancellationRequested(),!(_>a));){var u=_+c;0!==_&&e.isIdentifierPart(o.charCodeAt(_-1),2)||u!==s&&e.isIdentifierPart(o.charCodeAt(u),2)||i.push(_),_=o.indexOf(n,_+c+1)}return i}function u(t,n){var r=[],a=t.getSourceFile(),i=n.text,o=_(a,i,t.getStart(),t.getEnd());e.forEach(o,function(t){$e.throwIfCancellationRequested();var o=e.getTouchingWord(a,t);o&&o.getWidth()===i.length&&(o===n||f(o)&&p(o,i)===n)&&r.push(de(o))});var s={containerKind:"",containerName:"",fileName:n.getSourceFile().fileName,kind:Q.label,name:i,textSpan:e.createTextSpanFromBounds(n.getStart(),n.getEnd())};return[{definition:s,references:r}]}function l(e,t){if(e)switch(e.kind){case 69:return e.getWidth()===t.length;case 9:if(S(e)||T(e))return e.getWidth()===t.length+2;break;case 8:if(S(e))return e.getWidth()===t.length}return!1}function d(t,n,r,a,o,s,c,u,d){function p(t){var n=e.getSymbolId(t),r=d[n];return void 0===r&&(r=u.length,d[n]=r,u.push({definition:i(t),references:[]})),u[r]}function f(t,n){function r(e){var n=t.text.substring(e.pos,e.end);return!g.test(n)}return e.isInCommentHelper(t,n,r)}var m=t.getSourceFile(),g=/^\/\/\/\s*</,y=_(m,r,t.getStart(),t.getEnd());if(y.length){var v=h(n,a);e.forEach(y,function(t){$e.throwIfCancellationRequested();var n=e.getTouchingPropertyName(m,t);if(!l(n,r))return void((s&&e.isInString(m,t)||c&&f(m,t))&&u.push({definition:void 0,references:[{fileName:m.fileName,textSpan:e.createTextSpan(t,r.length),isWriteAccess:!1}]}));if(Ce(n)&o){var a=C.getSymbolAtLocation(n);if(a){var i=a.valueDeclaration,_=C.getShorthandAssignmentValueSymbol(i),d=k(v,a,n);if(d){var g=p(d);g.references.push(de(n))}else if(!(67108864&a.flags)&&v.indexOf(_)>=0){var g=p(_);g.references.push(de(i.name))}}}})}}function m(t){var n=e.getSuperContainer(t,!1);if(n){var r=64;switch(n.kind){case 142:case 141:case 144:case 143:case 145:case 146:case 147:r&=n.flags,n=n.parent;break;default:return}var a=[],o=n.getSourceFile(),s=_(o,"super",n.getStart(),n.getEnd());e.forEach(s,function(t){$e.throwIfCancellationRequested();var i=e.getTouchingWord(o,t);if(i&&95===i.kind){var s=e.getSuperContainer(i,!1);s&&(64&s.flags)===r&&s.parent.symbol===n.symbol&&a.push(de(i))}});var c=i(n.symbol);return[{definition:c,references:a}]}}function g(n,r){function a(t,n,r,a){e.forEach(r,function(r){$e.throwIfCancellationRequested();var i=e.getTouchingWord(t,r);if(i&&(97===i.kind||162===i.kind)){var s=e.getThisContainer(i,!1);switch(n.kind){case 176:case 216:n.symbol===s.symbol&&a.push(de(i));break;case 144:case 143:e.isObjectLiteralMethod(n)&&n.symbol===s.symbol&&a.push(de(i));break;case 189:case 217:s.parent&&n.symbol===s.parent.symbol&&(64&s.flags)===o&&a.push(de(i));break;case 251:251!==s.kind||e.isExternalModule(s)||a.push(de(i))}}})}var i=e.getThisContainer(n,!1),o=64;switch(i.kind){case 144:case 143:if(e.isObjectLiteralMethod(i))break;case 142:case 141:case 145:case 146:case 147:o&=i.flags,i=i.parent;break;case 251:if(e.isExternalModule(i))return;case 216:case 176:break;default:return}var s,c=[];if(251===i.kind)e.forEach(r,function(e){s=_(e,"this",e.getStart(),e.getEnd()),a(e,e,s,c)});else{var u=i.getSourceFile();s=_(u,"this",i.getStart(),i.getEnd()),a(u,i,s,c)}return[{definition:{containerKind:"",containerName:"",fileName:t.getSourceFile().fileName,kind:Q.variableElement,name:"this",textSpan:e.createTextSpanFromBounds(t.getStart(),t.getEnd())},references:c}]}function h(t,n){var r=[t];if(o(t)&&r.push(C.getAliasedSymbol(t)),233===n.parent.kind&&r.push(C.getExportSpecifierLocalTargetSymbol(n.parent)),D(n)){e.forEach(b(n),function(t){e.addRange(r,C.getRootSymbols(t))});var a=C.getShorthandAssignmentValueSymbol(n.parent);a&&r.push(a)}return t.valueDeclaration&&139===t.valueDeclaration.kind&&e.isParameterPropertyDeclaration(t.valueDeclaration)&&(r=r.concat(C.getSymbolsOfParameterPropertyDeclaration(t.valueDeclaration,t.name))),e.forEach(C.getRootSymbols(t),function(e){e!==t&&r.push(e),e.parent&&96&e.parent.flags&&v(e.parent,e.getName(),r,{})}),r}function v(t,n,r,a){function i(e){if(e){var i=C.getTypeAtLocation(e);if(i){var o=C.getPropertyOfType(i,n);o&&r.push(o),a[t.name]=t,v(i.symbol,n,r,a)}}}t&&(e.hasProperty(a,t.name)||96&t.flags&&e.forEach(t.getDeclarations(),function(t){217===t.kind?(i(e.getClassExtendsHeritageClauseElement(t)),e.forEach(e.getClassImplementsHeritageClauseElements(t),i)):218===t.kind&&e.forEach(e.getInterfaceBaseTypeNodes(t),i)}))}function k(t,n,r){if(t.indexOf(n)>=0)return n;if(o(n)){var a=C.getAliasedSymbol(n);if(t.indexOf(a)>=0)return a}if(233===r.parent.kind){var a=C.getExportSpecifierLocalTargetSymbol(r.parent);if(t.indexOf(a)>=0)return a}return D(r)?e.forEach(b(r),function(n){return e.forEach(C.getRootSymbols(n),function(e){return t.indexOf(e)>=0?e:void 0})}):e.forEach(C.getRootSymbols(n),function(n){if(t.indexOf(n)>=0)return n;if(n.parent&&96&n.parent.flags){var r=[];return v(n.parent,n.getName(),r,{}),e.forEach(r,function(e){return t.indexOf(e)>=0?e:void 0})}})}function b(t){if(D(t)){var n=t.parent.parent,r=C.getContextualType(n),a=t.text;if(r){if(16384&r.flags){var i=r.getProperty(a);if(i)return[i];var o=[];return e.forEach(r.types,function(e){var t=e.getProperty(a);t&&o.push(t)}),o}var s=r.getProperty(a);if(s)return[s]}}}function x(e,t){if(t){var n=void 0;do{n=e;for(var r=0,a=t;r<a.length;r++){var i=a[r],o=ge(i);o&e&&(e|=o)}}while(e!==n)}return e}var C=Ge.getTypeChecker();if(y(t)){if(f(t)){var E=p(t.parent,t.text);return E?u(E.parent,E):void 0}return u(t.parent,t)}if(97===t.kind||162===t.kind)return g(t,n);if(95===t.kind)return m(t);var A=C.getSymbolAtLocation(t);if(A){var P=A.declarations;if(P&&P.length){var O,R=x(Ce(t),P),I=e.stripQuotes(e.getDeclaredName(C,A,t)),F=c(A),L=[];if(F)O=[],d(F,A,I,t,R,r,a,O,L);else for(var M=s(A,t,P),B=0,z=n;B<z.length;B++){var K=z[B];$e.throwIfCancellationRequested();var j=N(K);void 0!==e.lookUp(j,M)&&(O=O||[],d(K,A,I,t,R,r,a,O,L))}return O}}}function de(t){var n=t.getStart(),r=t.getEnd();return 9===t.kind&&(n+=1,r-=1),{fileName:t.getSourceFile().fileName,textSpan:e.createTextSpanFromBounds(n,r),isWriteAccess:pe(t)}}function pe(t){if(69===t.kind&&e.isDeclarationName(t))return!0;var n=t.parent;if(n){if(183===n.kind||182===n.kind)return!0;if(184===n.kind&&n.left===t){var r=n.operatorToken.kind;return r>=56&&68>=r}}return!1}function fe(t,n){return s(),e.NavigateTo.getNavigateToItems(Ge,$e,t,n)}function me(e){function t(e,t,n){r.push({name:e,writeByteOrderMark:n,text:t})}s();var n=i(e),r=[],a=Ge.emit(n,t,$e);return{outputFiles:r,emitSkipped:a.emitSkipped}}function ge(t){switch(t.kind){case 139:case 214:case 166:case 142:case 141:case 248:case 249:case 250:case 144:case 143:case 145:case 146:case 147:case 216:case 176:case 177:case 247:return 1;case 138:case 218:case 219:case 156:return 2;case 217:case 220:return 3;case 221:return e.isAmbientModule(t)?5:1===e.getModuleInstanceState(t)?5:4;case 228:case 229:case 224:case 225:case 230:case 231:return 7;case 251:return 5}return 7}function ye(t){return e.isRightSideOfQualifiedNameOrPropertyAccess(t)&&(t=t.parent),152===t.parent.kind||191===t.parent.kind&&!e.isExpressionWithTypeArgumentsInClassExtendsClause(t.parent)||97===t.kind&&!e.isExpression(t)||162===t.kind}function he(e){return ke(e)||ve(e)}function ve(e){var t=e,n=!0;if(169===t.parent.kind){for(;t.parent&&169===t.parent.kind;)t=t.parent;n=t.name===e}if(!n&&191===t.parent.kind&&246===t.parent.parent.kind){var r=t.parent.parent.parent;return 217===r.kind&&106===t.parent.parent.token||218===r.kind&&83===t.parent.parent.token}return!1}function ke(e){var t=e,n=!0;if(136===t.parent.kind){for(;t.parent&&136===t.parent.kind;)t=t.parent;n=t.right===e}return 152===t.parent.kind&&!n}function be(t){for(;136===t.parent.kind;)t=t.parent;return e.isInternalModuleImportEqualsDeclaration(t.parent)&&t.parent.moduleReference===t}function xe(t){return e.Debug.assert(69===t.kind),136===t.parent.kind&&t.parent.right===t&&224===t.parent.parent.kind?7:4}function Ce(t){return 230===t.parent.kind?7:be(t)?xe(t):e.isDeclarationName(t)?ge(t.parent):ye(t)?2:he(t)?4:1}function De(t,n){s();var r=i(t);return e.SignatureHelp.getSignatureHelpItems(Ge,r,n,$e)}function Se(e){return Qe.getCurrentSourceFile(e)}function Te(t,n,r){var a=Qe.getCurrentSourceFile(t),i=e.getTouchingPropertyName(a,n);if(i){switch(i.kind){case 169:case 136:case 9:case 163:case 84:case 99:case 93:case 95:case 97:case 162:case 69:break;default:return}for(var o=i;;)if(v(o)||h(o))o=o.parent;else{if(!x(o))break;if(221!==o.parent.parent.kind||o.parent.parent.body!==o.parent)break;o=o.parent.parent.name}return e.createTextSpanFromBounds(o.getStart(),i.getEnd())}}function Ee(t,n){var r=Qe.getCurrentSourceFile(t);return e.BreakpointResolver.spanInSourceFileAtLocation(r,n)}function we(n){var r=Qe.getCurrentSourceFile(n);return e.NavigationBar.getNavigationBarItems(r,t.getCompilationSettings())}function Ae(e,t){return Re(Ne(e,t))}function Pe(e){switch(e){case 221:case 217:case 218:case 216:$e.throwIfCancellationRequested()}}function Ne(t,n){function r(e,t,n){u.push(e),u.push(t),u.push(n)}function a(t,n){function r(t){return e.forEach(t.declarations,function(t){return 221===t.kind&&1===e.getModuleInstanceState(t)})}var a=t.getFlags();if(0!==(788448&a)){if(32&a)return 11;if(384&a)return 12;if(524288&a)return 16;if(2&n){if(64&a)return 13;if(262144&a)return 15}else if(1536&a&&(4&n||1&n&&r(t)))return 14}}function o(t){if(t&&e.textSpanIntersectsWith(n,t.getFullStart(),t.getFullWidth())){var i=t.kind;if(Pe(i),69===i&&!e.nodeIsMissing(t)){var s=t;if(l[s.text]){var c=_.getSymbolAtLocation(t);if(c){var u=a(c,Ce(t));u&&r(t.getStart(),t.getWidth(),u)}}}e.forEachChild(t,o)}}s();var c=i(t),_=Ge.getTypeChecker(),u=[],l=Ge.getClassifiableNames();return o(c),{spans:u,endOfLineState:0}}function Oe(e){switch(e){case 1:return Z.comment;case 2:return Z.identifier;case 3:return Z.keyword;case 4:return Z.numericLiteral;case 5:return Z.operator;case 6:return Z.stringLiteral;case 8:return Z.whiteSpace;case 9:return Z.text;case 10:return Z.punctuation;case 11:return Z.className;case 12:return Z.enumName;case 13:return Z.interfaceName;case 14:return Z.moduleName;case 15:return Z.typeParameterName;case 16:return Z.typeAliasName;case 17:return Z.parameterName;case 18:return Z.docCommentTagName;case 19:return Z.jsxOpenTagName;case 20:return Z.jsxCloseTagName;case 21:return Z.jsxSelfClosingTagName;case 22:return Z.jsxAttribute;case 23:return Z.jsxText;case 24:return Z.jsxAttributeStringLiteralValue}}function Re(t){e.Debug.assert(t.spans.length%3===0);for(var n=t.spans,r=[],a=0,i=n.length;i>a;a+=3)r.push({textSpan:e.createTextSpan(n[a],n[a+1]),classificationType:Oe(n[a+2])});return r}function Ie(e,t){return Re(Fe(e,t))}function Fe(t,n){function r(e,t,n){k.push(e),k.push(t),k.push(n)}function a(t){for(h.setTextPos(t.pos);;){var n=h.getTextPos();if(!e.couldStartTrivia(m.text,n))return n;var a=h.scan(),o=h.getTextPos(),s=o-n;if(!e.isTrivia(a))return n;if(4!==a&&5!==a)if(e.isComment(a))i(t,a,n,s),h.setTextPos(o);else if(7===a){var c=m.text,u=c.charCodeAt(n);if(60===u||62===u){r(n,s,1);continue}e.Debug.assert(61===u),_(c,n,o)}}}function i(t,n,r,a){if(3===n){var i=e.parseIsolatedJSDocComment(m.text,r,a);if(i&&i.jsDocComment)return i.jsDocComment.parent=t,void s(i.jsDocComment)}o(r,a)}function o(e,t){r(e,t,1)}function s(e){function t(e){e.preParameterName&&(o(n,e.preParameterName.pos-n),r(e.preParameterName.pos,e.preParameterName.end-e.preParameterName.pos,17),n=e.preParameterName.end),e.typeExpression&&(o(n,e.typeExpression.pos-n),f(e.typeExpression),n=e.typeExpression.end),e.postParameterName&&(o(n,e.postParameterName.pos-n),r(e.postParameterName.pos,e.postParameterName.end-e.postParameterName.pos,17),n=e.postParameterName.end)}for(var n=e.pos,a=0,i=e.tags;a<i.length;a++){var s=i[a];switch(s.pos!==n&&o(n,s.pos-n),r(s.atToken.pos,s.atToken.end-s.atToken.pos,10),r(s.tagName.pos,s.tagName.end-s.tagName.pos,18),n=s.tagName.end,s.kind){case 270:t(s);break;case 273:c(s);break;case 272:f(s.typeExpression);break;case 271:f(s.typeExpression)}n=s.end}n!==e.end&&o(n,e.end-n)}function c(e){for(var t=0,n=e.getChildren();t<n.length;t++){var r=n[t];f(r)}}function _(t,n,a){var i;for(i=n;a>i&&!e.isLineBreak(t.charCodeAt(i));i++);for(r(n,i-n,1),v.setTextPos(i);v.getTextPos()<a;)u()}function u(){var e=v.getTextPos(),t=v.scan(),n=v.getTextPos(),a=p(t);a&&r(e,n-e,a)}function l(t){if(e.nodeIsMissing(t))return!0;var n=d(t);if(!e.isToken(t)&&239!==t.kind&&void 0===n)return!1;var i=239===t.kind?t.pos:a(t),o=t.end-i;if(e.Debug.assert(o>=0),o>0){var s=n||p(t.kind,t);s&&r(i,o,s)}return!0}function d(e){switch(e.parent&&e.parent.kind){case 238:if(e.parent.tagName===e)return 19;break;case 240:if(e.parent.tagName===e)return 20;break;case 237:if(e.parent.tagName===e)return 21;break;case 241:if(e.parent.name===e)return 22}}function p(t,n){if(e.isKeyword(t))return 3;if((25===t||27===t)&&n&&e.getTypeArgumentOrTypeParameterList(n.parent))return 10;if(e.isPunctuation(t)){if(n){if(56===t&&(214===n.parent.kind||142===n.parent.kind||139===n.parent.kind||241===n.parent.kind))return 5;if(184===n.parent.kind||182===n.parent.kind||183===n.parent.kind||185===n.parent.kind)return 5}return 10}if(8===t)return 4;if(9===t||163===t)return 241===n.parent.kind?24:6;if(10===t)return 6;if(e.isTemplateLiteralKind(t))return 6;if(239===t)return 23;if(69===t){if(n)switch(n.parent.kind){case 217:if(n.parent.name===n)return 11;return;case 138:if(n.parent.name===n)return 15;return;case 218:if(n.parent.name===n)return 13;return;case 220:if(n.parent.name===n)return 12;return;case 221:if(n.parent.name===n)return 14;return;case 139:if(n.parent.name===n)return 17;return}return 2}}function f(t){if(t&&e.decodedTextSpanIntersectsWith(g,y,t.pos,t.getFullWidth())){Pe(t.kind);for(var n=t.getChildren(m),r=0,a=n.length;a>r;r++){var i=n[r];l(i)||f(i)}}}var m=Qe.getCurrentSourceFile(t),g=n.start,y=n.length,h=e.createScanner(2,!1,m.languageVariant,m.text),v=e.createScanner(2,!1,m.languageVariant,m.text),k=[];return f(m),{spans:k,endOfLineState:0}}function Le(t){var n=Qe.getCurrentSourceFile(t);return e.OutliningElementsCollector.collectElements(n)}function Me(t,n){function r(e){switch(e.kind){case 15:return 16;case 17:return 18;case 19:return 20;case 25:return 27;case 16:return 15;case 18:return 17;case 20:return 19;case 27:return 25}}var a=Qe.getCurrentSourceFile(t),i=[],o=e.getTouchingToken(a,n);if(o.getStart(a)===n){var s=r(o);if(s)for(var c=o.parent,_=c.getChildren(a),u=0,l=_;u<l.length;u++){var d=l[u];if(d.kind===s){var p=e.createTextSpan(o.getStart(a),o.getWidth(a)),f=e.createTextSpan(d.getStart(a),d.getWidth(a));p.start<f.start?i.push(p,f):i.push(f,p);break}}}return i}function Be(t,n,a){var i=(new Date).getTime(),o=Qe.getCurrentSourceFile(t);r("getIndentationAtPosition: getCurrentSourceFile: "+((new Date).getTime()-i)),i=(new Date).getTime();var s=e.formatting.SmartIndenter.getIndentation(n,o,a);return r("getIndentationAtPosition: computeIndentation : "+((new Date).getTime()-i)),s}function ze(t,n,r,a){var i=Qe.getCurrentSourceFile(t);return e.formatting.formatSelection(n,r,i,o(a),a)}function Ke(t,n){var r=Qe.getCurrentSourceFile(t);return e.formatting.formatDocument(r,o(n),n)}function je(t,n,r,a){var i=Qe.getCurrentSourceFile(t);return"}"===r?e.formatting.formatOnClosingCurly(n,i,o(a),a):";"===r?e.formatting.formatOnSemicolon(n,i,o(a),a):"\n"===r?e.formatting.formatOnEnter(n,i,o(a),a):[]}function Je(n,r){var a=Qe.getCurrentSourceFile(n);if(!(e.isInString(a,r)||e.isInComment(a,r)||e.hasDocComment(a,r))){var i=e.getTokenAtPosition(a,r),o=i.getStart();if(i&&!(r>o)){var s;e:for(s=i;s;s=s.parent)switch(s.kind){case 216:case 144:case 145:case 217:case 196:break e;case 251:return;case 221:if(221===s.parent.kind)return;break e}if(s&&!(s.getStart()<r)){for(var c=Ue(s),_=a.getLineAndCharacterOfPosition(r),u=a.getLineStarts()[_.line],l=a.text.substr(u,_.character),d=e.getNewLineOrDefaultFromHost(t),p="",f=0,m=c.length;m>f;f++){var g=c[f].name,y=69===g.kind?g.text:"param"+f;p+=l+" * @param "+y+d}var h="/**"+d+l+" * ",v=h+d+p+l+" */"+(o===r?d+l:"");return{newText:v,caretOffset:h.length}}}}}function Ue(t){if(e.isFunctionLike(t))return t.parameters;if(196===t.kind){var n=t,r=n.declarationList.declarations;if(1===r.length&&r[0].initializer)return qe(r[0].initializer)}return K}function qe(e){for(;175===e.kind;)e=e.expression;switch(e.kind){case 176:case 177:return e.parameters;case 189:for(var t=0,n=e.members;t<n.length;t++){var r=n[t];if(145===r.kind)return r.parameters}}return K}function We(t,n){function r(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}function a(){var t=/(?:\/\/+\s*)/.source,a=/(?:\/\*+\s*)/.source,i=/(?:^(?:\s|\*)*)/.source,o="("+i+"|"+t+"|"+a+")",s="(?:"+e.map(n,function(e){return"("+r(e.text)+")"}).join("|")+")",c=/(?:$|\*\/)/.source,_=/(?:.*?)/.source,u="("+s+_+")",l=o+u+c;return new RegExp(l,"gim")}function o(e){return e>=97&&122>=e||e>=65&&90>=e||e>=48&&57>=e}s();var c=i(t);$e.throwIfCancellationRequested();var _=c.text,u=[];if(n.length>0)for(var l=a(),d=void 0;d=l.exec(_);){$e.throwIfCancellationRequested();var p=3;e.Debug.assert(d.length===n.length+p);var f=d[1],m=d.index+f.length,g=e.getTokenAtPosition(c,m);if(E(c,g,m)){for(var y=void 0,h=0,v=n.length;v>h;h++)d[h+p]&&(y=n[h]);if(e.Debug.assert(void 0!==y),!o(_.charCodeAt(m+y.text.length))){var k=d[2];u.push({descriptor:y,message:k,position:m})}}}return u}function Ve(n,r){function a(e){return{canRename:!1,localizedErrorMessage:e,displayName:void 0,fullDisplayName:void 0,kind:void 0,kindModifiers:void 0,triggerSpan:void 0}}s();var o=i(n),c=Ge.getTypeChecker(),_=e.getTouchingWord(o,r);if(_&&69===_.kind){var u=c.getSymbolAtLocation(_);if(u){var l=u.getDeclarations();if(l&&l.length>0){var d=t.getDefaultLibFileName(t.getCompilationSettings()),p=et(e.normalizePath(d));if(d)for(var f=0,m=l;f<m.length;f++){var g=m[f],y=g.getSourceFile();if(y){var h=et(e.normalizePath(y.fileName));if(h===p)return a(e.getLocaleSpecificMessage(e.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library))}}var v=e.stripQuotes(e.getDeclaredName(c,u,_)),k=L(u,_);if(k)return{canRename:!0,kind:k,displayName:v,localizedErrorMessage:void 0,fullDisplayName:c.getFullyQualifiedName(u),kindModifiers:z(u),triggerSpan:e.createTextSpan(_.getStart(),_.getWidth())}}}}return a(e.getLocaleSpecificMessage(e.Diagnostics.You_cannot_rename_this_element))}void 0===n&&(n=l(t.useCaseSensitiveFileNames&&t.useCaseSensitiveFileNames(),t.getCurrentDirectory()));var He,Ge,Xe,Qe=new te(t),Ye=!1,$e=new oe(t.getCancellationToken&&t.getCancellationToken()),Ze=t.getCurrentDirectory();!e.localizedDiagnosticMessages&&t.getLocalizedDiagnosticMessages&&(e.localizedDiagnosticMessages=t.getLocalizedDiagnosticMessages());var et=e.createGetCanonicalFileName(Ye);return{dispose:u,cleanupSemanticCache:_,getSyntacticDiagnostics:d,getSemanticDiagnostics:m,getCompilerOptionsDiagnostics:A,getSyntacticClassifications:Ie,getSemanticClassifications:Ae,getEncodedSyntacticClassifications:Fe,getEncodedSemanticClassifications:Ne,getCompletionsAtPosition:I,getCompletionEntryDetails:F,getSignatureHelpItems:De,getQuickInfoAtPosition:U,getDefinitionAtPosition:V,getTypeDefinitionAtPosition:H,getReferencesAtPosition:ce,findReferences:_e,getOccurrencesAtPosition:Y,getDocumentHighlights:ne,getNameOrDottedNameSpan:Te,getBreakpointStatementAtPosition:Ee,getNavigateToItems:fe,getRenameInfo:Ve,findRenameLocations:se,getNavigationBarItems:we,getOutliningSpans:Le,getTodoComments:We,getBraceMatchingAtPosition:Me,getIndentationAtPosition:Be,getFormattingEditsForRange:ze,getFormattingEditsForDocument:Ke,getFormattingEditsAfterKeystroke:je,getDocCommentTemplateAtPosition:Je,getEmitOutput:me,getSourceFile:Se,getProgram:c}}function N(e){return e.nameTable||O(e),e.nameTable}function O(t){function n(t){switch(t.kind){case 69:r[t.text]=void 0===r[t.text]?t.pos:-1;break;case 9:case 8:(e.isDeclarationName(t)||235===t.parent.kind||R(t))&&(r[t.text]=void 0===r[t.text]?t.pos:-1);break;default:e.forEachChild(t,n)}}var r={};n(t),t.nameTable=r}function R(e){return e&&e.parent&&170===e.parent.kind&&e.parent.argumentExpression===e}function I(){function t(t,n){return e.isAccessibilityModifier(t)?123===n||129===n||121===n||113===n:!0}function n(e,t){for(var n=[],a=e.spans,i=0,o=0,s=a.length;s>o;o+=3){var c=a[o],_=a[o+1],u=a[o+2];if(i>=0){var l=c-i;l>0&&n.push({length:l,classification:Y.Whitespace})}n.push({length:_,classification:r(u)}),i=c+_}var d=t.length-i;return d>0&&n.push({length:d,classification:Y.Whitespace}),{entries:n,finalLexState:e.endOfLineState}}function r(e){switch(e){case 1:return Y.Comment;case 3:return Y.Keyword;case 4:return Y.NumberLiteral;case 5:return Y.Operator;case 6:return Y.StringLiteral;case 8:return Y.Whitespace;case 10:return Y.Punctuation;case 2:case 11:case 12:case 13:case 14:case 15:case 16:case 9:case 17:default:return Y.Identifier}}function a(e,t,r){return n(i(e,t,r),e)}function i(n,r,a){function i(){var t=u.getTokenPos(),r=u.getTextPos();if(o(t,r,_(p)),r>=n.length)if(9===p||163===p){var a=u.getTokenText();if(u.isUnterminated()){for(var i=a.length-1,s=0;92===a.charCodeAt(i-s);)s++;if(1&s){var c=a.charCodeAt(0);m.endOfLineState=34===c?3:2}}}else 3===p?u.isUnterminated()&&(m.endOfLineState=1):e.isTemplateLiteralKind(p)?u.isUnterminated()&&(14===p?m.endOfLineState=5:11===p?m.endOfLineState=4:e.Debug.fail("Only 'NoSubstitutionTemplateLiteral's and 'TemplateTail's can be unterminated; got SyntaxKind #"+p)):d.length>0&&12===e.lastOrUndefined(d)&&(m.endOfLineState=6)}function o(e,t,n){if(8!==n){0===e&&s>0&&(e+=s),e-=s,t-=s;var r=t-e;r>0&&(m.spans.push(e),m.spans.push(r),m.spans.push(n))}}for(var s=0,p=0,f=0;d.length>0;)d.pop();switch(r){case 3:n='"\\\n'+n,s=3;break;case 2:n="'\\\n"+n,s=3;break;case 1:n="/*\n"+n,s=3;break;case 4:n="`\n"+n,s=2;break;case 5:n="}\n"+n,s=2;case 6:d.push(12)}u.setText(n);var m={endOfLineState:0,
spans:[]},g=0;do{if(p=u.scan(),!e.isTrivia(p)){if(39!==p&&61!==p||l[f]){if(21===f&&c(p))p=69;else if(c(f)&&c(p)&&!t(f,p))p=69;else if(69===f&&25===p)g++;else if(27===p&&g>0)g--;else if(117===p||130===p||128===p||120===p||131===p)g>0&&!a&&(p=69);else if(12===p)d.push(p);else if(15===p)d.length>0&&d.push(p);else if(16===p&&d.length>0){var y=e.lastOrUndefined(d);12===y?(p=u.reScanTemplateToken(),14===p?d.pop():e.Debug.assert(13===p,"Should have been a template middle. Was "+p)):(e.Debug.assert(15===y,"Should have been an open brace. Was: "+p),d.pop())}}else 10===u.reScanSlashToken()&&(p=10);f=p}i()}while(1!==p);return m}function o(e){switch(e){case 37:case 39:case 40:case 35:case 36:case 43:case 44:case 45:case 25:case 27:case 28:case 29:case 91:case 90:case 116:case 30:case 31:case 32:case 33:case 46:case 48:case 47:case 51:case 52:case 67:case 66:case 68:case 63:case 64:case 65:case 57:case 58:case 59:case 61:case 62:case 56:case 24:return!0;default:return!1}}function s(e){switch(e){case 35:case 36:case 50:case 49:case 41:case 42:return!0;default:return!1}}function c(e){return e>=70&&135>=e}function _(t){if(c(t))return 3;if(o(t)||s(t))return 5;if(t>=15&&68>=t)return 10;switch(t){case 8:return 4;case 9:case 163:return 6;case 10:return 7;case 7:case 3:case 2:return 1;case 5:case 4:return 8;case 69:default:return e.isTemplateLiteralKind(t)?6:2}}var u=e.createScanner(2,!1),l=[];l[69]=!0,l[9]=!0,l[8]=!0,l[10]=!0,l[97]=!0,l[41]=!0,l[42]=!0,l[18]=!0,l[20]=!0,l[16]=!0,l[99]=!0,l[84]=!0;var d=[];return{getClassificationsForLine:a,getEncodedLexicalClassifications:i}}function F(t){if("undefined"!=typeof __dirname)return __dirname+e.directorySeparator+e.getDefaultLibFileName(t);throw new Error("getDefaultLibFilePath is only supported when consumed as a node module. ")}function L(){e.objectAllocator={getNodeConstructor:function(){return J},getSourceFileConstructor:function(){return V},getSymbolConstructor:function(){return U},getTypeConstructor:function(){return q},getSignatureConstructor:function(){return W}}}e.servicesVersion="0.5";var M;!function(e){function t(e){return new n(e)}var n=function(){function e(e){this.text=e}return e.prototype.getText=function(e,t){return this.text.substring(e,t)},e.prototype.getLength=function(){return this.text.length},e.prototype.getChangeRange=function(e){},e}();e.fromString=t}(M=e.ScriptSnapshot||(e.ScriptSnapshot={}));var B,z=e.createScanner(2,!0),K=[],j=["augments","author","argument","borrows","class","constant","constructor","constructs","default","deprecated","description","event","example","extends","field","fileOverview","function","ignore","inner","lends","link","memberOf","name","namespace","param","private","property","public","requires","returns","see","since","static","throws","type","version"],J=function(){function n(e,t,n){this.kind=e,this.pos=t,this.end=n,this.flags=0,this.parent=void 0}return n.prototype.getSourceFile=function(){return e.getSourceFileOfNode(this)},n.prototype.getStart=function(t){return e.getTokenPosOfNode(this,t)},n.prototype.getFullStart=function(){return this.pos},n.prototype.getEnd=function(){return this.end},n.prototype.getWidth=function(e){return this.getEnd()-this.getStart(e)},n.prototype.getFullWidth=function(){return this.end-this.pos},n.prototype.getLeadingTriviaWidth=function(e){return this.getStart(e)-this.pos},n.prototype.getFullText=function(e){return(e||this.getSourceFile()).text.substring(this.pos,this.end)},n.prototype.getText=function(e){return(e||this.getSourceFile()).text.substring(this.getStart(),this.getEnd())},n.prototype.addSyntheticNodes=function(e,n,r){for(z.setTextPos(n);r>n;){var a=z.scan(),i=z.getTextPos();e.push(t(a,n,i,2048,this)),n=i}return n},n.prototype.createSyntaxList=function(e){var n=t(274,e.pos,e.end,2048,this);n._children=[];for(var r=e.pos,a=0,i=e;a<i.length;a++){var o=i[a];r<o.pos&&(r=this.addSyntheticNodes(n._children,r,o.pos)),n._children.push(o),r=o.end}return r<e.end&&this.addSyntheticNodes(n._children,r,e.end),n},n.prototype.createChildren=function(t){var n,r=this;if(this.kind>=136){z.setText((t||this.getSourceFile()).text),n=[];var a=this.pos,i=function(e){a<e.pos&&(a=r.addSyntheticNodes(n,a,e.pos)),n.push(e),a=e.end},o=function(e){a<e.pos&&(a=r.addSyntheticNodes(n,a,e.pos)),n.push(r.createSyntaxList(e)),a=e.end};e.forEachChild(this,i,o),a<this.end&&this.addSyntheticNodes(n,a,this.end),z.setText(void 0)}this._children=n||K},n.prototype.getChildCount=function(e){return this._children||this.createChildren(e),this._children.length},n.prototype.getChildAt=function(e,t){return this._children||this.createChildren(t),this._children[e]},n.prototype.getChildren=function(e){return this._children||this.createChildren(e),this._children},n.prototype.getFirstToken=function(e){var t=this.getChildren(e);if(t.length){var n=t[0];return n.kind<136?n:n.getFirstToken(e)}},n.prototype.getLastToken=function(t){var n=this.getChildren(t),r=e.lastOrUndefined(n);return r?r.kind<136?r:r.getLastToken(t):void 0},n}(),U=function(){function e(e,t){this.flags=e,this.name=t}return e.prototype.getFlags=function(){return this.flags},e.prototype.getName=function(){return this.name},e.prototype.getDeclarations=function(){return this.declarations},e.prototype.getDocumentationComment=function(){return void 0===this.documentationComment&&(this.documentationComment=n(this.declarations,this.name,!(4&this.flags))),this.documentationComment},e}(),q=function(){function e(e,t){this.checker=e,this.flags=t}return e.prototype.getFlags=function(){return this.flags},e.prototype.getSymbol=function(){return this.symbol},e.prototype.getProperties=function(){return this.checker.getPropertiesOfType(this)},e.prototype.getProperty=function(e){return this.checker.getPropertyOfType(this,e)},e.prototype.getApparentProperties=function(){return this.checker.getAugmentedPropertiesOfType(this)},e.prototype.getCallSignatures=function(){return this.checker.getSignaturesOfType(this,0)},e.prototype.getConstructSignatures=function(){return this.checker.getSignaturesOfType(this,1)},e.prototype.getStringIndexType=function(){return this.checker.getIndexTypeOfType(this,0)},e.prototype.getNumberIndexType=function(){return this.checker.getIndexTypeOfType(this,1)},e.prototype.getBaseTypes=function(){return 3072&this.flags?this.checker.getBaseTypes(this):void 0},e}(),W=function(){function e(e){this.checker=e}return e.prototype.getDeclaration=function(){return this.declaration},e.prototype.getTypeParameters=function(){return this.typeParameters},e.prototype.getParameters=function(){return this.parameters},e.prototype.getReturnType=function(){return this.checker.getReturnTypeOfSignature(this)},e.prototype.getDocumentationComment=function(){return void 0===this.documentationComment&&(this.documentationComment=this.declaration?n([this.declaration],void 0,!1):[]),this.documentationComment},e}(),V=function(t){function n(e,n,r){t.call(this,e,n,r)}return __extends(n,t),n.prototype.update=function(t,n){return e.updateSourceFile(this,t,n)},n.prototype.getLineAndCharacterOfPosition=function(t){return e.getLineAndCharacterOfPosition(this,t)},n.prototype.getLineStarts=function(){return e.getLineStarts(this)},n.prototype.getPositionOfLineAndCharacter=function(t,n){return e.getPositionOfLineAndCharacter(this,t,n)},n.prototype.getNamedDeclarations=function(){return this.namedDeclarations||(this.namedDeclarations=this.computeNamedDeclarations()),this.namedDeclarations},n.prototype.computeNamedDeclarations=function(){function t(e){var t=r(e);if(t){var a=n(t);a.push(e)}}function n(t){return e.getProperty(o,t)||(o[t]=[])}function r(e){if(e.name){var t=a(e.name);if(void 0!==t)return t;if(137===e.name.kind){var n=e.name.expression;return 169===n.kind?n.name.text:a(n)}}}function a(e){return!e||69!==e.kind&&9!==e.kind&&8!==e.kind?void 0:e.text}function i(a){switch(a.kind){case 216:case 144:case 143:var o=a,s=r(o);if(s){var c=n(s),_=e.lastOrUndefined(c);_&&o.parent===_.parent&&o.symbol===_.symbol?o.body&&!_.body&&(c[c.length-1]=o):c.push(o),e.forEachChild(a,i)}break;case 217:case 218:case 219:case 220:case 221:case 224:case 233:case 229:case 224:case 226:case 227:case 146:case 147:case 156:t(a);case 145:case 196:case 215:case 164:case 165:case 222:e.forEachChild(a,i);break;case 195:e.isFunctionBlock(a)&&e.forEachChild(a,i);break;case 139:if(!(56&a.flags))break;case 214:case 166:if(e.isBindingPattern(a.name)){e.forEachChild(a.name,i);break}case 250:case 142:case 141:t(a);break;case 231:a.exportClause&&e.forEach(a.exportClause.elements,i);break;case 225:var u=a.importClause;u&&(u.name&&t(u),u.namedBindings&&(227===u.namedBindings.kind?t(u.namedBindings):e.forEach(u.namedBindings.elements,i)))}}var o={};return e.forEachChild(this,i),o},n}(J),H=function(){function e(){}return e}();e.TextChange=H;var G;!function(e){e.none="none",e.definition="definition",e.reference="reference",e.writtenReference="writtenReference"}(G=e.HighlightSpanKind||(e.HighlightSpanKind={})),function(e){e[e.None=0]="None",e[e.Block=1]="Block",e[e.Smart=2]="Smart"}(e.IndentStyle||(e.IndentStyle={}));e.IndentStyle;!function(e){e[e.aliasName=0]="aliasName",e[e.className=1]="className",e[e.enumName=2]="enumName",e[e.fieldName=3]="fieldName",e[e.interfaceName=4]="interfaceName",e[e.keyword=5]="keyword",e[e.lineBreak=6]="lineBreak",e[e.numericLiteral=7]="numericLiteral",e[e.stringLiteral=8]="stringLiteral",e[e.localName=9]="localName",e[e.methodName=10]="methodName",e[e.moduleName=11]="moduleName",e[e.operator=12]="operator",e[e.parameterName=13]="parameterName",e[e.propertyName=14]="propertyName",e[e.punctuation=15]="punctuation",e[e.space=16]="space",e[e.text=17]="text",e[e.typeParameterName=18]="typeParameterName",e[e.enumMemberName=19]="enumMemberName",e[e.functionName=20]="functionName",e[e.regularExpressionLiteral=21]="regularExpressionLiteral"}(e.SymbolDisplayPartKind||(e.SymbolDisplayPartKind={}));var X=e.SymbolDisplayPartKind;!function(e){e[e.JavaScript=0]="JavaScript",e[e.SourceMap=1]="SourceMap",e[e.Declaration=2]="Declaration"}(e.OutputFileType||(e.OutputFileType={}));e.OutputFileType;!function(e){e[e.None=0]="None",e[e.InMultiLineCommentTrivia=1]="InMultiLineCommentTrivia",e[e.InSingleQuoteStringLiteral=2]="InSingleQuoteStringLiteral",e[e.InDoubleQuoteStringLiteral=3]="InDoubleQuoteStringLiteral",e[e.InTemplateHeadOrNoSubstitutionTemplate=4]="InTemplateHeadOrNoSubstitutionTemplate",e[e.InTemplateMiddleOrTail=5]="InTemplateMiddleOrTail",e[e.InTemplateSubstitutionPosition=6]="InTemplateSubstitutionPosition"}(e.EndOfLineState||(e.EndOfLineState={}));e.EndOfLineState;!function(e){e[e.Punctuation=0]="Punctuation",e[e.Keyword=1]="Keyword",e[e.Operator=2]="Operator",e[e.Comment=3]="Comment",e[e.Whitespace=4]="Whitespace",e[e.Identifier=5]="Identifier",e[e.NumberLiteral=6]="NumberLiteral",e[e.StringLiteral=7]="StringLiteral",e[e.RegExpLiteral=8]="RegExpLiteral"}(e.TokenClass||(e.TokenClass={}));var Q,Y=e.TokenClass;!function(e){e.unknown="",e.warning="warning",e.keyword="keyword",e.scriptElement="script",e.moduleElement="module",e.classElement="class",e.localClassElement="local class",e.interfaceElement="interface",e.typeElement="type",e.enumElement="enum",e.variableElement="var",e.localVariableElement="local var",e.functionElement="function",e.localFunctionElement="local function",e.memberFunctionElement="method",e.memberGetAccessorElement="getter",e.memberSetAccessorElement="setter",e.memberVariableElement="property",e.constructorImplementationElement="constructor",e.callSignatureElement="call",e.indexSignatureElement="index",e.constructSignatureElement="construct",e.parameterElement="parameter",e.typeParameterElement="type parameter",e.primitiveType="primitive type",e.label="label",e.alias="alias",e.constElement="const",e.letElement="let"}(Q=e.ScriptElementKind||(e.ScriptElementKind={}));var $;!function(e){e.none="",e.publicMemberModifier="public",e.privateMemberModifier="private",e.protectedMemberModifier="protected",e.exportedModifier="export",e.ambientModifier="declare",e.staticModifier="static",e.abstractModifier="abstract"}($=e.ScriptElementKindModifier||(e.ScriptElementKindModifier={}));var Z=function(){function e(){}return e.comment="comment",e.identifier="identifier",e.keyword="keyword",e.numericLiteral="number",e.operator="operator",e.stringLiteral="string",e.whiteSpace="whitespace",e.text="text",e.punctuation="punctuation",e.className="class name",e.enumName="enum name",e.interfaceName="interface name",e.moduleName="module name",e.typeParameterName="type parameter name",e.typeAliasName="type alias name",e.parameterName="parameter name",e.docCommentTagName="doc comment tag name",e.jsxOpenTagName="jsx open tag name",e.jsxCloseTagName="jsx close tag name",e.jsxSelfClosingTagName="jsx self closing tag name",e.jsxAttribute="jsx attribute",e.jsxText="jsx text",e.jsxAttributeStringLiteralValue="jsx attribute string literal value",e}();e.ClassificationTypeNames=Z,function(e){e[e.comment=1]="comment",e[e.identifier=2]="identifier",e[e.keyword=3]="keyword",e[e.numericLiteral=4]="numericLiteral",e[e.operator=5]="operator",e[e.stringLiteral=6]="stringLiteral",e[e.regularExpressionLiteral=7]="regularExpressionLiteral",e[e.whiteSpace=8]="whiteSpace",e[e.text=9]="text",e[e.punctuation=10]="punctuation",e[e.className=11]="className",e[e.enumName=12]="enumName",e[e.interfaceName=13]="interfaceName",e[e.moduleName=14]="moduleName",e[e.typeParameterName=15]="typeParameterName",e[e.typeAliasName=16]="typeAliasName",e[e.parameterName=17]="parameterName",e[e.docCommentTagName=18]="docCommentTagName",e[e.jsxOpenTagName=19]="jsxOpenTagName",e[e.jsxCloseTagName=20]="jsxCloseTagName",e[e.jsxSelfClosingTagName=21]="jsxSelfClosingTagName",e[e.jsxAttribute=22]="jsxAttribute",e[e.jsxText=23]="jsxText",e[e.jsxAttributeStringLiteralValue=24]="jsxAttributeStringLiteralValue"}(e.ClassificationType||(e.ClassificationType={}));e.ClassificationType;e.displayPartsToString=r,e.getDefaultCompilerOptions=i;var ee=function(){function t(t,n){this.host=t,this.getCanonicalFileName=n,this.currentDirectory=t.getCurrentDirectory(),this.fileNameToEntry=e.createFileMap();for(var r=t.getScriptFileNames(),a=0,o=r;a<o.length;a++){var s=o[a];this.createEntry(s,e.toPath(s,this.currentDirectory,n))}this._compilationSettings=t.getCompilationSettings()||i()}return t.prototype.compilationSettings=function(){return this._compilationSettings},t.prototype.createEntry=function(t,n){var r,a=this.host.getScriptSnapshot(t);return a&&(r={hostFileName:t,version:this.host.getScriptVersion(t),scriptSnapshot:a,scriptKind:e.getScriptKind(t,this.host)}),this.fileNameToEntry.set(n,r),r},t.prototype.getEntry=function(e){return this.fileNameToEntry.get(e)},t.prototype.contains=function(e){return this.fileNameToEntry.contains(e)},t.prototype.getOrCreateEntry=function(t){var n=e.toPath(t,this.currentDirectory,this.getCanonicalFileName);return this.contains(n)?this.getEntry(n):this.createEntry(t,n)},t.prototype.getRootFileNames=function(){var e=[];return this.fileNameToEntry.forEachValue(function(t,n){n&&e.push(n.hostFileName)}),e},t.prototype.getVersion=function(e){var t=this.getEntry(e);return t&&t.version},t.prototype.getScriptSnapshot=function(e){var t=this.getEntry(e);return t&&t.scriptSnapshot},t}(),te=function(){function t(e){this.host=e}return t.prototype.getCurrentSourceFile=function(t){var n=this.host.getScriptSnapshot(t);if(!n)throw new Error("Could not find file: '"+t+"'.");var r,a=e.getScriptKind(t,this.host),i=this.host.getScriptVersion(t);if(this.currentFileName!==t)r=_(t,n,2,i,!0,a);else if(this.currentFileVersion!==i){var o=n.getChangeRange(this.currentFileScriptSnapshot);r=u(this.currentSourceFile,n,i,o)}return r&&(this.currentFileVersion=i,this.currentFileName=t,this.currentFileScriptSnapshot=n,this.currentSourceFile=r),this.currentSourceFile},t}();e.transpileModule=s,e.transpile=c,e.createLanguageServiceSourceFile=_,e.disableIncrementalParsing=!1,e.updateLanguageServiceSourceFile=u,e.createDocumentRegistry=l,e.preProcessFile=d;var ne;!function(e){e[e.None=0]="None",e[e.Value=1]="Value",e[e.Type=2]="Type",e[e.Namespace=4]="Namespace",e[e.All=7]="All"}(ne||(ne={}));var re;!function(e){e[e.None=0]="None",e[e.Unlabeled=1]="Unlabeled",e[e.Labeled=2]="Labeled",e[e.All=3]="All"}(re||(re={}));for(var ae=[],ie=70;135>=ie;ie++)ae.push({name:e.tokenToString(ie),kind:Q.keyword,kindModifiers:$.none,sortText:"0"});e.getContainerNode=w,e.getNodeKind=A;var oe=function(){function t(e){this.cancellationToken=e}return t.prototype.isCancellationRequested=function(){return this.cancellationToken&&this.cancellationToken.isCancellationRequested()},t.prototype.throwIfCancellationRequested=function(){if(this.isCancellationRequested())throw new e.OperationCanceledException},t}();e.createLanguageService=P,e.getNameTable=N,e.createClassifier=I,e.getDefaultLibFilePath=F,L()}(ts||(ts={}));var ts;!function(e){var t;!function(t){function n(t,n){function r(n,r){var a=n.decorators?e.skipTrivia(t.text,n.decorators.end):n.getStart(t);return e.createTextSpanFromBounds(a,(r||n).getEnd())}function a(t,n){return r(t,e.findNextToken(n,n.parent))}function i(e,n){return _(e&&l===t.getLineAndCharacterOfPosition(e.getStart(t)).line?e:n)}function o(n){return e.createTextSpanFromBounds(e.skipTrivia(t.text,n.pos),n.end)}function s(n){return _(e.findPrecedingToken(n.pos,t))}function c(t){return _(e.findNextToken(t,t.parent))}function _(n){function u(n){var a=n.parent.declarations;return a&&a[0]===n?r(e.findPrecedingToken(n.pos,t,n.parent),n):r(n)}function l(n){if(203===n.parent.parent.kind)return _(n.parent.parent);if(e.isBindingPattern(n.name))return k(n.name);if(n.initializer||2&n.flags||204===n.parent.parent.kind)return u(n);var r=n.parent.declarations;return r&&r[0]!==n?_(e.findPrecedingToken(n.pos,t,n.parent)):void 0}function d(e){return!!e.initializer||void 0!==e.dotDotDotToken||!!(8&e.flags)||!!(16&e.flags)}function p(t){if(e.isBindingPattern(t.name))return k(t.name);if(d(t))return r(t);var n=t.parent,a=e.indexOf(n.parameters,t);return a?p(n.parameters[a-1]):_(n.body)}function f(e){return!!(2&e.flags)||217===e.parent.kind&&145!==e.kind}function m(e){return e.body?f(e)?r(e):_(e.body):void 0}function g(e){var t=e.statements.length?e.statements[0]:e.getLastToken();return f(e.parent)?i(e.parent,t):_(t)}function y(n){switch(n.parent.kind){case 221:if(1!==e.getModuleInstanceState(n.parent))return;case 201:case 199:case 203:return i(n.parent,n.statements[0]);case 202:case 204:return i(e.findPrecedingToken(n.pos,t,n.parent),n.statements[0])}return _(n.statements[0])}function h(e){if(215!==e.initializer.kind)return _(e.initializer);var t=e.initializer;return t.declarations.length>0?_(t.declarations[0]):void 0}function v(e){return e.initializer?h(e):e.condition?r(e.condition):e.incrementor?r(e.incrementor):void 0}function k(t){var n=e.forEach(t.elements,function(e){return 190!==e.kind?e:void 0});return n?_(n):166===t.parent.kind?r(t.parent):u(t.parent)}function b(t){e.Debug.assert(165!==t.kind&&164!==t.kind);var n=167===t.kind?t.elements:t.properties,a=e.forEach(n,function(e){return 190!==e.kind?e:void 0});return a?_(a):r(184===t.parent.kind?t.parent:t)}function x(n){switch(n.parent.kind){case 220:var r=n.parent;return i(e.findPrecedingToken(n.pos,t,n.parent),r.members.length?r.members[0]:r.getLastToken(t));case 217:var a=n.parent;return i(e.findPrecedingToken(n.pos,t,n.parent),a.members.length?a.members[0]:a.getLastToken(t));case 223:return i(n.parent.parent,n.parent.clauses[0])}return _(n.parent)}function C(t){switch(t.parent.kind){case 222:if(1!==e.getModuleInstanceState(t.parent.parent))return;case 220:case 217:return r(t);case 195:if(e.isFunctionBlock(t.parent))return r(t);case 247:return _(e.lastOrUndefined(t.parent.statements));case 223:var n=t.parent,a=e.lastOrUndefined(n.clauses);if(a)return _(e.lastOrUndefined(a.statements));return;case 164:var i=t.parent;return _(e.lastOrUndefined(i.elements)||i);default:if(e.isArrayLiteralOrObjectLiteralDestructuringPattern(t.parent)){var o=t.parent;return r(e.lastOrUndefined(o.properties)||o)}return _(t.parent)}}function D(t){switch(t.parent.kind){case 165:var n=t.parent;return r(e.lastOrUndefined(n.elements)||n);default:if(e.isArrayLiteralOrObjectLiteralDestructuringPattern(t.parent)){var a=t.parent;return r(e.lastOrUndefined(a.elements)||a)}return _(t.parent)}}function S(e){return 200===e.parent.kind||171===e.parent.kind||172===e.parent.kind?s(e):175===e.parent.kind?c(e):_(e.parent)}function T(e){switch(e.parent.kind){case 176:case 216:case 177:case 144:case 143:case 146:case 147:case 145:case 201:case 200:case 202:case 204:case 171:case 172:case 175:return s(e);default:return _(e.parent)}}function E(t){return e.isFunctionLike(t.parent)||248===t.parent.kind||139===t.parent.kind?s(t):_(t.parent)}function w(e){return 174===e.parent.kind?c(e):_(e.parent)}function A(e){return 200===e.parent.kind?a(e,e.parent.expression):_(e.parent)}function P(e){return 204===e.parent.kind?c(e):_(e.parent)}if(n)switch(n.kind){case 196:return l(n.declarationList.declarations[0]);case 214:case 142:case 141:return l(n);case 139:return p(n);case 216:case 144:case 143:case 146:case 147:case 145:case 176:case 177:return m(n);case 195:if(e.isFunctionBlock(n))return g(n);case 222:return y(n);case 247:return y(n.block);case 198:return r(n.expression);case 207:return r(n.getChildAt(0),n.expression);case 201:return a(n,n.expression);case 200:return _(n.statement);case 213:return r(n.getChildAt(0));case 199:return a(n,n.expression);case 210:return _(n.statement);case 206:case 205:return r(n.getChildAt(0),n.label);case 202:return v(n);case 203:return a(n,n.expression);case 204:return h(n);case 209:return a(n,n.expression);case 244:case 245:return _(n.statements[0]);case 212:return y(n.tryBlock);case 211:return r(n,n.expression);case 230:return r(n,n.expression);case 224:return r(n,n.moduleReference);case 225:return r(n,n.moduleSpecifier);case 231:return r(n,n.moduleSpecifier);case 221:if(1!==e.getModuleInstanceState(n))return;case 217:case 220:case 250:case 166:return r(n);case 208:return _(n.statement);case 140:return o(n.parent.decorators);case 164:case 165:return k(n);case 218:case 219:return;case 23:case 1:return i(e.findPrecedingToken(n.pos,t));case 24:return s(n);case 15:return x(n);case 16:return C(n);case 20:return D(n);case 17:return S(n);case 18:return T(n);case 54:return E(n);case 27:case 25:return w(n);case 104:return A(n);case 80:case 72:case 85:return c(n);case 135:return P(n);default:if(e.isArrayLiteralOrObjectLiteralDestructuringPattern(n))return b(n);if((69===n.kind||188==n.kind||248===n.kind||249===n.kind)&&e.isArrayLiteralOrObjectLiteralDestructuringPattern(n.parent))return r(n);if(184===n.kind){var N=n;if(e.isArrayLiteralOrObjectLiteralDestructuringPattern(N.left))return b(N.left);if(56===N.operatorToken.kind&&e.isArrayLiteralOrObjectLiteralDestructuringPattern(N.parent))return r(n);if(24===N.operatorToken.kind)return _(N.left)}if(e.isExpression(n))switch(n.parent.kind){case 200:return s(n);case 140:return _(n.parent);case 202:case 204:return r(n);case 184:if(24===n.parent.operatorToken.kind)return r(n);break;case 177:if(n.parent.body===n)return r(n)}if(248===n.parent.kind&&n.parent.name===n&&!e.isArrayLiteralOrObjectLiteralDestructuringPattern(n.parent.parent))return _(n.parent.initializer);if(174===n.parent.kind&&n.parent.type===n)return c(n.parent.type);if(e.isFunctionLike(n.parent)&&n.parent.type===n)return s(n);if(214===n.parent.kind||139===n.parent.kind){var O=n.parent;if(O.initializer===n||O.type===n||e.isAssignmentOperator(n.kind))return s(n)}if(184===n.parent.kind){var N=n.parent;if(e.isArrayLiteralOrObjectLiteralDestructuringPattern(N.left)&&(N.right===n||N.operatorToken===n))return s(n)}return _(n.parent)}}if(!(4096&t.flags)){var u=e.getTokenAtPosition(t,n),l=t.getLineAndCharacterOfPosition(n).line;if((!(t.getLineAndCharacterOfPosition(u.getStart(t)).line>l)||(u=e.findPrecedingToken(u.pos,t),u&&t.getLineAndCharacterOfPosition(u.getEnd()).line===l))&&!e.isInAmbientContext(u))return _(u)}}t.spanInSourceFileAtLocation=n}(t=e.BreakpointResolver||(e.BreakpointResolver={}))}(ts||(ts={}));var debugObjectHost=this,ts;!function(e){function t(e,t){e&&e.log("*INTERNAL ERROR* - Exception in typescript services: "+t.message)}function n(e,t,n,r){var a;r&&(e.log(t),a=Date.now());var i=n();if(r){var o=Date.now();if(e.log(t+" completed in "+(o-a)+" msec"),"string"==typeof i){var s=i;s.length>128&&(s=s.substring(0,128)+"..."),e.log(" result.length="+s.length+", result='"+JSON.stringify(s)+"'")}}return i}function r(r,a,i,o){try{var s=n(r,a,i,o);return JSON.stringify({result:s})}catch(c){return c instanceof e.OperationCanceledException?JSON.stringify({canceled:!0}):(t(r,c),c.description=a,JSON.stringify({error:c}))}}function a(e,t){return e.map(function(e){return i(e,t)})}function i(t,n){return{message:e.flattenDiagnosticMessageText(t.messageText,n),start:t.start,length:t.length,category:e.DiagnosticCategory[t.category].toLowerCase(),code:t.code}}function o(e){return{spans:e.spans.join(","),endOfLineState:e.endOfLineState}}var s=function(){function t(e){this.scriptSnapshotShim=e}return t.prototype.getText=function(e,t){return this.scriptSnapshotShim.getText(e,t)},t.prototype.getLength=function(){return this.scriptSnapshotShim.getLength()},t.prototype.getChangeRange=function(t){var n=t,r=this.scriptSnapshotShim.getChangeRange(n.scriptSnapshotShim);if(null==r)return null;var a=JSON.parse(r);return e.createTextChangeRange(e.createTextSpan(a.span.start,a.span.length),a.newLength)},t.prototype.dispose=function(){"dispose"in this.scriptSnapshotShim&&this.scriptSnapshotShim.dispose()},t}(),c=function(){function t(t){var n=this;this.shimHost=t,this.loggingEnabled=!1,this.tracingEnabled=!1,"getModuleResolutionsForFile"in this.shimHost&&(this.resolveModuleNames=function(t,r){var a=JSON.parse(n.shimHost.getModuleResolutionsForFile(r));return e.map(t,function(t){var n=e.lookUp(a,t);return n?{resolvedFileName:n}:void 0})}),"directoryExists"in this.shimHost&&(this.directoryExists=function(e){return n.shimHost.directoryExists(e)})}return t.prototype.log=function(e){this.loggingEnabled&&this.shimHost.log(e)},t.prototype.trace=function(e){this.tracingEnabled&&this.shimHost.trace(e)},t.prototype.error=function(e){this.shimHost.error(e)},t.prototype.getProjectVersion=function(){return this.shimHost.getProjectVersion?this.shimHost.getProjectVersion():void 0},t.prototype.useCaseSensitiveFileNames=function(){return this.shimHost.useCaseSensitiveFileNames?this.shimHost.useCaseSensitiveFileNames():!1},t.prototype.getCompilationSettings=function(){var e=this.shimHost.getCompilationSettings();if(null==e||""==e)throw Error("LanguageServiceShimHostAdapter.getCompilationSettings: empty compilationSettings");return JSON.parse(e)},t.prototype.getScriptFileNames=function(){var e=this.shimHost.getScriptFileNames();return this.files=JSON.parse(e)},t.prototype.getScriptSnapshot=function(e){var t=this.shimHost.getScriptSnapshot(e);return t&&new s(t)},t.prototype.getScriptKind=function(e){return"getScriptKind"in this.shimHost?this.shimHost.getScriptKind(e):0},t.prototype.getScriptVersion=function(e){return this.shimHost.getScriptVersion(e)},t.prototype.getLocalizedDiagnosticMessages=function(){var e=this.shimHost.getLocalizedDiagnosticMessages();if(null==e||""==e)return null;try{return JSON.parse(e)}catch(t){return this.log(t.description||"diagnosticMessages.generated.json has invalid JSON format"),null}},t.prototype.getCancellationToken=function(){var e=this.shimHost.getCancellationToken();return new _(e)},t.prototype.getCurrentDirectory=function(){return this.shimHost.getCurrentDirectory()},t.prototype.getDefaultLibFileName=function(e){return this.shimHost.getDefaultLibFileName(JSON.stringify(e))},t}();e.LanguageServiceShimHostAdapter=c;var _=function(){function e(e){this.hostCancellationToken=e,this.lastCancellationCheckTime=0}return e.prototype.isCancellationRequested=function(){var e=Date.now(),t=Math.abs(e-this.lastCancellationCheckTime);return t>10?(this.lastCancellationCheckTime=e,this.hostCancellationToken.isCancellationRequested()):!1},e}(),u=function(){function e(e){var t=this;this.shimHost=e,"directoryExists"in this.shimHost&&(this.directoryExists=function(e){return t.shimHost.directoryExists(e)})}return e.prototype.readDirectory=function(e,t,n,r){var a;try{a=this.shimHost.readDirectory(e,t,JSON.stringify(n),r)}catch(i){a=this.shimHost.readDirectory(e,t,JSON.stringify(n))}return JSON.parse(a)},e.prototype.fileExists=function(e){return this.shimHost.fileExists(e)},e.prototype.readFile=function(e){return this.shimHost.readFile(e)},e}();e.CoreServicesShimHostAdapter=u;var l=function(){function e(e){this.factory=e,e.registerShim(this)}return e.prototype.dispose=function(e){this.factory.unregisterShim(this)},e}();e.realizeDiagnostics=a;var d=function(t){function n(e,n,r){t.call(this,e),this.host=n,this.languageService=r,this.logPerformance=!1,this.logger=this.host}return __extends(n,t),n.prototype.forwardJSONCall=function(e,t){return r(this.logger,e,t,this.logPerformance)},n.prototype.dispose=function(e){this.logger.log("dispose()"),this.languageService.dispose(),this.languageService=null,debugObjectHost&&debugObjectHost.CollectGarbage&&(debugObjectHost.CollectGarbage(),this.logger.log("CollectGarbage()")),this.logger=null,t.prototype.dispose.call(this,e)},n.prototype.refresh=function(e){this.forwardJSONCall("refresh("+e+")",function(){return null})},n.prototype.cleanupSemanticCache=function(){var e=this;this.forwardJSONCall("cleanupSemanticCache()",function(){return e.languageService.cleanupSemanticCache(),null})},n.prototype.realizeDiagnostics=function(t){var n=e.getNewLineOrDefaultFromHost(this.host);return e.realizeDiagnostics(t,n)},n.prototype.getSyntacticClassifications=function(t,n,r){var a=this;return this.forwardJSONCall("getSyntacticClassifications('"+t+"', "+n+", "+r+")",function(){return a.languageService.getSyntacticClassifications(t,e.createTextSpan(n,r))})},n.prototype.getSemanticClassifications=function(t,n,r){var a=this;return this.forwardJSONCall("getSemanticClassifications('"+t+"', "+n+", "+r+")",function(){return a.languageService.getSemanticClassifications(t,e.createTextSpan(n,r))})},n.prototype.getEncodedSyntacticClassifications=function(t,n,r){var a=this;return this.forwardJSONCall("getEncodedSyntacticClassifications('"+t+"', "+n+", "+r+")",function(){return o(a.languageService.getEncodedSyntacticClassifications(t,e.createTextSpan(n,r)))})},n.prototype.getEncodedSemanticClassifications=function(t,n,r){var a=this;return this.forwardJSONCall("getEncodedSemanticClassifications('"+t+"', "+n+", "+r+")",function(){return o(a.languageService.getEncodedSemanticClassifications(t,e.createTextSpan(n,r)))})},n.prototype.getSyntacticDiagnostics=function(e){var t=this;return this.forwardJSONCall("getSyntacticDiagnostics('"+e+"')",function(){var n=t.languageService.getSyntacticDiagnostics(e);return t.realizeDiagnostics(n)})},n.prototype.getSemanticDiagnostics=function(e){var t=this;return this.forwardJSONCall("getSemanticDiagnostics('"+e+"')",function(){var n=t.languageService.getSemanticDiagnostics(e);return t.realizeDiagnostics(n)})},n.prototype.getCompilerOptionsDiagnostics=function(){var e=this;return this.forwardJSONCall("getCompilerOptionsDiagnostics()",function(){var t=e.languageService.getCompilerOptionsDiagnostics();return e.realizeDiagnostics(t)})},n.prototype.getQuickInfoAtPosition=function(e,t){var n=this;return this.forwardJSONCall("getQuickInfoAtPosition('"+e+"', "+t+")",function(){return n.languageService.getQuickInfoAtPosition(e,t)})},n.prototype.getNameOrDottedNameSpan=function(e,t,n){var r=this;return this.forwardJSONCall("getNameOrDottedNameSpan('"+e+"', "+t+", "+n+")",function(){return r.languageService.getNameOrDottedNameSpan(e,t,n)})},n.prototype.getBreakpointStatementAtPosition=function(e,t){var n=this;return this.forwardJSONCall("getBreakpointStatementAtPosition('"+e+"', "+t+")",function(){return n.languageService.getBreakpointStatementAtPosition(e,t)})},n.prototype.getSignatureHelpItems=function(e,t){
var n=this;return this.forwardJSONCall("getSignatureHelpItems('"+e+"', "+t+")",function(){return n.languageService.getSignatureHelpItems(e,t)})},n.prototype.getDefinitionAtPosition=function(e,t){var n=this;return this.forwardJSONCall("getDefinitionAtPosition('"+e+"', "+t+")",function(){return n.languageService.getDefinitionAtPosition(e,t)})},n.prototype.getTypeDefinitionAtPosition=function(e,t){var n=this;return this.forwardJSONCall("getTypeDefinitionAtPosition('"+e+"', "+t+")",function(){return n.languageService.getTypeDefinitionAtPosition(e,t)})},n.prototype.getRenameInfo=function(e,t){var n=this;return this.forwardJSONCall("getRenameInfo('"+e+"', "+t+")",function(){return n.languageService.getRenameInfo(e,t)})},n.prototype.findRenameLocations=function(e,t,n,r){var a=this;return this.forwardJSONCall("findRenameLocations('"+e+"', "+t+", "+n+", "+r+")",function(){return a.languageService.findRenameLocations(e,t,n,r)})},n.prototype.getBraceMatchingAtPosition=function(e,t){var n=this;return this.forwardJSONCall("getBraceMatchingAtPosition('"+e+"', "+t+")",function(){return n.languageService.getBraceMatchingAtPosition(e,t)})},n.prototype.getIndentationAtPosition=function(e,t,n){var r=this;return this.forwardJSONCall("getIndentationAtPosition('"+e+"', "+t+")",function(){var a=JSON.parse(n);return r.languageService.getIndentationAtPosition(e,t,a)})},n.prototype.getReferencesAtPosition=function(e,t){var n=this;return this.forwardJSONCall("getReferencesAtPosition('"+e+"', "+t+")",function(){return n.languageService.getReferencesAtPosition(e,t)})},n.prototype.findReferences=function(e,t){var n=this;return this.forwardJSONCall("findReferences('"+e+"', "+t+")",function(){return n.languageService.findReferences(e,t)})},n.prototype.getOccurrencesAtPosition=function(e,t){var n=this;return this.forwardJSONCall("getOccurrencesAtPosition('"+e+"', "+t+")",function(){return n.languageService.getOccurrencesAtPosition(e,t)})},n.prototype.getDocumentHighlights=function(t,n,r){var a=this;return this.forwardJSONCall("getDocumentHighlights('"+t+"', "+n+")",function(){var i=a.languageService.getDocumentHighlights(t,n,JSON.parse(r)),o=e.normalizeSlashes(t).toLowerCase();return e.filter(i,function(t){return e.normalizeSlashes(t.fileName).toLowerCase()===o})})},n.prototype.getCompletionsAtPosition=function(e,t){var n=this;return this.forwardJSONCall("getCompletionsAtPosition('"+e+"', "+t+")",function(){return n.languageService.getCompletionsAtPosition(e,t)})},n.prototype.getCompletionEntryDetails=function(e,t,n){var r=this;return this.forwardJSONCall("getCompletionEntryDetails('"+e+"', "+t+", '"+n+"')",function(){return r.languageService.getCompletionEntryDetails(e,t,n)})},n.prototype.getFormattingEditsForRange=function(e,t,n,r){var a=this;return this.forwardJSONCall("getFormattingEditsForRange('"+e+"', "+t+", "+n+")",function(){var i=JSON.parse(r);return a.languageService.getFormattingEditsForRange(e,t,n,i)})},n.prototype.getFormattingEditsForDocument=function(e,t){var n=this;return this.forwardJSONCall("getFormattingEditsForDocument('"+e+"')",function(){var r=JSON.parse(t);return n.languageService.getFormattingEditsForDocument(e,r)})},n.prototype.getFormattingEditsAfterKeystroke=function(e,t,n,r){var a=this;return this.forwardJSONCall("getFormattingEditsAfterKeystroke('"+e+"', "+t+", '"+n+"')",function(){var i=JSON.parse(r);return a.languageService.getFormattingEditsAfterKeystroke(e,t,n,i)})},n.prototype.getDocCommentTemplateAtPosition=function(e,t){var n=this;return this.forwardJSONCall("getDocCommentTemplateAtPosition('"+e+"', "+t+")",function(){return n.languageService.getDocCommentTemplateAtPosition(e,t)})},n.prototype.getNavigateToItems=function(e,t){var n=this;return this.forwardJSONCall("getNavigateToItems('"+e+"', "+t+")",function(){return n.languageService.getNavigateToItems(e,t)})},n.prototype.getNavigationBarItems=function(e){var t=this;return this.forwardJSONCall("getNavigationBarItems('"+e+"')",function(){return t.languageService.getNavigationBarItems(e)})},n.prototype.getOutliningSpans=function(e){var t=this;return this.forwardJSONCall("getOutliningSpans('"+e+"')",function(){return t.languageService.getOutliningSpans(e)})},n.prototype.getTodoComments=function(e,t){var n=this;return this.forwardJSONCall("getTodoComments('"+e+"')",function(){return n.languageService.getTodoComments(e,JSON.parse(t))})},n.prototype.getEmitOutput=function(e){var t=this;return this.forwardJSONCall("getEmitOutput('"+e+"')",function(){return t.languageService.getEmitOutput(e)})},n}(l),p=function(t){function n(n,r){t.call(this,n),this.logger=r,this.logPerformance=!1,this.classifier=e.createClassifier()}return __extends(n,t),n.prototype.getEncodedLexicalClassifications=function(e,t,n){var a=this;return r(this.logger,"getEncodedLexicalClassifications",function(){return o(a.classifier.getEncodedLexicalClassifications(e,t,n))},this.logPerformance)},n.prototype.getClassificationsForLine=function(e,t,n){for(var r=this.classifier.getClassificationsForLine(e,t,n),a="",i=0,o=r.entries;i<o.length;i++){var s=o[i];a+=s.length+"\n",a+=s.classification+"\n"}return a+=r.finalLexState},n}(l),f=function(t){function n(e,n,r){t.call(this,e),this.logger=n,this.host=r,this.logPerformance=!1}return __extends(n,t),n.prototype.forwardJSONCall=function(e,t){return r(this.logger,e,t,this.logPerformance)},n.prototype.resolveModuleName=function(t,n,r){var a=this;return this.forwardJSONCall("resolveModuleName('"+t+"')",function(){var i=JSON.parse(r),o=e.resolveModuleName(n,e.normalizeSlashes(t),i,a.host);return{resolvedFileName:o.resolvedModule?o.resolvedModule.resolvedFileName:void 0,failedLookupLocations:o.failedLookupLocations}})},n.prototype.getPreProcessedFileInfo=function(t,n){return this.forwardJSONCall("getPreProcessedFileInfo('"+t+"')",function(){var t=e.preProcessFile(n.getText(0,n.getLength()),!0,!0),r={referencedFiles:[],importedFiles:[],ambientExternalModules:t.ambientExternalModules,isLibFile:t.isLibFile};return e.forEach(t.referencedFiles,function(t){r.referencedFiles.push({path:e.normalizePath(t.fileName),position:t.pos,length:t.end-t.pos})}),e.forEach(t.importedFiles,function(t){r.importedFiles.push({path:e.normalizeSlashes(t.fileName),position:t.pos,length:t.end-t.pos})}),r})},n.prototype.getTSConfigFileInfo=function(t,n){var r=this;return this.forwardJSONCall("getTSConfigFileInfo('"+t+"')",function(){var o=n.getText(0,n.getLength()),s=e.parseConfigFileTextToJson(t,o);if(s.error)return{options:{},typingOptions:{},files:[],errors:[i(s.error,"\r\n")]};var c=e.normalizeSlashes(t),_=e.parseJsonConfigFileContent(s.config,r.host,e.getDirectoryPath(c),{},c);return{options:_.options,typingOptions:_.typingOptions,files:_.fileNames,errors:a(_.errors,"\r\n")}})},n.prototype.getDefaultCompilationSettings=function(){return this.forwardJSONCall("getDefaultCompilationSettings()",function(){return e.getDefaultCompilerOptions()})},n.prototype.discoverTypings=function(t){var n=this,r=e.createGetCanonicalFileName(!1);return this.forwardJSONCall("discoverTypings()",function(){var a=JSON.parse(t);return e.JsTyping.discoverTypings(n.host,a.fileNames,e.toPath(a.projectRootPath,a.projectRootPath,r),e.toPath(a.safeListPath,a.safeListPath,r),a.packageNameToTypingLocation,a.typingOptions,a.compilerOptions)})},n}(l),m=function(){function n(){this._shims=[]}return n.prototype.getServicesVersion=function(){return e.servicesVersion},n.prototype.createLanguageServiceShim=function(n){try{void 0===this.documentRegistry&&(this.documentRegistry=e.createDocumentRegistry(n.useCaseSensitiveFileNames&&n.useCaseSensitiveFileNames(),n.getCurrentDirectory()));var r=new c(n),a=e.createLanguageService(r,this.documentRegistry);return new d(this,n,a)}catch(i){throw t(n,i),i}},n.prototype.createClassifierShim=function(e){try{return new p(this,e)}catch(n){throw t(e,n),n}},n.prototype.createCoreServicesShim=function(e){try{var n=new u(e);return new f(this,e,n)}catch(r){throw t(e,r),r}},n.prototype.close=function(){this._shims=[],this.documentRegistry=void 0},n.prototype.registerShim=function(e){this._shims.push(e)},n.prototype.unregisterShim=function(e){for(var t=0,n=this._shims.length;n>t;t++)if(this._shims[t]===e)return void delete this._shims[t];throw new Error("Invalid operation")},n}();e.TypeScriptServicesFactory=m,"undefined"!=typeof module&&module.exports&&(module.exports=e)}(ts||(ts={}));var TypeScript;!function(e){var t;!function(e){e.TypeScriptServicesFactory=ts.TypeScriptServicesFactory}(t=e.Services||(e.Services={}))}(TypeScript||(TypeScript={}));var toolsVersion="1.8";
//# sourceMappingURL=./typescript.min.js.map
|
node_modules/react/lib/ReactOwner.js
|
abcdef506819/mantra-meteor-blog
|
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactOwner
*/
'use strict';
var invariant = require('fbjs/lib/invariant');
/**
* ReactOwners are capable of storing references to owned components.
*
* All components are capable of //being// referenced by owner components, but
* only ReactOwner components are capable of //referencing// owned components.
* The named reference is known as a "ref".
*
* Refs are available when mounted and updated during reconciliation.
*
* var MyComponent = React.createClass({
* render: function() {
* return (
* <div onClick={this.handleClick}>
* <CustomComponent ref="custom" />
* </div>
* );
* },
* handleClick: function() {
* this.refs.custom.handleClick();
* },
* componentDidMount: function() {
* this.refs.custom.initialize();
* }
* });
*
* Refs should rarely be used. When refs are used, they should only be done to
* control data that is not handled by React's data flow.
*
* @class ReactOwner
*/
var ReactOwner = {
/**
* @param {?object} object
* @return {boolean} True if `object` is a valid owner.
* @final
*/
isValidOwner: function (object) {
return !!(object && typeof object.attachRef === 'function' && typeof object.detachRef === 'function');
},
/**
* Adds a component by ref to an owner component.
*
* @param {ReactComponent} component Component to reference.
* @param {string} ref Name by which to refer to the component.
* @param {ReactOwner} owner Component on which to record the ref.
* @final
* @internal
*/
addComponentAsRefTo: function (component, ref, owner) {
!ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'addComponentAsRefTo(...): Only a ReactOwner can have refs. You might ' + 'be adding a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : invariant(false) : undefined;
owner.attachRef(ref, component);
},
/**
* Removes a component by ref from an owner component.
*
* @param {ReactComponent} component Component to dereference.
* @param {string} ref Name of the ref to remove.
* @param {ReactOwner} owner Component on which the ref is recorded.
* @final
* @internal
*/
removeComponentAsRefFrom: function (component, ref, owner) {
!ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. You might ' + 'be removing a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : invariant(false) : undefined;
// Check that `component` is still the current ref because we do not want to
// detach the ref if another component stole it.
if (owner.getPublicInstance().refs[ref] === component.getPublicInstance()) {
owner.detachRef(ref);
}
}
};
module.exports = ReactOwner;
|
tests/components/Header/Header.spec.js
|
baronkwan/ig_clone
|
import React from 'react'
import { Header } from 'components/Header/Header'
import { IndexLink, Link } from 'react-router'
import { shallow } from 'enzyme'
describe('(Component) Header', () => {
let _wrapper
beforeEach(() => {
_wrapper = shallow(<Header />)
})
it('Renders a welcome message', () => {
const welcome = _wrapper.find('h1')
expect(welcome).to.exist
expect(welcome.text()).to.match(/React Redux Starter Kit/)
})
describe('Navigation links...', () => {
it('Should render a Link to Home route', () => {
expect(_wrapper.contains(
<IndexLink activeClassName='route--active' to='/'>
Home
</IndexLink>
)).to.be.true
})
it('Should render a Link to Counter route', () => {
expect(_wrapper.contains(
<Link activeClassName='route--active' to='/counter'>
Counter
</Link>
)).to.be.true
})
})
})
|
ajax/libs/react-ace/5.5.0/react-ace.js
|
seogi1004/cdnjs
|
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["ReactAce"] = factory();
else
root["ReactAce"] = factory();
})(this, function() {
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] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 12);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) 2014-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
var emptyFunction = __webpack_require__(3);
/**
* 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 (true) {
var printWarning = function printWarning(format) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
var argIndex = 0;
var message = 'Warning: ' + format.replace(/%s/g, function () {
return args[argIndex++];
});
if (typeof console !== 'undefined') {
console.error(message);
}
try {
// --- Welcome to debugging React ---
// This error was thrown as a convenience so that you can use this stack
// to find the callsite that caused this warning to fire.
throw new Error(message);
} catch (x) {}
};
warning = function warning(condition, format) {
if (format === undefined) {
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
}
if (format.indexOf('Failed Composite propType: ') === 0) {
return; // Ignore CompositeComponent proptype check.
}
if (!condition) {
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
args[_key2 - 2] = arguments[_key2];
}
printWarning.apply(undefined, [format].concat(args));
}
};
}
module.exports = warning;
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
/**
* Use invariant() to assert state which your program assumes to be true.
*
* Provide sprintf-style format (only %s is supported) and arguments
* to provide information about what broke and what you were
* expecting.
*
* The invariant message will be stripped in production, but the invariant
* will remain to ensure logic does not differ in production.
*/
var validateFormat = function validateFormat(format) {};
if (true) {
validateFormat = function validateFormat(format) {
if (format === undefined) {
throw new Error('invariant requires an error message argument');
}
};
}
function invariant(condition, format, a, b, c, d, e, f) {
validateFormat(format);
if (!condition) {
var error;
if (format === undefined) {
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
} else {
var args = [a, b, c, d, e, f];
var argIndex = 0;
error = new Error(format.replace(/%s/g, function () {
return args[argIndex++];
}));
error.name = 'Invariant Violation';
}
error.framesToPop = 1; // we don't care about invariant's own frame
throw error;
}
}
module.exports = invariant;
/***/ }),
/* 2 */
/***/ (function(module, exports) {
var g;
// This works in non-strict mode
g = (function() {
return this;
})();
try {
// This works if eval is allowed (see CSP)
g = g || Function("return this")() || (1,eval)("this");
} catch(e) {
// This works if the window reference is available
if(typeof window === "object")
g = window;
}
// g can still be undefined, but nothing to do about it...
// We return undefined, instead of nothing here, so it's
// easier to handle this case. if(!global) { ...}
module.exports = g;
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
function makeEmptyFunction(arg) {
return function () {
return arg;
};
}
/**
* This function accepts and discards inputs; it has no side effects. This is
* primarily useful idiomatically for overridable function endpoints which
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
*/
var emptyFunction = function emptyFunction() {};
emptyFunction.thatReturns = makeEmptyFunction;
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
emptyFunction.thatReturnsThis = function () {
return this;
};
emptyFunction.thatReturnsArgument = function (arg) {
return arg;
};
module.exports = emptyFunction;
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* 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 Ajax.org B.V. 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 AJAX.ORG B.V. 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.
*
* ***** END LICENSE BLOCK ***** */
/**
* Define a module along with a payload
* @param module a name for the payload
* @param payload a function to call with (acequire, exports, module) params
*/
(function() {
var ACE_NAMESPACE = "ace";
var global = (function() { return this; })();
if (!global && typeof window != "undefined") global = window; // strict mode
if (!ACE_NAMESPACE && typeof acequirejs !== "undefined")
return;
var define = function(module, deps, payload) {
if (typeof module !== "string") {
if (define.original)
define.original.apply(this, arguments);
else {
console.error("dropping module because define wasn\'t a string.");
console.trace();
}
return;
}
if (arguments.length == 2)
payload = deps;
if (!define.modules[module]) {
define.payloads[module] = payload;
define.modules[module] = null;
}
};
define.modules = {};
define.payloads = {};
/**
* Get at functionality define()ed using the function above
*/
var _acequire = function(parentId, module, callback) {
if (typeof module === "string") {
var payload = lookup(parentId, module);
if (payload != undefined) {
callback && callback();
return payload;
}
} else if (Object.prototype.toString.call(module) === "[object Array]") {
var params = [];
for (var i = 0, l = module.length; i < l; ++i) {
var dep = lookup(parentId, module[i]);
if (dep == undefined && acequire.original)
return;
params.push(dep);
}
return callback && callback.apply(null, params) || true;
}
};
var acequire = function(module, callback) {
var packagedModule = _acequire("", module, callback);
if (packagedModule == undefined && acequire.original)
return acequire.original.apply(this, arguments);
return packagedModule;
};
var normalizeModule = function(parentId, moduleName) {
// normalize plugin acequires
if (moduleName.indexOf("!") !== -1) {
var chunks = moduleName.split("!");
return normalizeModule(parentId, chunks[0]) + "!" + normalizeModule(parentId, chunks[1]);
}
// normalize relative acequires
if (moduleName.charAt(0) == ".") {
var base = parentId.split("/").slice(0, -1).join("/");
moduleName = base + "/" + moduleName;
while(moduleName.indexOf(".") !== -1 && previous != moduleName) {
var previous = moduleName;
moduleName = moduleName.replace(/\/\.\//, "/").replace(/[^\/]+\/\.\.\//, "");
}
}
return moduleName;
};
/**
* Internal function to lookup moduleNames and resolve them by calling the
* definition function if needed.
*/
var lookup = function(parentId, moduleName) {
moduleName = normalizeModule(parentId, moduleName);
var module = define.modules[moduleName];
if (!module) {
module = define.payloads[moduleName];
if (typeof module === 'function') {
var exports = {};
var mod = {
id: moduleName,
uri: '',
exports: exports,
packaged: true
};
var req = function(module, callback) {
return _acequire(moduleName, module, callback);
};
var returnValue = module(req, exports, mod);
exports = returnValue || mod.exports;
define.modules[moduleName] = exports;
delete define.payloads[moduleName];
}
module = define.modules[moduleName] = exports || module;
}
return module;
};
function exportAce(ns) {
var root = global;
if (ns) {
if (!global[ns])
global[ns] = {};
root = global[ns];
}
if (!root.define || !root.define.packaged) {
define.original = root.define;
root.define = define;
root.define.packaged = true;
}
if (!root.acequire || !root.acequire.packaged) {
acequire.original = root.acequire;
root.acequire = acequire;
root.acequire.packaged = true;
}
}
exportAce(ACE_NAMESPACE);
})();
ace.define("ace/lib/regexp",["require","exports","module"], function(acequire, exports, module) {
"use strict";
var real = {
exec: RegExp.prototype.exec,
test: RegExp.prototype.test,
match: String.prototype.match,
replace: String.prototype.replace,
split: String.prototype.split
},
compliantExecNpcg = real.exec.call(/()??/, "")[1] === undefined, // check `exec` handling of nonparticipating capturing groups
compliantLastIndexIncrement = function () {
var x = /^/g;
real.test.call(x, "");
return !x.lastIndex;
}();
if (compliantLastIndexIncrement && compliantExecNpcg)
return;
RegExp.prototype.exec = function (str) {
var match = real.exec.apply(this, arguments),
name, r2;
if ( typeof(str) == 'string' && match) {
if (!compliantExecNpcg && match.length > 1 && indexOf(match, "") > -1) {
r2 = RegExp(this.source, real.replace.call(getNativeFlags(this), "g", ""));
real.replace.call(str.slice(match.index), r2, function () {
for (var i = 1; i < arguments.length - 2; i++) {
if (arguments[i] === undefined)
match[i] = undefined;
}
});
}
if (this._xregexp && this._xregexp.captureNames) {
for (var i = 1; i < match.length; i++) {
name = this._xregexp.captureNames[i - 1];
if (name)
match[name] = match[i];
}
}
if (!compliantLastIndexIncrement && this.global && !match[0].length && (this.lastIndex > match.index))
this.lastIndex--;
}
return match;
};
if (!compliantLastIndexIncrement) {
RegExp.prototype.test = function (str) {
var match = real.exec.call(this, str);
if (match && this.global && !match[0].length && (this.lastIndex > match.index))
this.lastIndex--;
return !!match;
};
}
function getNativeFlags (regex) {
return (regex.global ? "g" : "") +
(regex.ignoreCase ? "i" : "") +
(regex.multiline ? "m" : "") +
(regex.extended ? "x" : "") + // Proposed for ES4; included in AS3
(regex.sticky ? "y" : "");
}
function indexOf (array, item, from) {
if (Array.prototype.indexOf) // Use the native array method if available
return array.indexOf(item, from);
for (var i = from || 0; i < array.length; i++) {
if (array[i] === item)
return i;
}
return -1;
}
});
ace.define("ace/lib/es5-shim",["require","exports","module"], function(acequire, exports, module) {
function Empty() {}
if (!Function.prototype.bind) {
Function.prototype.bind = function bind(that) { // .length is 1
var target = this;
if (typeof target != "function") {
throw new TypeError("Function.prototype.bind called on incompatible " + target);
}
var args = slice.call(arguments, 1); // for normal call
var bound = function () {
if (this instanceof bound) {
var result = target.apply(
this,
args.concat(slice.call(arguments))
);
if (Object(result) === result) {
return result;
}
return this;
} else {
return target.apply(
that,
args.concat(slice.call(arguments))
);
}
};
if(target.prototype) {
Empty.prototype = target.prototype;
bound.prototype = new Empty();
Empty.prototype = null;
}
return bound;
};
}
var call = Function.prototype.call;
var prototypeOfArray = Array.prototype;
var prototypeOfObject = Object.prototype;
var slice = prototypeOfArray.slice;
var _toString = call.bind(prototypeOfObject.toString);
var owns = call.bind(prototypeOfObject.hasOwnProperty);
var defineGetter;
var defineSetter;
var lookupGetter;
var lookupSetter;
var supportsAccessors;
if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) {
defineGetter = call.bind(prototypeOfObject.__defineGetter__);
defineSetter = call.bind(prototypeOfObject.__defineSetter__);
lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);
}
if ([1,2].splice(0).length != 2) {
if(function() { // test IE < 9 to splice bug - see issue #138
function makeArray(l) {
var a = new Array(l+2);
a[0] = a[1] = 0;
return a;
}
var array = [], lengthBefore;
array.splice.apply(array, makeArray(20));
array.splice.apply(array, makeArray(26));
lengthBefore = array.length; //46
array.splice(5, 0, "XXX"); // add one element
lengthBefore + 1 == array.length
if (lengthBefore + 1 == array.length) {
return true;// has right splice implementation without bugs
}
}()) {//IE 6/7
var array_splice = Array.prototype.splice;
Array.prototype.splice = function(start, deleteCount) {
if (!arguments.length) {
return [];
} else {
return array_splice.apply(this, [
start === void 0 ? 0 : start,
deleteCount === void 0 ? (this.length - start) : deleteCount
].concat(slice.call(arguments, 2)))
}
};
} else {//IE8
Array.prototype.splice = function(pos, removeCount){
var length = this.length;
if (pos > 0) {
if (pos > length)
pos = length;
} else if (pos == void 0) {
pos = 0;
} else if (pos < 0) {
pos = Math.max(length + pos, 0);
}
if (!(pos+removeCount < length))
removeCount = length - pos;
var removed = this.slice(pos, pos+removeCount);
var insert = slice.call(arguments, 2);
var add = insert.length;
if (pos === length) {
if (add) {
this.push.apply(this, insert);
}
} else {
var remove = Math.min(removeCount, length - pos);
var tailOldPos = pos + remove;
var tailNewPos = tailOldPos + add - remove;
var tailCount = length - tailOldPos;
var lengthAfterRemove = length - remove;
if (tailNewPos < tailOldPos) { // case A
for (var i = 0; i < tailCount; ++i) {
this[tailNewPos+i] = this[tailOldPos+i];
}
} else if (tailNewPos > tailOldPos) { // case B
for (i = tailCount; i--; ) {
this[tailNewPos+i] = this[tailOldPos+i];
}
} // else, add == remove (nothing to do)
if (add && pos === lengthAfterRemove) {
this.length = lengthAfterRemove; // truncate array
this.push.apply(this, insert);
} else {
this.length = lengthAfterRemove + add; // reserves space
for (i = 0; i < add; ++i) {
this[pos+i] = insert[i];
}
}
}
return removed;
};
}
}
if (!Array.isArray) {
Array.isArray = function isArray(obj) {
return _toString(obj) == "[object Array]";
};
}
var boxedString = Object("a"),
splitString = boxedString[0] != "a" || !(0 in boxedString);
if (!Array.prototype.forEach) {
Array.prototype.forEach = function forEach(fun /*, thisp*/) {
var object = toObject(this),
self = splitString && _toString(this) == "[object String]" ?
this.split("") :
object,
thisp = arguments[1],
i = -1,
length = self.length >>> 0;
if (_toString(fun) != "[object Function]") {
throw new TypeError(); // TODO message
}
while (++i < length) {
if (i in self) {
fun.call(thisp, self[i], i, object);
}
}
};
}
if (!Array.prototype.map) {
Array.prototype.map = function map(fun /*, thisp*/) {
var object = toObject(this),
self = splitString && _toString(this) == "[object String]" ?
this.split("") :
object,
length = self.length >>> 0,
result = Array(length),
thisp = arguments[1];
if (_toString(fun) != "[object Function]") {
throw new TypeError(fun + " is not a function");
}
for (var i = 0; i < length; i++) {
if (i in self)
result[i] = fun.call(thisp, self[i], i, object);
}
return result;
};
}
if (!Array.prototype.filter) {
Array.prototype.filter = function filter(fun /*, thisp */) {
var object = toObject(this),
self = splitString && _toString(this) == "[object String]" ?
this.split("") :
object,
length = self.length >>> 0,
result = [],
value,
thisp = arguments[1];
if (_toString(fun) != "[object Function]") {
throw new TypeError(fun + " is not a function");
}
for (var i = 0; i < length; i++) {
if (i in self) {
value = self[i];
if (fun.call(thisp, value, i, object)) {
result.push(value);
}
}
}
return result;
};
}
if (!Array.prototype.every) {
Array.prototype.every = function every(fun /*, thisp */) {
var object = toObject(this),
self = splitString && _toString(this) == "[object String]" ?
this.split("") :
object,
length = self.length >>> 0,
thisp = arguments[1];
if (_toString(fun) != "[object Function]") {
throw new TypeError(fun + " is not a function");
}
for (var i = 0; i < length; i++) {
if (i in self && !fun.call(thisp, self[i], i, object)) {
return false;
}
}
return true;
};
}
if (!Array.prototype.some) {
Array.prototype.some = function some(fun /*, thisp */) {
var object = toObject(this),
self = splitString && _toString(this) == "[object String]" ?
this.split("") :
object,
length = self.length >>> 0,
thisp = arguments[1];
if (_toString(fun) != "[object Function]") {
throw new TypeError(fun + " is not a function");
}
for (var i = 0; i < length; i++) {
if (i in self && fun.call(thisp, self[i], i, object)) {
return true;
}
}
return false;
};
}
if (!Array.prototype.reduce) {
Array.prototype.reduce = function reduce(fun /*, initial*/) {
var object = toObject(this),
self = splitString && _toString(this) == "[object String]" ?
this.split("") :
object,
length = self.length >>> 0;
if (_toString(fun) != "[object Function]") {
throw new TypeError(fun + " is not a function");
}
if (!length && arguments.length == 1) {
throw new TypeError("reduce of empty array with no initial value");
}
var i = 0;
var result;
if (arguments.length >= 2) {
result = arguments[1];
} else {
do {
if (i in self) {
result = self[i++];
break;
}
if (++i >= length) {
throw new TypeError("reduce of empty array with no initial value");
}
} while (true);
}
for (; i < length; i++) {
if (i in self) {
result = fun.call(void 0, result, self[i], i, object);
}
}
return result;
};
}
if (!Array.prototype.reduceRight) {
Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) {
var object = toObject(this),
self = splitString && _toString(this) == "[object String]" ?
this.split("") :
object,
length = self.length >>> 0;
if (_toString(fun) != "[object Function]") {
throw new TypeError(fun + " is not a function");
}
if (!length && arguments.length == 1) {
throw new TypeError("reduceRight of empty array with no initial value");
}
var result, i = length - 1;
if (arguments.length >= 2) {
result = arguments[1];
} else {
do {
if (i in self) {
result = self[i--];
break;
}
if (--i < 0) {
throw new TypeError("reduceRight of empty array with no initial value");
}
} while (true);
}
do {
if (i in this) {
result = fun.call(void 0, result, self[i], i, object);
}
} while (i--);
return result;
};
}
if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) {
Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) {
var self = splitString && _toString(this) == "[object String]" ?
this.split("") :
toObject(this),
length = self.length >>> 0;
if (!length) {
return -1;
}
var i = 0;
if (arguments.length > 1) {
i = toInteger(arguments[1]);
}
i = i >= 0 ? i : Math.max(0, length + i);
for (; i < length; i++) {
if (i in self && self[i] === sought) {
return i;
}
}
return -1;
};
}
if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) {
Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) {
var self = splitString && _toString(this) == "[object String]" ?
this.split("") :
toObject(this),
length = self.length >>> 0;
if (!length) {
return -1;
}
var i = length - 1;
if (arguments.length > 1) {
i = Math.min(i, toInteger(arguments[1]));
}
i = i >= 0 ? i : length - Math.abs(i);
for (; i >= 0; i--) {
if (i in self && sought === self[i]) {
return i;
}
}
return -1;
};
}
if (!Object.getPrototypeOf) {
Object.getPrototypeOf = function getPrototypeOf(object) {
return object.__proto__ || (
object.constructor ?
object.constructor.prototype :
prototypeOfObject
);
};
}
if (!Object.getOwnPropertyDescriptor) {
var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " +
"non-object: ";
Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {
if ((typeof object != "object" && typeof object != "function") || object === null)
throw new TypeError(ERR_NON_OBJECT + object);
if (!owns(object, property))
return;
var descriptor, getter, setter;
descriptor = { enumerable: true, configurable: true };
if (supportsAccessors) {
var prototype = object.__proto__;
object.__proto__ = prototypeOfObject;
var getter = lookupGetter(object, property);
var setter = lookupSetter(object, property);
object.__proto__ = prototype;
if (getter || setter) {
if (getter) descriptor.get = getter;
if (setter) descriptor.set = setter;
return descriptor;
}
}
descriptor.value = object[property];
return descriptor;
};
}
if (!Object.getOwnPropertyNames) {
Object.getOwnPropertyNames = function getOwnPropertyNames(object) {
return Object.keys(object);
};
}
if (!Object.create) {
var createEmpty;
if (Object.prototype.__proto__ === null) {
createEmpty = function () {
return { "__proto__": null };
};
} else {
createEmpty = function () {
var empty = {};
for (var i in empty)
empty[i] = null;
empty.constructor =
empty.hasOwnProperty =
empty.propertyIsEnumerable =
empty.isPrototypeOf =
empty.toLocaleString =
empty.toString =
empty.valueOf =
empty.__proto__ = null;
return empty;
}
}
Object.create = function create(prototype, properties) {
var object;
if (prototype === null) {
object = createEmpty();
} else {
if (typeof prototype != "object")
throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'");
var Type = function () {};
Type.prototype = prototype;
object = new Type();
object.__proto__ = prototype;
}
if (properties !== void 0)
Object.defineProperties(object, properties);
return object;
};
}
function doesDefinePropertyWork(object) {
try {
Object.defineProperty(object, "sentinel", {});
return "sentinel" in object;
} catch (exception) {
}
}
if (Object.defineProperty) {
var definePropertyWorksOnObject = doesDefinePropertyWork({});
var definePropertyWorksOnDom = typeof document == "undefined" ||
doesDefinePropertyWork(document.createElement("div"));
if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) {
var definePropertyFallback = Object.defineProperty;
}
}
if (!Object.defineProperty || definePropertyFallback) {
var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: ";
var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: "
var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " +
"on this javascript engine";
Object.defineProperty = function defineProperty(object, property, descriptor) {
if ((typeof object != "object" && typeof object != "function") || object === null)
throw new TypeError(ERR_NON_OBJECT_TARGET + object);
if ((typeof descriptor != "object" && typeof descriptor != "function") || descriptor === null)
throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor);
if (definePropertyFallback) {
try {
return definePropertyFallback.call(Object, object, property, descriptor);
} catch (exception) {
}
}
if (owns(descriptor, "value")) {
if (supportsAccessors && (lookupGetter(object, property) ||
lookupSetter(object, property)))
{
var prototype = object.__proto__;
object.__proto__ = prototypeOfObject;
delete object[property];
object[property] = descriptor.value;
object.__proto__ = prototype;
} else {
object[property] = descriptor.value;
}
} else {
if (!supportsAccessors)
throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
if (owns(descriptor, "get"))
defineGetter(object, property, descriptor.get);
if (owns(descriptor, "set"))
defineSetter(object, property, descriptor.set);
}
return object;
};
}
if (!Object.defineProperties) {
Object.defineProperties = function defineProperties(object, properties) {
for (var property in properties) {
if (owns(properties, property))
Object.defineProperty(object, property, properties[property]);
}
return object;
};
}
if (!Object.seal) {
Object.seal = function seal(object) {
return object;
};
}
if (!Object.freeze) {
Object.freeze = function freeze(object) {
return object;
};
}
try {
Object.freeze(function () {});
} catch (exception) {
Object.freeze = (function freeze(freezeObject) {
return function freeze(object) {
if (typeof object == "function") {
return object;
} else {
return freezeObject(object);
}
};
})(Object.freeze);
}
if (!Object.preventExtensions) {
Object.preventExtensions = function preventExtensions(object) {
return object;
};
}
if (!Object.isSealed) {
Object.isSealed = function isSealed(object) {
return false;
};
}
if (!Object.isFrozen) {
Object.isFrozen = function isFrozen(object) {
return false;
};
}
if (!Object.isExtensible) {
Object.isExtensible = function isExtensible(object) {
if (Object(object) === object) {
throw new TypeError(); // TODO message
}
var name = '';
while (owns(object, name)) {
name += '?';
}
object[name] = true;
var returnValue = owns(object, name);
delete object[name];
return returnValue;
};
}
if (!Object.keys) {
var hasDontEnumBug = true,
dontEnums = [
"toString",
"toLocaleString",
"valueOf",
"hasOwnProperty",
"isPrototypeOf",
"propertyIsEnumerable",
"constructor"
],
dontEnumsLength = dontEnums.length;
for (var key in {"toString": null}) {
hasDontEnumBug = false;
}
Object.keys = function keys(object) {
if (
(typeof object != "object" && typeof object != "function") ||
object === null
) {
throw new TypeError("Object.keys called on a non-object");
}
var keys = [];
for (var name in object) {
if (owns(object, name)) {
keys.push(name);
}
}
if (hasDontEnumBug) {
for (var i = 0, ii = dontEnumsLength; i < ii; i++) {
var dontEnum = dontEnums[i];
if (owns(object, dontEnum)) {
keys.push(dontEnum);
}
}
}
return keys;
};
}
if (!Date.now) {
Date.now = function now() {
return new Date().getTime();
};
}
var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
"\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
"\u2029\uFEFF";
if (!String.prototype.trim || ws.trim()) {
ws = "[" + ws + "]";
var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
trimEndRegexp = new RegExp(ws + ws + "*$");
String.prototype.trim = function trim() {
return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, "");
};
}
function toInteger(n) {
n = +n;
if (n !== n) { // isNaN
n = 0;
} else if (n !== 0 && n !== (1/0) && n !== -(1/0)) {
n = (n > 0 || -1) * Math.floor(Math.abs(n));
}
return n;
}
function isPrimitive(input) {
var type = typeof input;
return (
input === null ||
type === "undefined" ||
type === "boolean" ||
type === "number" ||
type === "string"
);
}
function toPrimitive(input) {
var val, valueOf, toString;
if (isPrimitive(input)) {
return input;
}
valueOf = input.valueOf;
if (typeof valueOf === "function") {
val = valueOf.call(input);
if (isPrimitive(val)) {
return val;
}
}
toString = input.toString;
if (typeof toString === "function") {
val = toString.call(input);
if (isPrimitive(val)) {
return val;
}
}
throw new TypeError();
}
var toObject = function (o) {
if (o == null) { // this matches both null and undefined
throw new TypeError("can't convert "+o+" to object");
}
return Object(o);
};
});
ace.define("ace/lib/fixoldbrowsers",["require","exports","module","ace/lib/regexp","ace/lib/es5-shim"], function(acequire, exports, module) {
"use strict";
acequire("./regexp");
acequire("./es5-shim");
});
ace.define("ace/lib/dom",["require","exports","module"], function(acequire, exports, module) {
"use strict";
var XHTML_NS = "http://www.w3.org/1999/xhtml";
exports.getDocumentHead = function(doc) {
if (!doc)
doc = document;
return doc.head || doc.getElementsByTagName("head")[0] || doc.documentElement;
}
exports.createElement = function(tag, ns) {
return document.createElementNS ?
document.createElementNS(ns || XHTML_NS, tag) :
document.createElement(tag);
};
exports.hasCssClass = function(el, name) {
var classes = (el.className + "").split(/\s+/g);
return classes.indexOf(name) !== -1;
};
exports.addCssClass = function(el, name) {
if (!exports.hasCssClass(el, name)) {
el.className += " " + name;
}
};
exports.removeCssClass = function(el, name) {
var classes = el.className.split(/\s+/g);
while (true) {
var index = classes.indexOf(name);
if (index == -1) {
break;
}
classes.splice(index, 1);
}
el.className = classes.join(" ");
};
exports.toggleCssClass = function(el, name) {
var classes = el.className.split(/\s+/g), add = true;
while (true) {
var index = classes.indexOf(name);
if (index == -1) {
break;
}
add = false;
classes.splice(index, 1);
}
if (add)
classes.push(name);
el.className = classes.join(" ");
return add;
};
exports.setCssClass = function(node, className, include) {
if (include) {
exports.addCssClass(node, className);
} else {
exports.removeCssClass(node, className);
}
};
exports.hasCssString = function(id, doc) {
var index = 0, sheets;
doc = doc || document;
if (doc.createStyleSheet && (sheets = doc.styleSheets)) {
while (index < sheets.length)
if (sheets[index++].owningElement.id === id) return true;
} else if ((sheets = doc.getElementsByTagName("style"))) {
while (index < sheets.length)
if (sheets[index++].id === id) return true;
}
return false;
};
exports.importCssString = function importCssString(cssText, id, doc) {
doc = doc || document;
if (id && exports.hasCssString(id, doc))
return null;
var style;
if (id)
cssText += "\n/*# sourceURL=ace/css/" + id + " */";
if (doc.createStyleSheet) {
style = doc.createStyleSheet();
style.cssText = cssText;
if (id)
style.owningElement.id = id;
} else {
style = exports.createElement("style");
style.appendChild(doc.createTextNode(cssText));
if (id)
style.id = id;
exports.getDocumentHead(doc).appendChild(style);
}
};
exports.importCssStylsheet = function(uri, doc) {
if (doc.createStyleSheet) {
doc.createStyleSheet(uri);
} else {
var link = exports.createElement('link');
link.rel = 'stylesheet';
link.href = uri;
exports.getDocumentHead(doc).appendChild(link);
}
};
exports.getInnerWidth = function(element) {
return (
parseInt(exports.computedStyle(element, "paddingLeft"), 10) +
parseInt(exports.computedStyle(element, "paddingRight"), 10) +
element.clientWidth
);
};
exports.getInnerHeight = function(element) {
return (
parseInt(exports.computedStyle(element, "paddingTop"), 10) +
parseInt(exports.computedStyle(element, "paddingBottom"), 10) +
element.clientHeight
);
};
exports.scrollbarWidth = function(document) {
var inner = exports.createElement("ace_inner");
inner.style.width = "100%";
inner.style.minWidth = "0px";
inner.style.height = "200px";
inner.style.display = "block";
var outer = exports.createElement("ace_outer");
var style = outer.style;
style.position = "absolute";
style.left = "-10000px";
style.overflow = "hidden";
style.width = "200px";
style.minWidth = "0px";
style.height = "150px";
style.display = "block";
outer.appendChild(inner);
var body = document.documentElement;
body.appendChild(outer);
var noScrollbar = inner.offsetWidth;
style.overflow = "scroll";
var withScrollbar = inner.offsetWidth;
if (noScrollbar == withScrollbar) {
withScrollbar = outer.clientWidth;
}
body.removeChild(outer);
return noScrollbar-withScrollbar;
};
if (typeof document == "undefined") {
exports.importCssString = function() {};
return;
}
if (window.pageYOffset !== undefined) {
exports.getPageScrollTop = function() {
return window.pageYOffset;
};
exports.getPageScrollLeft = function() {
return window.pageXOffset;
};
}
else {
exports.getPageScrollTop = function() {
return document.body.scrollTop;
};
exports.getPageScrollLeft = function() {
return document.body.scrollLeft;
};
}
if (window.getComputedStyle)
exports.computedStyle = function(element, style) {
if (style)
return (window.getComputedStyle(element, "") || {})[style] || "";
return window.getComputedStyle(element, "") || {};
};
else
exports.computedStyle = function(element, style) {
if (style)
return element.currentStyle[style];
return element.currentStyle;
};
exports.setInnerHtml = function(el, innerHtml) {
var element = el.cloneNode(false);//document.createElement("div");
element.innerHTML = innerHtml;
el.parentNode.replaceChild(element, el);
return element;
};
if ("textContent" in document.documentElement) {
exports.setInnerText = function(el, innerText) {
el.textContent = innerText;
};
exports.getInnerText = function(el) {
return el.textContent;
};
}
else {
exports.setInnerText = function(el, innerText) {
el.innerText = innerText;
};
exports.getInnerText = function(el) {
return el.innerText;
};
}
exports.getParentWindow = function(document) {
return document.defaultView || document.parentWindow;
};
});
ace.define("ace/lib/oop",["require","exports","module"], function(acequire, exports, module) {
"use strict";
exports.inherits = function(ctor, superCtor) {
ctor.super_ = superCtor;
ctor.prototype = Object.create(superCtor.prototype, {
constructor: {
value: ctor,
enumerable: false,
writable: true,
configurable: true
}
});
};
exports.mixin = function(obj, mixin) {
for (var key in mixin) {
obj[key] = mixin[key];
}
return obj;
};
exports.implement = function(proto, mixin) {
exports.mixin(proto, mixin);
};
});
ace.define("ace/lib/keys",["require","exports","module","ace/lib/fixoldbrowsers","ace/lib/oop"], function(acequire, exports, module) {
"use strict";
acequire("./fixoldbrowsers");
var oop = acequire("./oop");
var Keys = (function() {
var ret = {
MODIFIER_KEYS: {
16: 'Shift', 17: 'Ctrl', 18: 'Alt', 224: 'Meta'
},
KEY_MODS: {
"ctrl": 1, "alt": 2, "option" : 2, "shift": 4,
"super": 8, "meta": 8, "command": 8, "cmd": 8
},
FUNCTION_KEYS : {
8 : "Backspace",
9 : "Tab",
13 : "Return",
19 : "Pause",
27 : "Esc",
32 : "Space",
33 : "PageUp",
34 : "PageDown",
35 : "End",
36 : "Home",
37 : "Left",
38 : "Up",
39 : "Right",
40 : "Down",
44 : "Print",
45 : "Insert",
46 : "Delete",
96 : "Numpad0",
97 : "Numpad1",
98 : "Numpad2",
99 : "Numpad3",
100: "Numpad4",
101: "Numpad5",
102: "Numpad6",
103: "Numpad7",
104: "Numpad8",
105: "Numpad9",
'-13': "NumpadEnter",
112: "F1",
113: "F2",
114: "F3",
115: "F4",
116: "F5",
117: "F6",
118: "F7",
119: "F8",
120: "F9",
121: "F10",
122: "F11",
123: "F12",
144: "Numlock",
145: "Scrolllock"
},
PRINTABLE_KEYS: {
32: ' ', 48: '0', 49: '1', 50: '2', 51: '3', 52: '4', 53: '5',
54: '6', 55: '7', 56: '8', 57: '9', 59: ';', 61: '=', 65: 'a',
66: 'b', 67: 'c', 68: 'd', 69: 'e', 70: 'f', 71: 'g', 72: 'h',
73: 'i', 74: 'j', 75: 'k', 76: 'l', 77: 'm', 78: 'n', 79: 'o',
80: 'p', 81: 'q', 82: 'r', 83: 's', 84: 't', 85: 'u', 86: 'v',
87: 'w', 88: 'x', 89: 'y', 90: 'z', 107: '+', 109: '-', 110: '.',
186: ';', 187: '=', 188: ',', 189: '-', 190: '.', 191: '/', 192: '`',
219: '[', 220: '\\',221: ']', 222: "'", 111: '/', 106: '*'
}
};
var name, i;
for (i in ret.FUNCTION_KEYS) {
name = ret.FUNCTION_KEYS[i].toLowerCase();
ret[name] = parseInt(i, 10);
}
for (i in ret.PRINTABLE_KEYS) {
name = ret.PRINTABLE_KEYS[i].toLowerCase();
ret[name] = parseInt(i, 10);
}
oop.mixin(ret, ret.MODIFIER_KEYS);
oop.mixin(ret, ret.PRINTABLE_KEYS);
oop.mixin(ret, ret.FUNCTION_KEYS);
ret.enter = ret["return"];
ret.escape = ret.esc;
ret.del = ret["delete"];
ret[173] = '-';
(function() {
var mods = ["cmd", "ctrl", "alt", "shift"];
for (var i = Math.pow(2, mods.length); i--;) {
ret.KEY_MODS[i] = mods.filter(function(x) {
return i & ret.KEY_MODS[x];
}).join("-") + "-";
}
})();
ret.KEY_MODS[0] = "";
ret.KEY_MODS[-1] = "input-";
return ret;
})();
oop.mixin(exports, Keys);
exports.keyCodeToString = function(keyCode) {
var keyString = Keys[keyCode];
if (typeof keyString != "string")
keyString = String.fromCharCode(keyCode);
return keyString.toLowerCase();
};
});
ace.define("ace/lib/useragent",["require","exports","module"], function(acequire, exports, module) {
"use strict";
exports.OS = {
LINUX: "LINUX",
MAC: "MAC",
WINDOWS: "WINDOWS"
};
exports.getOS = function() {
if (exports.isMac) {
return exports.OS.MAC;
} else if (exports.isLinux) {
return exports.OS.LINUX;
} else {
return exports.OS.WINDOWS;
}
};
if (typeof navigator != "object")
return;
var os = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase();
var ua = navigator.userAgent;
exports.isWin = (os == "win");
exports.isMac = (os == "mac");
exports.isLinux = (os == "linux");
exports.isIE =
(navigator.appName == "Microsoft Internet Explorer" || navigator.appName.indexOf("MSAppHost") >= 0)
? parseFloat((ua.match(/(?:MSIE |Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1])
: parseFloat((ua.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]); // for ie
exports.isOldIE = exports.isIE && exports.isIE < 9;
exports.isGecko = exports.isMozilla = (window.Controllers || window.controllers) && window.navigator.product === "Gecko";
exports.isOldGecko = exports.isGecko && parseInt((ua.match(/rv:(\d+)/)||[])[1], 10) < 4;
exports.isOpera = window.opera && Object.prototype.toString.call(window.opera) == "[object Opera]";
exports.isWebKit = parseFloat(ua.split("WebKit/")[1]) || undefined;
exports.isChrome = parseFloat(ua.split(" Chrome/")[1]) || undefined;
exports.isAIR = ua.indexOf("AdobeAIR") >= 0;
exports.isIPad = ua.indexOf("iPad") >= 0;
exports.isTouchPad = ua.indexOf("TouchPad") >= 0;
exports.isChromeOS = ua.indexOf(" CrOS ") >= 0;
});
ace.define("ace/lib/event",["require","exports","module","ace/lib/keys","ace/lib/useragent"], function(acequire, exports, module) {
"use strict";
var keys = acequire("./keys");
var useragent = acequire("./useragent");
var pressedKeys = null;
var ts = 0;
exports.addListener = function(elem, type, callback) {
if (elem.addEventListener) {
return elem.addEventListener(type, callback, false);
}
if (elem.attachEvent) {
var wrapper = function() {
callback.call(elem, window.event);
};
callback._wrapper = wrapper;
elem.attachEvent("on" + type, wrapper);
}
};
exports.removeListener = function(elem, type, callback) {
if (elem.removeEventListener) {
return elem.removeEventListener(type, callback, false);
}
if (elem.detachEvent) {
elem.detachEvent("on" + type, callback._wrapper || callback);
}
};
exports.stopEvent = function(e) {
exports.stopPropagation(e);
exports.preventDefault(e);
return false;
};
exports.stopPropagation = function(e) {
if (e.stopPropagation)
e.stopPropagation();
else
e.cancelBubble = true;
};
exports.preventDefault = function(e) {
if (e.preventDefault)
e.preventDefault();
else
e.returnValue = false;
};
exports.getButton = function(e) {
if (e.type == "dblclick")
return 0;
if (e.type == "contextmenu" || (useragent.isMac && (e.ctrlKey && !e.altKey && !e.shiftKey)))
return 2;
if (e.preventDefault) {
return e.button;
}
else {
return {1:0, 2:2, 4:1}[e.button];
}
};
exports.capture = function(el, eventHandler, releaseCaptureHandler) {
function onMouseUp(e) {
eventHandler && eventHandler(e);
releaseCaptureHandler && releaseCaptureHandler(e);
exports.removeListener(document, "mousemove", eventHandler, true);
exports.removeListener(document, "mouseup", onMouseUp, true);
exports.removeListener(document, "dragstart", onMouseUp, true);
}
exports.addListener(document, "mousemove", eventHandler, true);
exports.addListener(document, "mouseup", onMouseUp, true);
exports.addListener(document, "dragstart", onMouseUp, true);
return onMouseUp;
};
exports.addTouchMoveListener = function (el, callback) {
if ("ontouchmove" in el) {
var startx, starty;
exports.addListener(el, "touchstart", function (e) {
var touchObj = e.changedTouches[0];
startx = touchObj.clientX;
starty = touchObj.clientY;
});
exports.addListener(el, "touchmove", function (e) {
var factor = 1,
touchObj = e.changedTouches[0];
e.wheelX = -(touchObj.clientX - startx) / factor;
e.wheelY = -(touchObj.clientY - starty) / factor;
startx = touchObj.clientX;
starty = touchObj.clientY;
callback(e);
});
}
};
exports.addMouseWheelListener = function(el, callback) {
if ("onmousewheel" in el) {
exports.addListener(el, "mousewheel", function(e) {
var factor = 8;
if (e.wheelDeltaX !== undefined) {
e.wheelX = -e.wheelDeltaX / factor;
e.wheelY = -e.wheelDeltaY / factor;
} else {
e.wheelX = 0;
e.wheelY = -e.wheelDelta / factor;
}
callback(e);
});
} else if ("onwheel" in el) {
exports.addListener(el, "wheel", function(e) {
var factor = 0.35;
switch (e.deltaMode) {
case e.DOM_DELTA_PIXEL:
e.wheelX = e.deltaX * factor || 0;
e.wheelY = e.deltaY * factor || 0;
break;
case e.DOM_DELTA_LINE:
case e.DOM_DELTA_PAGE:
e.wheelX = (e.deltaX || 0) * 5;
e.wheelY = (e.deltaY || 0) * 5;
break;
}
callback(e);
});
} else {
exports.addListener(el, "DOMMouseScroll", function(e) {
if (e.axis && e.axis == e.HORIZONTAL_AXIS) {
e.wheelX = (e.detail || 0) * 5;
e.wheelY = 0;
} else {
e.wheelX = 0;
e.wheelY = (e.detail || 0) * 5;
}
callback(e);
});
}
};
exports.addMultiMouseDownListener = function(elements, timeouts, eventHandler, callbackName) {
var clicks = 0;
var startX, startY, timer;
var eventNames = {
2: "dblclick",
3: "tripleclick",
4: "quadclick"
};
function onMousedown(e) {
if (exports.getButton(e) !== 0) {
clicks = 0;
} else if (e.detail > 1) {
clicks++;
if (clicks > 4)
clicks = 1;
} else {
clicks = 1;
}
if (useragent.isIE) {
var isNewClick = Math.abs(e.clientX - startX) > 5 || Math.abs(e.clientY - startY) > 5;
if (!timer || isNewClick)
clicks = 1;
if (timer)
clearTimeout(timer);
timer = setTimeout(function() {timer = null}, timeouts[clicks - 1] || 600);
if (clicks == 1) {
startX = e.clientX;
startY = e.clientY;
}
}
e._clicks = clicks;
eventHandler[callbackName]("mousedown", e);
if (clicks > 4)
clicks = 0;
else if (clicks > 1)
return eventHandler[callbackName](eventNames[clicks], e);
}
function onDblclick(e) {
clicks = 2;
if (timer)
clearTimeout(timer);
timer = setTimeout(function() {timer = null}, timeouts[clicks - 1] || 600);
eventHandler[callbackName]("mousedown", e);
eventHandler[callbackName](eventNames[clicks], e);
}
if (!Array.isArray(elements))
elements = [elements];
elements.forEach(function(el) {
exports.addListener(el, "mousedown", onMousedown);
if (useragent.isOldIE)
exports.addListener(el, "dblclick", onDblclick);
});
};
var getModifierHash = useragent.isMac && useragent.isOpera && !("KeyboardEvent" in window)
? function(e) {
return 0 | (e.metaKey ? 1 : 0) | (e.altKey ? 2 : 0) | (e.shiftKey ? 4 : 0) | (e.ctrlKey ? 8 : 0);
}
: function(e) {
return 0 | (e.ctrlKey ? 1 : 0) | (e.altKey ? 2 : 0) | (e.shiftKey ? 4 : 0) | (e.metaKey ? 8 : 0);
};
exports.getModifierString = function(e) {
return keys.KEY_MODS[getModifierHash(e)];
};
function normalizeCommandKeys(callback, e, keyCode) {
var hashId = getModifierHash(e);
if (!useragent.isMac && pressedKeys) {
if (e.getModifierState && (e.getModifierState("OS") || e.getModifierState("Win")))
hashId |= 8;
if (pressedKeys.altGr) {
if ((3 & hashId) != 3)
pressedKeys.altGr = 0;
else
return;
}
if (keyCode === 18 || keyCode === 17) {
var location = "location" in e ? e.location : e.keyLocation;
if (keyCode === 17 && location === 1) {
if (pressedKeys[keyCode] == 1)
ts = e.timeStamp;
} else if (keyCode === 18 && hashId === 3 && location === 2) {
var dt = e.timeStamp - ts;
if (dt < 50)
pressedKeys.altGr = true;
}
}
}
if (keyCode in keys.MODIFIER_KEYS) {
keyCode = -1;
}
if (hashId & 8 && (keyCode >= 91 && keyCode <= 93)) {
keyCode = -1;
}
if (!hashId && keyCode === 13) {
var location = "location" in e ? e.location : e.keyLocation;
if (location === 3) {
callback(e, hashId, -keyCode);
if (e.defaultPrevented)
return;
}
}
if (useragent.isChromeOS && hashId & 8) {
callback(e, hashId, keyCode);
if (e.defaultPrevented)
return;
else
hashId &= ~8;
}
if (!hashId && !(keyCode in keys.FUNCTION_KEYS) && !(keyCode in keys.PRINTABLE_KEYS)) {
return false;
}
return callback(e, hashId, keyCode);
}
exports.addCommandKeyListener = function(el, callback) {
var addListener = exports.addListener;
if (useragent.isOldGecko || (useragent.isOpera && !("KeyboardEvent" in window))) {
var lastKeyDownKeyCode = null;
addListener(el, "keydown", function(e) {
lastKeyDownKeyCode = e.keyCode;
});
addListener(el, "keypress", function(e) {
return normalizeCommandKeys(callback, e, lastKeyDownKeyCode);
});
} else {
var lastDefaultPrevented = null;
addListener(el, "keydown", function(e) {
pressedKeys[e.keyCode] = (pressedKeys[e.keyCode] || 0) + 1;
var result = normalizeCommandKeys(callback, e, e.keyCode);
lastDefaultPrevented = e.defaultPrevented;
return result;
});
addListener(el, "keypress", function(e) {
if (lastDefaultPrevented && (e.ctrlKey || e.altKey || e.shiftKey || e.metaKey)) {
exports.stopEvent(e);
lastDefaultPrevented = null;
}
});
addListener(el, "keyup", function(e) {
pressedKeys[e.keyCode] = null;
});
if (!pressedKeys) {
resetPressedKeys();
addListener(window, "focus", resetPressedKeys);
}
}
};
function resetPressedKeys() {
pressedKeys = Object.create(null);
}
if (typeof window == "object" && window.postMessage && !useragent.isOldIE) {
var postMessageId = 1;
exports.nextTick = function(callback, win) {
win = win || window;
var messageName = "zero-timeout-message-" + postMessageId;
exports.addListener(win, "message", function listener(e) {
if (e.data == messageName) {
exports.stopPropagation(e);
exports.removeListener(win, "message", listener);
callback();
}
});
win.postMessage(messageName, "*");
};
}
exports.nextFrame = typeof window == "object" && (window.requestAnimationFrame
|| window.mozRequestAnimationFrame
|| window.webkitRequestAnimationFrame
|| window.msRequestAnimationFrame
|| window.oRequestAnimationFrame);
if (exports.nextFrame)
exports.nextFrame = exports.nextFrame.bind(window);
else
exports.nextFrame = function(callback) {
setTimeout(callback, 17);
};
});
ace.define("ace/lib/lang",["require","exports","module"], function(acequire, exports, module) {
"use strict";
exports.last = function(a) {
return a[a.length - 1];
};
exports.stringReverse = function(string) {
return string.split("").reverse().join("");
};
exports.stringRepeat = function (string, count) {
var result = '';
while (count > 0) {
if (count & 1)
result += string;
if (count >>= 1)
string += string;
}
return result;
};
var trimBeginRegexp = /^\s\s*/;
var trimEndRegexp = /\s\s*$/;
exports.stringTrimLeft = function (string) {
return string.replace(trimBeginRegexp, '');
};
exports.stringTrimRight = function (string) {
return string.replace(trimEndRegexp, '');
};
exports.copyObject = function(obj) {
var copy = {};
for (var key in obj) {
copy[key] = obj[key];
}
return copy;
};
exports.copyArray = function(array){
var copy = [];
for (var i=0, l=array.length; i<l; i++) {
if (array[i] && typeof array[i] == "object")
copy[i] = this.copyObject(array[i]);
else
copy[i] = array[i];
}
return copy;
};
exports.deepCopy = function deepCopy(obj) {
if (typeof obj !== "object" || !obj)
return obj;
var copy;
if (Array.isArray(obj)) {
copy = [];
for (var key = 0; key < obj.length; key++) {
copy[key] = deepCopy(obj[key]);
}
return copy;
}
if (Object.prototype.toString.call(obj) !== "[object Object]")
return obj;
copy = {};
for (var key in obj)
copy[key] = deepCopy(obj[key]);
return copy;
};
exports.arrayToMap = function(arr) {
var map = {};
for (var i=0; i<arr.length; i++) {
map[arr[i]] = 1;
}
return map;
};
exports.createMap = function(props) {
var map = Object.create(null);
for (var i in props) {
map[i] = props[i];
}
return map;
};
exports.arrayRemove = function(array, value) {
for (var i = 0; i <= array.length; i++) {
if (value === array[i]) {
array.splice(i, 1);
}
}
};
exports.escapeRegExp = function(str) {
return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
};
exports.escapeHTML = function(str) {
return str.replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(/</g, "<");
};
exports.getMatchOffsets = function(string, regExp) {
var matches = [];
string.replace(regExp, function(str) {
matches.push({
offset: arguments[arguments.length-2],
length: str.length
});
});
return matches;
};
exports.deferredCall = function(fcn) {
var timer = null;
var callback = function() {
timer = null;
fcn();
};
var deferred = function(timeout) {
deferred.cancel();
timer = setTimeout(callback, timeout || 0);
return deferred;
};
deferred.schedule = deferred;
deferred.call = function() {
this.cancel();
fcn();
return deferred;
};
deferred.cancel = function() {
clearTimeout(timer);
timer = null;
return deferred;
};
deferred.isPending = function() {
return timer;
};
return deferred;
};
exports.delayedCall = function(fcn, defaultTimeout) {
var timer = null;
var callback = function() {
timer = null;
fcn();
};
var _self = function(timeout) {
if (timer == null)
timer = setTimeout(callback, timeout || defaultTimeout);
};
_self.delay = function(timeout) {
timer && clearTimeout(timer);
timer = setTimeout(callback, timeout || defaultTimeout);
};
_self.schedule = _self;
_self.call = function() {
this.cancel();
fcn();
};
_self.cancel = function() {
timer && clearTimeout(timer);
timer = null;
};
_self.isPending = function() {
return timer;
};
return _self;
};
});
ace.define("ace/keyboard/textinput",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/lib/dom","ace/lib/lang"], function(acequire, exports, module) {
"use strict";
var event = acequire("../lib/event");
var useragent = acequire("../lib/useragent");
var dom = acequire("../lib/dom");
var lang = acequire("../lib/lang");
var BROKEN_SETDATA = useragent.isChrome < 18;
var USE_IE_MIME_TYPE = useragent.isIE;
var TextInput = function(parentNode, host) {
var text = dom.createElement("textarea");
text.className = "ace_text-input";
if (useragent.isTouchPad)
text.setAttribute("x-palm-disable-auto-cap", true);
text.setAttribute("wrap", "off");
text.setAttribute("autocorrect", "off");
text.setAttribute("autocapitalize", "off");
text.setAttribute("spellcheck", false);
text.style.opacity = "0";
if (useragent.isOldIE) text.style.top = "-1000px";
parentNode.insertBefore(text, parentNode.firstChild);
var PLACEHOLDER = "\x01\x01";
var copied = false;
var pasted = false;
var inComposition = false;
var tempStyle = '';
var isSelectionEmpty = true;
try { var isFocused = document.activeElement === text; } catch(e) {}
event.addListener(text, "blur", function(e) {
host.onBlur(e);
isFocused = false;
});
event.addListener(text, "focus", function(e) {
isFocused = true;
host.onFocus(e);
resetSelection();
});
this.focus = function() {
if (tempStyle) return text.focus();
var top = text.style.top;
text.style.position = "fixed";
text.style.top = "0px";
text.focus();
setTimeout(function() {
text.style.position = "";
if (text.style.top == "0px")
text.style.top = top;
}, 0);
};
this.blur = function() {
text.blur();
};
this.isFocused = function() {
return isFocused;
};
var syncSelection = lang.delayedCall(function() {
isFocused && resetSelection(isSelectionEmpty);
});
var syncValue = lang.delayedCall(function() {
if (!inComposition) {
text.value = PLACEHOLDER;
isFocused && resetSelection();
}
});
function resetSelection(isEmpty) {
if (inComposition)
return;
inComposition = true;
if (inputHandler) {
selectionStart = 0;
selectionEnd = isEmpty ? 0 : text.value.length - 1;
} else {
var selectionStart = isEmpty ? 2 : 1;
var selectionEnd = 2;
}
try {
text.setSelectionRange(selectionStart, selectionEnd);
} catch(e){}
inComposition = false;
}
function resetValue() {
if (inComposition)
return;
text.value = PLACEHOLDER;
if (useragent.isWebKit)
syncValue.schedule();
}
useragent.isWebKit || host.addEventListener('changeSelection', function() {
if (host.selection.isEmpty() != isSelectionEmpty) {
isSelectionEmpty = !isSelectionEmpty;
syncSelection.schedule();
}
});
resetValue();
if (isFocused)
host.onFocus();
var isAllSelected = function(text) {
return text.selectionStart === 0 && text.selectionEnd === text.value.length;
};
if (!text.setSelectionRange && text.createTextRange) {
text.setSelectionRange = function(selectionStart, selectionEnd) {
var range = this.createTextRange();
range.collapse(true);
range.moveStart('character', selectionStart);
range.moveEnd('character', selectionEnd);
range.select();
};
isAllSelected = function(text) {
try {
var range = text.ownerDocument.selection.createRange();
}catch(e) {}
if (!range || range.parentElement() != text) return false;
return range.text == text.value;
}
}
if (useragent.isOldIE) {
var inPropertyChange = false;
var onPropertyChange = function(e){
if (inPropertyChange)
return;
var data = text.value;
if (inComposition || !data || data == PLACEHOLDER)
return;
if (e && data == PLACEHOLDER[0])
return syncProperty.schedule();
sendText(data);
inPropertyChange = true;
resetValue();
inPropertyChange = false;
};
var syncProperty = lang.delayedCall(onPropertyChange);
event.addListener(text, "propertychange", onPropertyChange);
var keytable = { 13:1, 27:1 };
event.addListener(text, "keyup", function (e) {
if (inComposition && (!text.value || keytable[e.keyCode]))
setTimeout(onCompositionEnd, 0);
if ((text.value.charCodeAt(0)||0) < 129) {
return syncProperty.call();
}
inComposition ? onCompositionUpdate() : onCompositionStart();
});
event.addListener(text, "keydown", function (e) {
syncProperty.schedule(50);
});
}
var onSelect = function(e) {
if (copied) {
copied = false;
} else if (isAllSelected(text)) {
host.selectAll();
resetSelection();
} else if (inputHandler) {
resetSelection(host.selection.isEmpty());
}
};
var inputHandler = null;
this.setInputHandler = function(cb) {inputHandler = cb};
this.getInputHandler = function() {return inputHandler};
var afterContextMenu = false;
var sendText = function(data) {
if (inputHandler) {
data = inputHandler(data);
inputHandler = null;
}
if (pasted) {
resetSelection();
if (data)
host.onPaste(data);
pasted = false;
} else if (data == PLACEHOLDER.charAt(0)) {
if (afterContextMenu)
host.execCommand("del", {source: "ace"});
else // some versions of android do not fire keydown when pressing backspace
host.execCommand("backspace", {source: "ace"});
} else {
if (data.substring(0, 2) == PLACEHOLDER)
data = data.substr(2);
else if (data.charAt(0) == PLACEHOLDER.charAt(0))
data = data.substr(1);
else if (data.charAt(data.length - 1) == PLACEHOLDER.charAt(0))
data = data.slice(0, -1);
if (data.charAt(data.length - 1) == PLACEHOLDER.charAt(0))
data = data.slice(0, -1);
if (data)
host.onTextInput(data);
}
if (afterContextMenu)
afterContextMenu = false;
};
var onInput = function(e) {
if (inComposition)
return;
var data = text.value;
sendText(data);
resetValue();
};
var handleClipboardData = function(e, data, forceIEMime) {
var clipboardData = e.clipboardData || window.clipboardData;
if (!clipboardData || BROKEN_SETDATA)
return;
var mime = USE_IE_MIME_TYPE || forceIEMime ? "Text" : "text/plain";
try {
if (data) {
return clipboardData.setData(mime, data) !== false;
} else {
return clipboardData.getData(mime);
}
} catch(e) {
if (!forceIEMime)
return handleClipboardData(e, data, true);
}
};
var doCopy = function(e, isCut) {
var data = host.getCopyText();
if (!data)
return event.preventDefault(e);
if (handleClipboardData(e, data)) {
isCut ? host.onCut() : host.onCopy();
event.preventDefault(e);
} else {
copied = true;
text.value = data;
text.select();
setTimeout(function(){
copied = false;
resetValue();
resetSelection();
isCut ? host.onCut() : host.onCopy();
});
}
};
var onCut = function(e) {
doCopy(e, true);
};
var onCopy = function(e) {
doCopy(e, false);
};
var onPaste = function(e) {
var data = handleClipboardData(e);
if (typeof data == "string") {
if (data)
host.onPaste(data, e);
if (useragent.isIE)
setTimeout(resetSelection);
event.preventDefault(e);
}
else {
text.value = "";
pasted = true;
}
};
event.addCommandKeyListener(text, host.onCommandKey.bind(host));
event.addListener(text, "select", onSelect);
event.addListener(text, "input", onInput);
event.addListener(text, "cut", onCut);
event.addListener(text, "copy", onCopy);
event.addListener(text, "paste", onPaste);
if (!('oncut' in text) || !('oncopy' in text) || !('onpaste' in text)){
event.addListener(parentNode, "keydown", function(e) {
if ((useragent.isMac && !e.metaKey) || !e.ctrlKey)
return;
switch (e.keyCode) {
case 67:
onCopy(e);
break;
case 86:
onPaste(e);
break;
case 88:
onCut(e);
break;
}
});
}
var onCompositionStart = function(e) {
if (inComposition || !host.onCompositionStart || host.$readOnly)
return;
inComposition = {};
inComposition.canUndo = host.session.$undoManager;
host.onCompositionStart();
setTimeout(onCompositionUpdate, 0);
host.on("mousedown", onCompositionEnd);
if (inComposition.canUndo && !host.selection.isEmpty()) {
host.insert("");
host.session.markUndoGroup();
host.selection.clearSelection();
}
host.session.markUndoGroup();
};
var onCompositionUpdate = function() {
if (!inComposition || !host.onCompositionUpdate || host.$readOnly)
return;
var val = text.value.replace(/\x01/g, "");
if (inComposition.lastValue === val) return;
host.onCompositionUpdate(val);
if (inComposition.lastValue)
host.undo();
if (inComposition.canUndo)
inComposition.lastValue = val;
if (inComposition.lastValue) {
var r = host.selection.getRange();
host.insert(inComposition.lastValue);
host.session.markUndoGroup();
inComposition.range = host.selection.getRange();
host.selection.setRange(r);
host.selection.clearSelection();
}
};
var onCompositionEnd = function(e) {
if (!host.onCompositionEnd || host.$readOnly) return;
var c = inComposition;
inComposition = false;
var timer = setTimeout(function() {
timer = null;
var str = text.value.replace(/\x01/g, "");
if (inComposition)
return;
else if (str == c.lastValue)
resetValue();
else if (!c.lastValue && str) {
resetValue();
sendText(str);
}
});
inputHandler = function compositionInputHandler(str) {
if (timer)
clearTimeout(timer);
str = str.replace(/\x01/g, "");
if (str == c.lastValue)
return "";
if (c.lastValue && timer)
host.undo();
return str;
};
host.onCompositionEnd();
host.removeListener("mousedown", onCompositionEnd);
if (e.type == "compositionend" && c.range) {
host.selection.setRange(c.range);
}
if (useragent.isChrome && useragent.isChrome >= 53) {
onInput();
}
};
var syncComposition = lang.delayedCall(onCompositionUpdate, 50);
event.addListener(text, "compositionstart", onCompositionStart);
if (useragent.isGecko) {
event.addListener(text, "text", function(){syncComposition.schedule()});
} else {
event.addListener(text, "keyup", function(){syncComposition.schedule()});
event.addListener(text, "keydown", function(){syncComposition.schedule()});
}
event.addListener(text, "compositionend", onCompositionEnd);
this.getElement = function() {
return text;
};
this.setReadOnly = function(readOnly) {
text.readOnly = readOnly;
};
this.onContextMenu = function(e) {
afterContextMenu = true;
resetSelection(host.selection.isEmpty());
host._emit("nativecontextmenu", {target: host, domEvent: e});
this.moveToMouse(e, true);
};
this.moveToMouse = function(e, bringToFront) {
if (!bringToFront && useragent.isOldIE)
return;
if (!tempStyle)
tempStyle = text.style.cssText;
text.style.cssText = (bringToFront ? "z-index:100000;" : "")
+ "height:" + text.style.height + ";"
+ (useragent.isIE ? "opacity:0.1;" : "");
var rect = host.container.getBoundingClientRect();
var style = dom.computedStyle(host.container);
var top = rect.top + (parseInt(style.borderTopWidth) || 0);
var left = rect.left + (parseInt(rect.borderLeftWidth) || 0);
var maxTop = rect.bottom - top - text.clientHeight -2;
var move = function(e) {
text.style.left = e.clientX - left - 2 + "px";
text.style.top = Math.min(e.clientY - top - 2, maxTop) + "px";
};
move(e);
if (e.type != "mousedown")
return;
if (host.renderer.$keepTextAreaAtCursor)
host.renderer.$keepTextAreaAtCursor = null;
clearTimeout(closeTimeout);
if (useragent.isWin && !useragent.isOldIE)
event.capture(host.container, move, onContextMenuClose);
};
this.onContextMenuClose = onContextMenuClose;
var closeTimeout;
function onContextMenuClose() {
clearTimeout(closeTimeout);
closeTimeout = setTimeout(function () {
if (tempStyle) {
text.style.cssText = tempStyle;
tempStyle = '';
}
if (host.renderer.$keepTextAreaAtCursor == null) {
host.renderer.$keepTextAreaAtCursor = true;
host.renderer.$moveTextAreaToCursor();
}
}, useragent.isOldIE ? 200 : 0);
}
var onContextMenu = function(e) {
host.textInput.onContextMenu(e);
onContextMenuClose();
};
event.addListener(text, "mouseup", onContextMenu);
event.addListener(text, "mousedown", function(e) {
e.preventDefault();
onContextMenuClose();
});
event.addListener(host.renderer.scroller, "contextmenu", onContextMenu);
event.addListener(text, "contextmenu", onContextMenu);
};
exports.TextInput = TextInput;
});
ace.define("ace/mouse/default_handlers",["require","exports","module","ace/lib/dom","ace/lib/event","ace/lib/useragent"], function(acequire, exports, module) {
"use strict";
var dom = acequire("../lib/dom");
var event = acequire("../lib/event");
var useragent = acequire("../lib/useragent");
var DRAG_OFFSET = 0; // pixels
function DefaultHandlers(mouseHandler) {
mouseHandler.$clickSelection = null;
var editor = mouseHandler.editor;
editor.setDefaultHandler("mousedown", this.onMouseDown.bind(mouseHandler));
editor.setDefaultHandler("dblclick", this.onDoubleClick.bind(mouseHandler));
editor.setDefaultHandler("tripleclick", this.onTripleClick.bind(mouseHandler));
editor.setDefaultHandler("quadclick", this.onQuadClick.bind(mouseHandler));
editor.setDefaultHandler("mousewheel", this.onMouseWheel.bind(mouseHandler));
editor.setDefaultHandler("touchmove", this.onTouchMove.bind(mouseHandler));
var exports = ["select", "startSelect", "selectEnd", "selectAllEnd", "selectByWordsEnd",
"selectByLinesEnd", "dragWait", "dragWaitEnd", "focusWait"];
exports.forEach(function(x) {
mouseHandler[x] = this[x];
}, this);
mouseHandler.selectByLines = this.extendSelectionBy.bind(mouseHandler, "getLineRange");
mouseHandler.selectByWords = this.extendSelectionBy.bind(mouseHandler, "getWordRange");
}
(function() {
this.onMouseDown = function(ev) {
var inSelection = ev.inSelection();
var pos = ev.getDocumentPosition();
this.mousedownEvent = ev;
var editor = this.editor;
var button = ev.getButton();
if (button !== 0) {
var selectionRange = editor.getSelectionRange();
var selectionEmpty = selectionRange.isEmpty();
editor.$blockScrolling++;
if (selectionEmpty || button == 1)
editor.selection.moveToPosition(pos);
editor.$blockScrolling--;
if (button == 2)
editor.textInput.onContextMenu(ev.domEvent);
return; // stopping event here breaks contextmenu on ff mac
}
this.mousedownEvent.time = Date.now();
if (inSelection && !editor.isFocused()) {
editor.focus();
if (this.$focusTimout && !this.$clickSelection && !editor.inMultiSelectMode) {
this.setState("focusWait");
this.captureMouse(ev);
return;
}
}
this.captureMouse(ev);
this.startSelect(pos, ev.domEvent._clicks > 1);
return ev.preventDefault();
};
this.startSelect = function(pos, waitForClickSelection) {
pos = pos || this.editor.renderer.screenToTextCoordinates(this.x, this.y);
var editor = this.editor;
editor.$blockScrolling++;
if (this.mousedownEvent.getShiftKey())
editor.selection.selectToPosition(pos);
else if (!waitForClickSelection)
editor.selection.moveToPosition(pos);
if (!waitForClickSelection)
this.select();
if (editor.renderer.scroller.setCapture) {
editor.renderer.scroller.setCapture();
}
editor.setStyle("ace_selecting");
this.setState("select");
editor.$blockScrolling--;
};
this.select = function() {
var anchor, editor = this.editor;
var cursor = editor.renderer.screenToTextCoordinates(this.x, this.y);
editor.$blockScrolling++;
if (this.$clickSelection) {
var cmp = this.$clickSelection.comparePoint(cursor);
if (cmp == -1) {
anchor = this.$clickSelection.end;
} else if (cmp == 1) {
anchor = this.$clickSelection.start;
} else {
var orientedRange = calcRangeOrientation(this.$clickSelection, cursor);
cursor = orientedRange.cursor;
anchor = orientedRange.anchor;
}
editor.selection.setSelectionAnchor(anchor.row, anchor.column);
}
editor.selection.selectToPosition(cursor);
editor.$blockScrolling--;
editor.renderer.scrollCursorIntoView();
};
this.extendSelectionBy = function(unitName) {
var anchor, editor = this.editor;
var cursor = editor.renderer.screenToTextCoordinates(this.x, this.y);
var range = editor.selection[unitName](cursor.row, cursor.column);
editor.$blockScrolling++;
if (this.$clickSelection) {
var cmpStart = this.$clickSelection.comparePoint(range.start);
var cmpEnd = this.$clickSelection.comparePoint(range.end);
if (cmpStart == -1 && cmpEnd <= 0) {
anchor = this.$clickSelection.end;
if (range.end.row != cursor.row || range.end.column != cursor.column)
cursor = range.start;
} else if (cmpEnd == 1 && cmpStart >= 0) {
anchor = this.$clickSelection.start;
if (range.start.row != cursor.row || range.start.column != cursor.column)
cursor = range.end;
} else if (cmpStart == -1 && cmpEnd == 1) {
cursor = range.end;
anchor = range.start;
} else {
var orientedRange = calcRangeOrientation(this.$clickSelection, cursor);
cursor = orientedRange.cursor;
anchor = orientedRange.anchor;
}
editor.selection.setSelectionAnchor(anchor.row, anchor.column);
}
editor.selection.selectToPosition(cursor);
editor.$blockScrolling--;
editor.renderer.scrollCursorIntoView();
};
this.selectEnd =
this.selectAllEnd =
this.selectByWordsEnd =
this.selectByLinesEnd = function() {
this.$clickSelection = null;
this.editor.unsetStyle("ace_selecting");
if (this.editor.renderer.scroller.releaseCapture) {
this.editor.renderer.scroller.releaseCapture();
}
};
this.focusWait = function() {
var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y);
var time = Date.now();
if (distance > DRAG_OFFSET || time - this.mousedownEvent.time > this.$focusTimout)
this.startSelect(this.mousedownEvent.getDocumentPosition());
};
this.onDoubleClick = function(ev) {
var pos = ev.getDocumentPosition();
var editor = this.editor;
var session = editor.session;
var range = session.getBracketRange(pos);
if (range) {
if (range.isEmpty()) {
range.start.column--;
range.end.column++;
}
this.setState("select");
} else {
range = editor.selection.getWordRange(pos.row, pos.column);
this.setState("selectByWords");
}
this.$clickSelection = range;
this.select();
};
this.onTripleClick = function(ev) {
var pos = ev.getDocumentPosition();
var editor = this.editor;
this.setState("selectByLines");
var range = editor.getSelectionRange();
if (range.isMultiLine() && range.contains(pos.row, pos.column)) {
this.$clickSelection = editor.selection.getLineRange(range.start.row);
this.$clickSelection.end = editor.selection.getLineRange(range.end.row).end;
} else {
this.$clickSelection = editor.selection.getLineRange(pos.row);
}
this.select();
};
this.onQuadClick = function(ev) {
var editor = this.editor;
editor.selectAll();
this.$clickSelection = editor.getSelectionRange();
this.setState("selectAll");
};
this.onMouseWheel = function(ev) {
if (ev.getAccelKey())
return;
if (ev.getShiftKey() && ev.wheelY && !ev.wheelX) {
ev.wheelX = ev.wheelY;
ev.wheelY = 0;
}
var t = ev.domEvent.timeStamp;
var dt = t - (this.$lastScrollTime||0);
var editor = this.editor;
var isScrolable = editor.renderer.isScrollableBy(ev.wheelX * ev.speed, ev.wheelY * ev.speed);
if (isScrolable || dt < 200) {
this.$lastScrollTime = t;
editor.renderer.scrollBy(ev.wheelX * ev.speed, ev.wheelY * ev.speed);
return ev.stop();
}
};
this.onTouchMove = function (ev) {
var t = ev.domEvent.timeStamp;
var dt = t - (this.$lastScrollTime || 0);
var editor = this.editor;
var isScrolable = editor.renderer.isScrollableBy(ev.wheelX * ev.speed, ev.wheelY * ev.speed);
if (isScrolable || dt < 200) {
this.$lastScrollTime = t;
editor.renderer.scrollBy(ev.wheelX * ev.speed, ev.wheelY * ev.speed);
return ev.stop();
}
};
}).call(DefaultHandlers.prototype);
exports.DefaultHandlers = DefaultHandlers;
function calcDistance(ax, ay, bx, by) {
return Math.sqrt(Math.pow(bx - ax, 2) + Math.pow(by - ay, 2));
}
function calcRangeOrientation(range, cursor) {
if (range.start.row == range.end.row)
var cmp = 2 * cursor.column - range.start.column - range.end.column;
else if (range.start.row == range.end.row - 1 && !range.start.column && !range.end.column)
var cmp = cursor.column - 4;
else
var cmp = 2 * cursor.row - range.start.row - range.end.row;
if (cmp < 0)
return {cursor: range.start, anchor: range.end};
else
return {cursor: range.end, anchor: range.start};
}
});
ace.define("ace/tooltip",["require","exports","module","ace/lib/oop","ace/lib/dom"], function(acequire, exports, module) {
"use strict";
var oop = acequire("./lib/oop");
var dom = acequire("./lib/dom");
function Tooltip (parentNode) {
this.isOpen = false;
this.$element = null;
this.$parentNode = parentNode;
}
(function() {
this.$init = function() {
this.$element = dom.createElement("div");
this.$element.className = "ace_tooltip";
this.$element.style.display = "none";
this.$parentNode.appendChild(this.$element);
return this.$element;
};
this.getElement = function() {
return this.$element || this.$init();
};
this.setText = function(text) {
dom.setInnerText(this.getElement(), text);
};
this.setHtml = function(html) {
this.getElement().innerHTML = html;
};
this.setPosition = function(x, y) {
this.getElement().style.left = x + "px";
this.getElement().style.top = y + "px";
};
this.setClassName = function(className) {
dom.addCssClass(this.getElement(), className);
};
this.show = function(text, x, y) {
if (text != null)
this.setText(text);
if (x != null && y != null)
this.setPosition(x, y);
if (!this.isOpen) {
this.getElement().style.display = "block";
this.isOpen = true;
}
};
this.hide = function() {
if (this.isOpen) {
this.getElement().style.display = "none";
this.isOpen = false;
}
};
this.getHeight = function() {
return this.getElement().offsetHeight;
};
this.getWidth = function() {
return this.getElement().offsetWidth;
};
}).call(Tooltip.prototype);
exports.Tooltip = Tooltip;
});
ace.define("ace/mouse/default_gutter_handler",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event","ace/tooltip"], function(acequire, exports, module) {
"use strict";
var dom = acequire("../lib/dom");
var oop = acequire("../lib/oop");
var event = acequire("../lib/event");
var Tooltip = acequire("../tooltip").Tooltip;
function GutterHandler(mouseHandler) {
var editor = mouseHandler.editor;
var gutter = editor.renderer.$gutterLayer;
var tooltip = new GutterTooltip(editor.container);
mouseHandler.editor.setDefaultHandler("guttermousedown", function(e) {
if (!editor.isFocused() || e.getButton() != 0)
return;
var gutterRegion = gutter.getRegion(e);
if (gutterRegion == "foldWidgets")
return;
var row = e.getDocumentPosition().row;
var selection = editor.session.selection;
if (e.getShiftKey())
selection.selectTo(row, 0);
else {
if (e.domEvent.detail == 2) {
editor.selectAll();
return e.preventDefault();
}
mouseHandler.$clickSelection = editor.selection.getLineRange(row);
}
mouseHandler.setState("selectByLines");
mouseHandler.captureMouse(e);
return e.preventDefault();
});
var tooltipTimeout, mouseEvent, tooltipAnnotation;
function showTooltip() {
var row = mouseEvent.getDocumentPosition().row;
var annotation = gutter.$annotations[row];
if (!annotation)
return hideTooltip();
var maxRow = editor.session.getLength();
if (row == maxRow) {
var screenRow = editor.renderer.pixelToScreenCoordinates(0, mouseEvent.y).row;
var pos = mouseEvent.$pos;
if (screenRow > editor.session.documentToScreenRow(pos.row, pos.column))
return hideTooltip();
}
if (tooltipAnnotation == annotation)
return;
tooltipAnnotation = annotation.text.join("<br/>");
tooltip.setHtml(tooltipAnnotation);
tooltip.show();
editor._signal("showGutterTooltip", tooltip);
editor.on("mousewheel", hideTooltip);
if (mouseHandler.$tooltipFollowsMouse) {
moveTooltip(mouseEvent);
} else {
var gutterElement = mouseEvent.domEvent.target;
var rect = gutterElement.getBoundingClientRect();
var style = tooltip.getElement().style;
style.left = rect.right + "px";
style.top = rect.bottom + "px";
}
}
function hideTooltip() {
if (tooltipTimeout)
tooltipTimeout = clearTimeout(tooltipTimeout);
if (tooltipAnnotation) {
tooltip.hide();
tooltipAnnotation = null;
editor._signal("hideGutterTooltip", tooltip);
editor.removeEventListener("mousewheel", hideTooltip);
}
}
function moveTooltip(e) {
tooltip.setPosition(e.x, e.y);
}
mouseHandler.editor.setDefaultHandler("guttermousemove", function(e) {
var target = e.domEvent.target || e.domEvent.srcElement;
if (dom.hasCssClass(target, "ace_fold-widget"))
return hideTooltip();
if (tooltipAnnotation && mouseHandler.$tooltipFollowsMouse)
moveTooltip(e);
mouseEvent = e;
if (tooltipTimeout)
return;
tooltipTimeout = setTimeout(function() {
tooltipTimeout = null;
if (mouseEvent && !mouseHandler.isMousePressed)
showTooltip();
else
hideTooltip();
}, 50);
});
event.addListener(editor.renderer.$gutter, "mouseout", function(e) {
mouseEvent = null;
if (!tooltipAnnotation || tooltipTimeout)
return;
tooltipTimeout = setTimeout(function() {
tooltipTimeout = null;
hideTooltip();
}, 50);
});
editor.on("changeSession", hideTooltip);
}
function GutterTooltip(parentNode) {
Tooltip.call(this, parentNode);
}
oop.inherits(GutterTooltip, Tooltip);
(function(){
this.setPosition = function(x, y) {
var windowWidth = window.innerWidth || document.documentElement.clientWidth;
var windowHeight = window.innerHeight || document.documentElement.clientHeight;
var width = this.getWidth();
var height = this.getHeight();
x += 15;
y += 15;
if (x + width > windowWidth) {
x -= (x + width) - windowWidth;
}
if (y + height > windowHeight) {
y -= 20 + height;
}
Tooltip.prototype.setPosition.call(this, x, y);
};
}).call(GutterTooltip.prototype);
exports.GutterHandler = GutterHandler;
});
ace.define("ace/mouse/mouse_event",["require","exports","module","ace/lib/event","ace/lib/useragent"], function(acequire, exports, module) {
"use strict";
var event = acequire("../lib/event");
var useragent = acequire("../lib/useragent");
var MouseEvent = exports.MouseEvent = function(domEvent, editor) {
this.domEvent = domEvent;
this.editor = editor;
this.x = this.clientX = domEvent.clientX;
this.y = this.clientY = domEvent.clientY;
this.$pos = null;
this.$inSelection = null;
this.propagationStopped = false;
this.defaultPrevented = false;
};
(function() {
this.stopPropagation = function() {
event.stopPropagation(this.domEvent);
this.propagationStopped = true;
};
this.preventDefault = function() {
event.preventDefault(this.domEvent);
this.defaultPrevented = true;
};
this.stop = function() {
this.stopPropagation();
this.preventDefault();
};
this.getDocumentPosition = function() {
if (this.$pos)
return this.$pos;
this.$pos = this.editor.renderer.screenToTextCoordinates(this.clientX, this.clientY);
return this.$pos;
};
this.inSelection = function() {
if (this.$inSelection !== null)
return this.$inSelection;
var editor = this.editor;
var selectionRange = editor.getSelectionRange();
if (selectionRange.isEmpty())
this.$inSelection = false;
else {
var pos = this.getDocumentPosition();
this.$inSelection = selectionRange.contains(pos.row, pos.column);
}
return this.$inSelection;
};
this.getButton = function() {
return event.getButton(this.domEvent);
};
this.getShiftKey = function() {
return this.domEvent.shiftKey;
};
this.getAccelKey = useragent.isMac
? function() { return this.domEvent.metaKey; }
: function() { return this.domEvent.ctrlKey; };
}).call(MouseEvent.prototype);
});
ace.define("ace/mouse/dragdrop_handler",["require","exports","module","ace/lib/dom","ace/lib/event","ace/lib/useragent"], function(acequire, exports, module) {
"use strict";
var dom = acequire("../lib/dom");
var event = acequire("../lib/event");
var useragent = acequire("../lib/useragent");
var AUTOSCROLL_DELAY = 200;
var SCROLL_CURSOR_DELAY = 200;
var SCROLL_CURSOR_HYSTERESIS = 5;
function DragdropHandler(mouseHandler) {
var editor = mouseHandler.editor;
var blankImage = dom.createElement("img");
blankImage.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
if (useragent.isOpera)
blankImage.style.cssText = "width:1px;height:1px;position:fixed;top:0;left:0;z-index:2147483647;opacity:0;";
var exports = ["dragWait", "dragWaitEnd", "startDrag", "dragReadyEnd", "onMouseDrag"];
exports.forEach(function(x) {
mouseHandler[x] = this[x];
}, this);
editor.addEventListener("mousedown", this.onMouseDown.bind(mouseHandler));
var mouseTarget = editor.container;
var dragSelectionMarker, x, y;
var timerId, range;
var dragCursor, counter = 0;
var dragOperation;
var isInternal;
var autoScrollStartTime;
var cursorMovedTime;
var cursorPointOnCaretMoved;
this.onDragStart = function(e) {
if (this.cancelDrag || !mouseTarget.draggable) {
var self = this;
setTimeout(function(){
self.startSelect();
self.captureMouse(e);
}, 0);
return e.preventDefault();
}
range = editor.getSelectionRange();
var dataTransfer = e.dataTransfer;
dataTransfer.effectAllowed = editor.getReadOnly() ? "copy" : "copyMove";
if (useragent.isOpera) {
editor.container.appendChild(blankImage);
blankImage.scrollTop = 0;
}
dataTransfer.setDragImage && dataTransfer.setDragImage(blankImage, 0, 0);
if (useragent.isOpera) {
editor.container.removeChild(blankImage);
}
dataTransfer.clearData();
dataTransfer.setData("Text", editor.session.getTextRange());
isInternal = true;
this.setState("drag");
};
this.onDragEnd = function(e) {
mouseTarget.draggable = false;
isInternal = false;
this.setState(null);
if (!editor.getReadOnly()) {
var dropEffect = e.dataTransfer.dropEffect;
if (!dragOperation && dropEffect == "move")
editor.session.remove(editor.getSelectionRange());
editor.renderer.$cursorLayer.setBlinking(true);
}
this.editor.unsetStyle("ace_dragging");
this.editor.renderer.setCursorStyle("");
};
this.onDragEnter = function(e) {
if (editor.getReadOnly() || !canAccept(e.dataTransfer))
return;
x = e.clientX;
y = e.clientY;
if (!dragSelectionMarker)
addDragMarker();
counter++;
e.dataTransfer.dropEffect = dragOperation = getDropEffect(e);
return event.preventDefault(e);
};
this.onDragOver = function(e) {
if (editor.getReadOnly() || !canAccept(e.dataTransfer))
return;
x = e.clientX;
y = e.clientY;
if (!dragSelectionMarker) {
addDragMarker();
counter++;
}
if (onMouseMoveTimer !== null)
onMouseMoveTimer = null;
e.dataTransfer.dropEffect = dragOperation = getDropEffect(e);
return event.preventDefault(e);
};
this.onDragLeave = function(e) {
counter--;
if (counter <= 0 && dragSelectionMarker) {
clearDragMarker();
dragOperation = null;
return event.preventDefault(e);
}
};
this.onDrop = function(e) {
if (!dragCursor)
return;
var dataTransfer = e.dataTransfer;
if (isInternal) {
switch (dragOperation) {
case "move":
if (range.contains(dragCursor.row, dragCursor.column)) {
range = {
start: dragCursor,
end: dragCursor
};
} else {
range = editor.moveText(range, dragCursor);
}
break;
case "copy":
range = editor.moveText(range, dragCursor, true);
break;
}
} else {
var dropData = dataTransfer.getData('Text');
range = {
start: dragCursor,
end: editor.session.insert(dragCursor, dropData)
};
editor.focus();
dragOperation = null;
}
clearDragMarker();
return event.preventDefault(e);
};
event.addListener(mouseTarget, "dragstart", this.onDragStart.bind(mouseHandler));
event.addListener(mouseTarget, "dragend", this.onDragEnd.bind(mouseHandler));
event.addListener(mouseTarget, "dragenter", this.onDragEnter.bind(mouseHandler));
event.addListener(mouseTarget, "dragover", this.onDragOver.bind(mouseHandler));
event.addListener(mouseTarget, "dragleave", this.onDragLeave.bind(mouseHandler));
event.addListener(mouseTarget, "drop", this.onDrop.bind(mouseHandler));
function scrollCursorIntoView(cursor, prevCursor) {
var now = Date.now();
var vMovement = !prevCursor || cursor.row != prevCursor.row;
var hMovement = !prevCursor || cursor.column != prevCursor.column;
if (!cursorMovedTime || vMovement || hMovement) {
editor.$blockScrolling += 1;
editor.moveCursorToPosition(cursor);
editor.$blockScrolling -= 1;
cursorMovedTime = now;
cursorPointOnCaretMoved = {x: x, y: y};
} else {
var distance = calcDistance(cursorPointOnCaretMoved.x, cursorPointOnCaretMoved.y, x, y);
if (distance > SCROLL_CURSOR_HYSTERESIS) {
cursorMovedTime = null;
} else if (now - cursorMovedTime >= SCROLL_CURSOR_DELAY) {
editor.renderer.scrollCursorIntoView();
cursorMovedTime = null;
}
}
}
function autoScroll(cursor, prevCursor) {
var now = Date.now();
var lineHeight = editor.renderer.layerConfig.lineHeight;
var characterWidth = editor.renderer.layerConfig.characterWidth;
var editorRect = editor.renderer.scroller.getBoundingClientRect();
var offsets = {
x: {
left: x - editorRect.left,
right: editorRect.right - x
},
y: {
top: y - editorRect.top,
bottom: editorRect.bottom - y
}
};
var nearestXOffset = Math.min(offsets.x.left, offsets.x.right);
var nearestYOffset = Math.min(offsets.y.top, offsets.y.bottom);
var scrollCursor = {row: cursor.row, column: cursor.column};
if (nearestXOffset / characterWidth <= 2) {
scrollCursor.column += (offsets.x.left < offsets.x.right ? -3 : +2);
}
if (nearestYOffset / lineHeight <= 1) {
scrollCursor.row += (offsets.y.top < offsets.y.bottom ? -1 : +1);
}
var vScroll = cursor.row != scrollCursor.row;
var hScroll = cursor.column != scrollCursor.column;
var vMovement = !prevCursor || cursor.row != prevCursor.row;
if (vScroll || (hScroll && !vMovement)) {
if (!autoScrollStartTime)
autoScrollStartTime = now;
else if (now - autoScrollStartTime >= AUTOSCROLL_DELAY)
editor.renderer.scrollCursorIntoView(scrollCursor);
} else {
autoScrollStartTime = null;
}
}
function onDragInterval() {
var prevCursor = dragCursor;
dragCursor = editor.renderer.screenToTextCoordinates(x, y);
scrollCursorIntoView(dragCursor, prevCursor);
autoScroll(dragCursor, prevCursor);
}
function addDragMarker() {
range = editor.selection.toOrientedRange();
dragSelectionMarker = editor.session.addMarker(range, "ace_selection", editor.getSelectionStyle());
editor.clearSelection();
if (editor.isFocused())
editor.renderer.$cursorLayer.setBlinking(false);
clearInterval(timerId);
onDragInterval();
timerId = setInterval(onDragInterval, 20);
counter = 0;
event.addListener(document, "mousemove", onMouseMove);
}
function clearDragMarker() {
clearInterval(timerId);
editor.session.removeMarker(dragSelectionMarker);
dragSelectionMarker = null;
editor.$blockScrolling += 1;
editor.selection.fromOrientedRange(range);
editor.$blockScrolling -= 1;
if (editor.isFocused() && !isInternal)
editor.renderer.$cursorLayer.setBlinking(!editor.getReadOnly());
range = null;
dragCursor = null;
counter = 0;
autoScrollStartTime = null;
cursorMovedTime = null;
event.removeListener(document, "mousemove", onMouseMove);
}
var onMouseMoveTimer = null;
function onMouseMove() {
if (onMouseMoveTimer == null) {
onMouseMoveTimer = setTimeout(function() {
if (onMouseMoveTimer != null && dragSelectionMarker)
clearDragMarker();
}, 20);
}
}
function canAccept(dataTransfer) {
var types = dataTransfer.types;
return !types || Array.prototype.some.call(types, function(type) {
return type == 'text/plain' || type == 'Text';
});
}
function getDropEffect(e) {
var copyAllowed = ['copy', 'copymove', 'all', 'uninitialized'];
var moveAllowed = ['move', 'copymove', 'linkmove', 'all', 'uninitialized'];
var copyModifierState = useragent.isMac ? e.altKey : e.ctrlKey;
var effectAllowed = "uninitialized";
try {
effectAllowed = e.dataTransfer.effectAllowed.toLowerCase();
} catch (e) {}
var dropEffect = "none";
if (copyModifierState && copyAllowed.indexOf(effectAllowed) >= 0)
dropEffect = "copy";
else if (moveAllowed.indexOf(effectAllowed) >= 0)
dropEffect = "move";
else if (copyAllowed.indexOf(effectAllowed) >= 0)
dropEffect = "copy";
return dropEffect;
}
}
(function() {
this.dragWait = function() {
var interval = Date.now() - this.mousedownEvent.time;
if (interval > this.editor.getDragDelay())
this.startDrag();
};
this.dragWaitEnd = function() {
var target = this.editor.container;
target.draggable = false;
this.startSelect(this.mousedownEvent.getDocumentPosition());
this.selectEnd();
};
this.dragReadyEnd = function(e) {
this.editor.renderer.$cursorLayer.setBlinking(!this.editor.getReadOnly());
this.editor.unsetStyle("ace_dragging");
this.editor.renderer.setCursorStyle("");
this.dragWaitEnd();
};
this.startDrag = function(){
this.cancelDrag = false;
var editor = this.editor;
var target = editor.container;
target.draggable = true;
editor.renderer.$cursorLayer.setBlinking(false);
editor.setStyle("ace_dragging");
var cursorStyle = useragent.isWin ? "default" : "move";
editor.renderer.setCursorStyle(cursorStyle);
this.setState("dragReady");
};
this.onMouseDrag = function(e) {
var target = this.editor.container;
if (useragent.isIE && this.state == "dragReady") {
var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y);
if (distance > 3)
target.dragDrop();
}
if (this.state === "dragWait") {
var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y);
if (distance > 0) {
target.draggable = false;
this.startSelect(this.mousedownEvent.getDocumentPosition());
}
}
};
this.onMouseDown = function(e) {
if (!this.$dragEnabled)
return;
this.mousedownEvent = e;
var editor = this.editor;
var inSelection = e.inSelection();
var button = e.getButton();
var clickCount = e.domEvent.detail || 1;
if (clickCount === 1 && button === 0 && inSelection) {
if (e.editor.inMultiSelectMode && (e.getAccelKey() || e.getShiftKey()))
return;
this.mousedownEvent.time = Date.now();
var eventTarget = e.domEvent.target || e.domEvent.srcElement;
if ("unselectable" in eventTarget)
eventTarget.unselectable = "on";
if (editor.getDragDelay()) {
if (useragent.isWebKit) {
this.cancelDrag = true;
var mouseTarget = editor.container;
mouseTarget.draggable = true;
}
this.setState("dragWait");
} else {
this.startDrag();
}
this.captureMouse(e, this.onMouseDrag.bind(this));
e.defaultPrevented = true;
}
};
}).call(DragdropHandler.prototype);
function calcDistance(ax, ay, bx, by) {
return Math.sqrt(Math.pow(bx - ax, 2) + Math.pow(by - ay, 2));
}
exports.DragdropHandler = DragdropHandler;
});
ace.define("ace/lib/net",["require","exports","module","ace/lib/dom"], function(acequire, exports, module) {
"use strict";
var dom = acequire("./dom");
exports.get = function (url, callback) {
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
callback(xhr.responseText);
}
};
xhr.send(null);
};
exports.loadScript = function(path, callback) {
var head = dom.getDocumentHead();
var s = document.createElement('script');
s.src = path;
head.appendChild(s);
s.onload = s.onreadystatechange = function(_, isAbort) {
if (isAbort || !s.readyState || s.readyState == "loaded" || s.readyState == "complete") {
s = s.onload = s.onreadystatechange = null;
if (!isAbort)
callback();
}
};
};
exports.qualifyURL = function(url) {
var a = document.createElement('a');
a.href = url;
return a.href;
}
});
ace.define("ace/lib/event_emitter",["require","exports","module"], function(acequire, exports, module) {
"use strict";
var EventEmitter = {};
var stopPropagation = function() { this.propagationStopped = true; };
var preventDefault = function() { this.defaultPrevented = true; };
EventEmitter._emit =
EventEmitter._dispatchEvent = function(eventName, e) {
this._eventRegistry || (this._eventRegistry = {});
this._defaultHandlers || (this._defaultHandlers = {});
var listeners = this._eventRegistry[eventName] || [];
var defaultHandler = this._defaultHandlers[eventName];
if (!listeners.length && !defaultHandler)
return;
if (typeof e != "object" || !e)
e = {};
if (!e.type)
e.type = eventName;
if (!e.stopPropagation)
e.stopPropagation = stopPropagation;
if (!e.preventDefault)
e.preventDefault = preventDefault;
listeners = listeners.slice();
for (var i=0; i<listeners.length; i++) {
listeners[i](e, this);
if (e.propagationStopped)
break;
}
if (defaultHandler && !e.defaultPrevented)
return defaultHandler(e, this);
};
EventEmitter._signal = function(eventName, e) {
var listeners = (this._eventRegistry || {})[eventName];
if (!listeners)
return;
listeners = listeners.slice();
for (var i=0; i<listeners.length; i++)
listeners[i](e, this);
};
EventEmitter.once = function(eventName, callback) {
var _self = this;
callback && this.addEventListener(eventName, function newCallback() {
_self.removeEventListener(eventName, newCallback);
callback.apply(null, arguments);
});
};
EventEmitter.setDefaultHandler = function(eventName, callback) {
var handlers = this._defaultHandlers
if (!handlers)
handlers = this._defaultHandlers = {_disabled_: {}};
if (handlers[eventName]) {
var old = handlers[eventName];
var disabled = handlers._disabled_[eventName];
if (!disabled)
handlers._disabled_[eventName] = disabled = [];
disabled.push(old);
var i = disabled.indexOf(callback);
if (i != -1)
disabled.splice(i, 1);
}
handlers[eventName] = callback;
};
EventEmitter.removeDefaultHandler = function(eventName, callback) {
var handlers = this._defaultHandlers
if (!handlers)
return;
var disabled = handlers._disabled_[eventName];
if (handlers[eventName] == callback) {
var old = handlers[eventName];
if (disabled)
this.setDefaultHandler(eventName, disabled.pop());
} else if (disabled) {
var i = disabled.indexOf(callback);
if (i != -1)
disabled.splice(i, 1);
}
};
EventEmitter.on =
EventEmitter.addEventListener = function(eventName, callback, capturing) {
this._eventRegistry = this._eventRegistry || {};
var listeners = this._eventRegistry[eventName];
if (!listeners)
listeners = this._eventRegistry[eventName] = [];
if (listeners.indexOf(callback) == -1)
listeners[capturing ? "unshift" : "push"](callback);
return callback;
};
EventEmitter.off =
EventEmitter.removeListener =
EventEmitter.removeEventListener = function(eventName, callback) {
this._eventRegistry = this._eventRegistry || {};
var listeners = this._eventRegistry[eventName];
if (!listeners)
return;
var index = listeners.indexOf(callback);
if (index !== -1)
listeners.splice(index, 1);
};
EventEmitter.removeAllListeners = function(eventName) {
if (this._eventRegistry) this._eventRegistry[eventName] = [];
};
exports.EventEmitter = EventEmitter;
});
ace.define("ace/lib/app_config",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"], function(acequire, exports, module) {
"no use strict";
var oop = acequire("./oop");
var EventEmitter = acequire("./event_emitter").EventEmitter;
var optionsProvider = {
setOptions: function(optList) {
Object.keys(optList).forEach(function(key) {
this.setOption(key, optList[key]);
}, this);
},
getOptions: function(optionNames) {
var result = {};
if (!optionNames) {
optionNames = Object.keys(this.$options);
} else if (!Array.isArray(optionNames)) {
result = optionNames;
optionNames = Object.keys(result);
}
optionNames.forEach(function(key) {
result[key] = this.getOption(key);
}, this);
return result;
},
setOption: function(name, value) {
if (this["$" + name] === value)
return;
var opt = this.$options[name];
if (!opt) {
return warn('misspelled option "' + name + '"');
}
if (opt.forwardTo)
return this[opt.forwardTo] && this[opt.forwardTo].setOption(name, value);
if (!opt.handlesSet)
this["$" + name] = value;
if (opt && opt.set)
opt.set.call(this, value);
},
getOption: function(name) {
var opt = this.$options[name];
if (!opt) {
return warn('misspelled option "' + name + '"');
}
if (opt.forwardTo)
return this[opt.forwardTo] && this[opt.forwardTo].getOption(name);
return opt && opt.get ? opt.get.call(this) : this["$" + name];
}
};
function warn(message) {
if (typeof console != "undefined" && console.warn)
console.warn.apply(console, arguments);
}
function reportError(msg, data) {
var e = new Error(msg);
e.data = data;
if (typeof console == "object" && console.error)
console.error(e);
setTimeout(function() { throw e; });
}
var AppConfig = function() {
this.$defaultOptions = {};
};
(function() {
oop.implement(this, EventEmitter);
this.defineOptions = function(obj, path, options) {
if (!obj.$options)
this.$defaultOptions[path] = obj.$options = {};
Object.keys(options).forEach(function(key) {
var opt = options[key];
if (typeof opt == "string")
opt = {forwardTo: opt};
opt.name || (opt.name = key);
obj.$options[opt.name] = opt;
if ("initialValue" in opt)
obj["$" + opt.name] = opt.initialValue;
});
oop.implement(obj, optionsProvider);
return this;
};
this.resetOptions = function(obj) {
Object.keys(obj.$options).forEach(function(key) {
var opt = obj.$options[key];
if ("value" in opt)
obj.setOption(key, opt.value);
});
};
this.setDefaultValue = function(path, name, value) {
var opts = this.$defaultOptions[path] || (this.$defaultOptions[path] = {});
if (opts[name]) {
if (opts.forwardTo)
this.setDefaultValue(opts.forwardTo, name, value);
else
opts[name].value = value;
}
};
this.setDefaultValues = function(path, optionHash) {
Object.keys(optionHash).forEach(function(key) {
this.setDefaultValue(path, key, optionHash[key]);
}, this);
};
this.warn = warn;
this.reportError = reportError;
}).call(AppConfig.prototype);
exports.AppConfig = AppConfig;
});
ace.define("ace/config",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/lib/net","ace/lib/app_config"], function(acequire, exports, module) {
"no use strict";
var lang = acequire("./lib/lang");
var oop = acequire("./lib/oop");
var net = acequire("./lib/net");
var AppConfig = acequire("./lib/app_config").AppConfig;
module.exports = exports = new AppConfig();
var global = (function() {
return this || typeof window != "undefined" && window;
})();
var options = {
packaged: false,
workerPath: null,
modePath: null,
themePath: null,
basePath: "",
suffix: ".js",
$moduleUrls: {}
};
exports.get = function(key) {
if (!options.hasOwnProperty(key))
throw new Error("Unknown config key: " + key);
return options[key];
};
exports.set = function(key, value) {
if (!options.hasOwnProperty(key))
throw new Error("Unknown config key: " + key);
options[key] = value;
};
exports.all = function() {
return lang.copyObject(options);
};
exports.moduleUrl = function(name, component) {
if (options.$moduleUrls[name])
return options.$moduleUrls[name];
var parts = name.split("/");
component = component || parts[parts.length - 2] || "";
var sep = component == "snippets" ? "/" : "-";
var base = parts[parts.length - 1];
if (component == "worker" && sep == "-") {
var re = new RegExp("^" + component + "[\\-_]|[\\-_]" + component + "$", "g");
base = base.replace(re, "");
}
if ((!base || base == component) && parts.length > 1)
base = parts[parts.length - 2];
var path = options[component + "Path"];
if (path == null) {
path = options.basePath;
} else if (sep == "/") {
component = sep = "";
}
if (path && path.slice(-1) != "/")
path += "/";
return path + component + sep + base + this.get("suffix");
};
exports.setModuleUrl = function(name, subst) {
return options.$moduleUrls[name] = subst;
};
exports.$loading = {};
exports.loadModule = function(moduleName, onLoad) {
var module, moduleType;
if (Array.isArray(moduleName)) {
moduleType = moduleName[0];
moduleName = moduleName[1];
}
try {
module = acequire(moduleName);
} catch (e) {}
if (module && !exports.$loading[moduleName])
return onLoad && onLoad(module);
if (!exports.$loading[moduleName])
exports.$loading[moduleName] = [];
exports.$loading[moduleName].push(onLoad);
if (exports.$loading[moduleName].length > 1)
return;
var afterLoad = function() {
acequire([moduleName], function(module) {
exports._emit("load.module", {name: moduleName, module: module});
var listeners = exports.$loading[moduleName];
exports.$loading[moduleName] = null;
listeners.forEach(function(onLoad) {
onLoad && onLoad(module);
});
});
};
if (!exports.get("packaged"))
return afterLoad();
net.loadScript(exports.moduleUrl(moduleName, moduleType), afterLoad);
};
init(true);function init(packaged) {
if (!global || !global.document)
return;
options.packaged = packaged || acequire.packaged || module.packaged || (global.define && __webpack_require__(5).packaged);
var scriptOptions = {};
var scriptUrl = "";
var currentScript = (document.currentScript || document._currentScript ); // native or polyfill
var currentDocument = currentScript && currentScript.ownerDocument || document;
var scripts = currentDocument.getElementsByTagName("script");
for (var i=0; i<scripts.length; i++) {
var script = scripts[i];
var src = script.src || script.getAttribute("src");
if (!src)
continue;
var attributes = script.attributes;
for (var j=0, l=attributes.length; j < l; j++) {
var attr = attributes[j];
if (attr.name.indexOf("data-ace-") === 0) {
scriptOptions[deHyphenate(attr.name.replace(/^data-ace-/, ""))] = attr.value;
}
}
var m = src.match(/^(.*)\/ace(\-\w+)?\.js(\?|$)/);
if (m)
scriptUrl = m[1];
}
if (scriptUrl) {
scriptOptions.base = scriptOptions.base || scriptUrl;
scriptOptions.packaged = true;
}
scriptOptions.basePath = scriptOptions.base;
scriptOptions.workerPath = scriptOptions.workerPath || scriptOptions.base;
scriptOptions.modePath = scriptOptions.modePath || scriptOptions.base;
scriptOptions.themePath = scriptOptions.themePath || scriptOptions.base;
delete scriptOptions.base;
for (var key in scriptOptions)
if (typeof scriptOptions[key] !== "undefined")
exports.set(key, scriptOptions[key]);
}
exports.init = init;
function deHyphenate(str) {
return str.replace(/-(.)/g, function(m, m1) { return m1.toUpperCase(); });
}
});
ace.define("ace/mouse/mouse_handler",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/mouse/default_handlers","ace/mouse/default_gutter_handler","ace/mouse/mouse_event","ace/mouse/dragdrop_handler","ace/config"], function(acequire, exports, module) {
"use strict";
var event = acequire("../lib/event");
var useragent = acequire("../lib/useragent");
var DefaultHandlers = acequire("./default_handlers").DefaultHandlers;
var DefaultGutterHandler = acequire("./default_gutter_handler").GutterHandler;
var MouseEvent = acequire("./mouse_event").MouseEvent;
var DragdropHandler = acequire("./dragdrop_handler").DragdropHandler;
var config = acequire("../config");
var MouseHandler = function(editor) {
var _self = this;
this.editor = editor;
new DefaultHandlers(this);
new DefaultGutterHandler(this);
new DragdropHandler(this);
var focusEditor = function(e) {
var windowBlurred = !document.hasFocus || !document.hasFocus()
|| !editor.isFocused() && document.activeElement == (editor.textInput && editor.textInput.getElement())
if (windowBlurred)
window.focus();
editor.focus();
};
var mouseTarget = editor.renderer.getMouseEventTarget();
event.addListener(mouseTarget, "click", this.onMouseEvent.bind(this, "click"));
event.addListener(mouseTarget, "mousemove", this.onMouseMove.bind(this, "mousemove"));
event.addMultiMouseDownListener([
mouseTarget,
editor.renderer.scrollBarV && editor.renderer.scrollBarV.inner,
editor.renderer.scrollBarH && editor.renderer.scrollBarH.inner,
editor.textInput && editor.textInput.getElement()
].filter(Boolean), [400, 300, 250], this, "onMouseEvent");
event.addMouseWheelListener(editor.container, this.onMouseWheel.bind(this, "mousewheel"));
event.addTouchMoveListener(editor.container, this.onTouchMove.bind(this, "touchmove"));
var gutterEl = editor.renderer.$gutter;
event.addListener(gutterEl, "mousedown", this.onMouseEvent.bind(this, "guttermousedown"));
event.addListener(gutterEl, "click", this.onMouseEvent.bind(this, "gutterclick"));
event.addListener(gutterEl, "dblclick", this.onMouseEvent.bind(this, "gutterdblclick"));
event.addListener(gutterEl, "mousemove", this.onMouseEvent.bind(this, "guttermousemove"));
event.addListener(mouseTarget, "mousedown", focusEditor);
event.addListener(gutterEl, "mousedown", focusEditor);
if (useragent.isIE && editor.renderer.scrollBarV) {
event.addListener(editor.renderer.scrollBarV.element, "mousedown", focusEditor);
event.addListener(editor.renderer.scrollBarH.element, "mousedown", focusEditor);
}
editor.on("mousemove", function(e){
if (_self.state || _self.$dragDelay || !_self.$dragEnabled)
return;
var character = editor.renderer.screenToTextCoordinates(e.x, e.y);
var range = editor.session.selection.getRange();
var renderer = editor.renderer;
if (!range.isEmpty() && range.insideStart(character.row, character.column)) {
renderer.setCursorStyle("default");
} else {
renderer.setCursorStyle("");
}
});
};
(function() {
this.onMouseEvent = function(name, e) {
this.editor._emit(name, new MouseEvent(e, this.editor));
};
this.onMouseMove = function(name, e) {
var listeners = this.editor._eventRegistry && this.editor._eventRegistry.mousemove;
if (!listeners || !listeners.length)
return;
this.editor._emit(name, new MouseEvent(e, this.editor));
};
this.onMouseWheel = function(name, e) {
var mouseEvent = new MouseEvent(e, this.editor);
mouseEvent.speed = this.$scrollSpeed * 2;
mouseEvent.wheelX = e.wheelX;
mouseEvent.wheelY = e.wheelY;
this.editor._emit(name, mouseEvent);
};
this.onTouchMove = function (name, e) {
var mouseEvent = new MouseEvent(e, this.editor);
mouseEvent.speed = 1;//this.$scrollSpeed * 2;
mouseEvent.wheelX = e.wheelX;
mouseEvent.wheelY = e.wheelY;
this.editor._emit(name, mouseEvent);
};
this.setState = function(state) {
this.state = state;
};
this.captureMouse = function(ev, mouseMoveHandler) {
this.x = ev.x;
this.y = ev.y;
this.isMousePressed = true;
var renderer = this.editor.renderer;
if (renderer.$keepTextAreaAtCursor)
renderer.$keepTextAreaAtCursor = null;
var self = this;
var onMouseMove = function(e) {
if (!e) return;
if (useragent.isWebKit && !e.which && self.releaseMouse)
return self.releaseMouse();
self.x = e.clientX;
self.y = e.clientY;
mouseMoveHandler && mouseMoveHandler(e);
self.mouseEvent = new MouseEvent(e, self.editor);
self.$mouseMoved = true;
};
var onCaptureEnd = function(e) {
clearInterval(timerId);
onCaptureInterval();
self[self.state + "End"] && self[self.state + "End"](e);
self.state = "";
if (renderer.$keepTextAreaAtCursor == null) {
renderer.$keepTextAreaAtCursor = true;
renderer.$moveTextAreaToCursor();
}
self.isMousePressed = false;
self.$onCaptureMouseMove = self.releaseMouse = null;
e && self.onMouseEvent("mouseup", e);
};
var onCaptureInterval = function() {
self[self.state] && self[self.state]();
self.$mouseMoved = false;
};
if (useragent.isOldIE && ev.domEvent.type == "dblclick") {
return setTimeout(function() {onCaptureEnd(ev);});
}
self.$onCaptureMouseMove = onMouseMove;
self.releaseMouse = event.capture(this.editor.container, onMouseMove, onCaptureEnd);
var timerId = setInterval(onCaptureInterval, 20);
};
this.releaseMouse = null;
this.cancelContextMenu = function() {
var stop = function(e) {
if (e && e.domEvent && e.domEvent.type != "contextmenu")
return;
this.editor.off("nativecontextmenu", stop);
if (e && e.domEvent)
event.stopEvent(e.domEvent);
}.bind(this);
setTimeout(stop, 10);
this.editor.on("nativecontextmenu", stop);
};
}).call(MouseHandler.prototype);
config.defineOptions(MouseHandler.prototype, "mouseHandler", {
scrollSpeed: {initialValue: 2},
dragDelay: {initialValue: (useragent.isMac ? 150 : 0)},
dragEnabled: {initialValue: true},
focusTimout: {initialValue: 0},
tooltipFollowsMouse: {initialValue: true}
});
exports.MouseHandler = MouseHandler;
});
ace.define("ace/mouse/fold_handler",["require","exports","module"], function(acequire, exports, module) {
"use strict";
function FoldHandler(editor) {
editor.on("click", function(e) {
var position = e.getDocumentPosition();
var session = editor.session;
var fold = session.getFoldAt(position.row, position.column, 1);
if (fold) {
if (e.getAccelKey())
session.removeFold(fold);
else
session.expandFold(fold);
e.stop();
}
});
editor.on("gutterclick", function(e) {
var gutterRegion = editor.renderer.$gutterLayer.getRegion(e);
if (gutterRegion == "foldWidgets") {
var row = e.getDocumentPosition().row;
var session = editor.session;
if (session.foldWidgets && session.foldWidgets[row])
editor.session.onFoldWidgetClick(row, e);
if (!editor.isFocused())
editor.focus();
e.stop();
}
});
editor.on("gutterdblclick", function(e) {
var gutterRegion = editor.renderer.$gutterLayer.getRegion(e);
if (gutterRegion == "foldWidgets") {
var row = e.getDocumentPosition().row;
var session = editor.session;
var data = session.getParentFoldRangeData(row, true);
var range = data.range || data.firstRange;
if (range) {
row = range.start.row;
var fold = session.getFoldAt(row, session.getLine(row).length, 1);
if (fold) {
session.removeFold(fold);
} else {
session.addFold("...", range);
editor.renderer.scrollCursorIntoView({row: range.start.row, column: 0});
}
}
e.stop();
}
});
}
exports.FoldHandler = FoldHandler;
});
ace.define("ace/keyboard/keybinding",["require","exports","module","ace/lib/keys","ace/lib/event"], function(acequire, exports, module) {
"use strict";
var keyUtil = acequire("../lib/keys");
var event = acequire("../lib/event");
var KeyBinding = function(editor) {
this.$editor = editor;
this.$data = {editor: editor};
this.$handlers = [];
this.setDefaultHandler(editor.commands);
};
(function() {
this.setDefaultHandler = function(kb) {
this.removeKeyboardHandler(this.$defaultHandler);
this.$defaultHandler = kb;
this.addKeyboardHandler(kb, 0);
};
this.setKeyboardHandler = function(kb) {
var h = this.$handlers;
if (h[h.length - 1] == kb)
return;
while (h[h.length - 1] && h[h.length - 1] != this.$defaultHandler)
this.removeKeyboardHandler(h[h.length - 1]);
this.addKeyboardHandler(kb, 1);
};
this.addKeyboardHandler = function(kb, pos) {
if (!kb)
return;
if (typeof kb == "function" && !kb.handleKeyboard)
kb.handleKeyboard = kb;
var i = this.$handlers.indexOf(kb);
if (i != -1)
this.$handlers.splice(i, 1);
if (pos == undefined)
this.$handlers.push(kb);
else
this.$handlers.splice(pos, 0, kb);
if (i == -1 && kb.attach)
kb.attach(this.$editor);
};
this.removeKeyboardHandler = function(kb) {
var i = this.$handlers.indexOf(kb);
if (i == -1)
return false;
this.$handlers.splice(i, 1);
kb.detach && kb.detach(this.$editor);
return true;
};
this.getKeyboardHandler = function() {
return this.$handlers[this.$handlers.length - 1];
};
this.getStatusText = function() {
var data = this.$data;
var editor = data.editor;
return this.$handlers.map(function(h) {
return h.getStatusText && h.getStatusText(editor, data) || "";
}).filter(Boolean).join(" ");
};
this.$callKeyboardHandlers = function(hashId, keyString, keyCode, e) {
var toExecute;
var success = false;
var commands = this.$editor.commands;
for (var i = this.$handlers.length; i--;) {
toExecute = this.$handlers[i].handleKeyboard(
this.$data, hashId, keyString, keyCode, e
);
if (!toExecute || !toExecute.command)
continue;
if (toExecute.command == "null") {
success = true;
} else {
success = commands.exec(toExecute.command, this.$editor, toExecute.args, e);
}
if (success && e && hashId != -1 &&
toExecute.passEvent != true && toExecute.command.passEvent != true
) {
event.stopEvent(e);
}
if (success)
break;
}
if (!success && hashId == -1) {
toExecute = {command: "insertstring"};
success = commands.exec("insertstring", this.$editor, keyString);
}
if (success && this.$editor._signal)
this.$editor._signal("keyboardActivity", toExecute);
return success;
};
this.onCommandKey = function(e, hashId, keyCode) {
var keyString = keyUtil.keyCodeToString(keyCode);
this.$callKeyboardHandlers(hashId, keyString, keyCode, e);
};
this.onTextInput = function(text) {
this.$callKeyboardHandlers(-1, text);
};
}).call(KeyBinding.prototype);
exports.KeyBinding = KeyBinding;
});
ace.define("ace/range",["require","exports","module"], function(acequire, exports, module) {
"use strict";
var comparePoints = function(p1, p2) {
return p1.row - p2.row || p1.column - p2.column;
};
var Range = function(startRow, startColumn, endRow, endColumn) {
this.start = {
row: startRow,
column: startColumn
};
this.end = {
row: endRow,
column: endColumn
};
};
(function() {
this.isEqual = function(range) {
return this.start.row === range.start.row &&
this.end.row === range.end.row &&
this.start.column === range.start.column &&
this.end.column === range.end.column;
};
this.toString = function() {
return ("Range: [" + this.start.row + "/" + this.start.column +
"] -> [" + this.end.row + "/" + this.end.column + "]");
};
this.contains = function(row, column) {
return this.compare(row, column) == 0;
};
this.compareRange = function(range) {
var cmp,
end = range.end,
start = range.start;
cmp = this.compare(end.row, end.column);
if (cmp == 1) {
cmp = this.compare(start.row, start.column);
if (cmp == 1) {
return 2;
} else if (cmp == 0) {
return 1;
} else {
return 0;
}
} else if (cmp == -1) {
return -2;
} else {
cmp = this.compare(start.row, start.column);
if (cmp == -1) {
return -1;
} else if (cmp == 1) {
return 42;
} else {
return 0;
}
}
};
this.comparePoint = function(p) {
return this.compare(p.row, p.column);
};
this.containsRange = function(range) {
return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
};
this.intersects = function(range) {
var cmp = this.compareRange(range);
return (cmp == -1 || cmp == 0 || cmp == 1);
};
this.isEnd = function(row, column) {
return this.end.row == row && this.end.column == column;
};
this.isStart = function(row, column) {
return this.start.row == row && this.start.column == column;
};
this.setStart = function(row, column) {
if (typeof row == "object") {
this.start.column = row.column;
this.start.row = row.row;
} else {
this.start.row = row;
this.start.column = column;
}
};
this.setEnd = function(row, column) {
if (typeof row == "object") {
this.end.column = row.column;
this.end.row = row.row;
} else {
this.end.row = row;
this.end.column = column;
}
};
this.inside = function(row, column) {
if (this.compare(row, column) == 0) {
if (this.isEnd(row, column) || this.isStart(row, column)) {
return false;
} else {
return true;
}
}
return false;
};
this.insideStart = function(row, column) {
if (this.compare(row, column) == 0) {
if (this.isEnd(row, column)) {
return false;
} else {
return true;
}
}
return false;
};
this.insideEnd = function(row, column) {
if (this.compare(row, column) == 0) {
if (this.isStart(row, column)) {
return false;
} else {
return true;
}
}
return false;
};
this.compare = function(row, column) {
if (!this.isMultiLine()) {
if (row === this.start.row) {
return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0);
}
}
if (row < this.start.row)
return -1;
if (row > this.end.row)
return 1;
if (this.start.row === row)
return column >= this.start.column ? 0 : -1;
if (this.end.row === row)
return column <= this.end.column ? 0 : 1;
return 0;
};
this.compareStart = function(row, column) {
if (this.start.row == row && this.start.column == column) {
return -1;
} else {
return this.compare(row, column);
}
};
this.compareEnd = function(row, column) {
if (this.end.row == row && this.end.column == column) {
return 1;
} else {
return this.compare(row, column);
}
};
this.compareInside = function(row, column) {
if (this.end.row == row && this.end.column == column) {
return 1;
} else if (this.start.row == row && this.start.column == column) {
return -1;
} else {
return this.compare(row, column);
}
};
this.clipRows = function(firstRow, lastRow) {
if (this.end.row > lastRow)
var end = {row: lastRow + 1, column: 0};
else if (this.end.row < firstRow)
var end = {row: firstRow, column: 0};
if (this.start.row > lastRow)
var start = {row: lastRow + 1, column: 0};
else if (this.start.row < firstRow)
var start = {row: firstRow, column: 0};
return Range.fromPoints(start || this.start, end || this.end);
};
this.extend = function(row, column) {
var cmp = this.compare(row, column);
if (cmp == 0)
return this;
else if (cmp == -1)
var start = {row: row, column: column};
else
var end = {row: row, column: column};
return Range.fromPoints(start || this.start, end || this.end);
};
this.isEmpty = function() {
return (this.start.row === this.end.row && this.start.column === this.end.column);
};
this.isMultiLine = function() {
return (this.start.row !== this.end.row);
};
this.clone = function() {
return Range.fromPoints(this.start, this.end);
};
this.collapseRows = function() {
if (this.end.column == 0)
return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row-1), 0)
else
return new Range(this.start.row, 0, this.end.row, 0)
};
this.toScreenRange = function(session) {
var screenPosStart = session.documentToScreenPosition(this.start);
var screenPosEnd = session.documentToScreenPosition(this.end);
return new Range(
screenPosStart.row, screenPosStart.column,
screenPosEnd.row, screenPosEnd.column
);
};
this.moveBy = function(row, column) {
this.start.row += row;
this.start.column += column;
this.end.row += row;
this.end.column += column;
};
}).call(Range.prototype);
Range.fromPoints = function(start, end) {
return new Range(start.row, start.column, end.row, end.column);
};
Range.comparePoints = comparePoints;
Range.comparePoints = function(p1, p2) {
return p1.row - p2.row || p1.column - p2.column;
};
exports.Range = Range;
});
ace.define("ace/selection",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/range"], function(acequire, exports, module) {
"use strict";
var oop = acequire("./lib/oop");
var lang = acequire("./lib/lang");
var EventEmitter = acequire("./lib/event_emitter").EventEmitter;
var Range = acequire("./range").Range;
var Selection = function(session) {
this.session = session;
this.doc = session.getDocument();
this.clearSelection();
this.lead = this.selectionLead = this.doc.createAnchor(0, 0);
this.anchor = this.selectionAnchor = this.doc.createAnchor(0, 0);
var self = this;
this.lead.on("change", function(e) {
self._emit("changeCursor");
if (!self.$isEmpty)
self._emit("changeSelection");
if (!self.$keepDesiredColumnOnChange && e.old.column != e.value.column)
self.$desiredColumn = null;
});
this.selectionAnchor.on("change", function() {
if (!self.$isEmpty)
self._emit("changeSelection");
});
};
(function() {
oop.implement(this, EventEmitter);
this.isEmpty = function() {
return (this.$isEmpty || (
this.anchor.row == this.lead.row &&
this.anchor.column == this.lead.column
));
};
this.isMultiLine = function() {
if (this.isEmpty()) {
return false;
}
return this.getRange().isMultiLine();
};
this.getCursor = function() {
return this.lead.getPosition();
};
this.setSelectionAnchor = function(row, column) {
this.anchor.setPosition(row, column);
if (this.$isEmpty) {
this.$isEmpty = false;
this._emit("changeSelection");
}
};
this.getSelectionAnchor = function() {
if (this.$isEmpty)
return this.getSelectionLead();
else
return this.anchor.getPosition();
};
this.getSelectionLead = function() {
return this.lead.getPosition();
};
this.shiftSelection = function(columns) {
if (this.$isEmpty) {
this.moveCursorTo(this.lead.row, this.lead.column + columns);
return;
}
var anchor = this.getSelectionAnchor();
var lead = this.getSelectionLead();
var isBackwards = this.isBackwards();
if (!isBackwards || anchor.column !== 0)
this.setSelectionAnchor(anchor.row, anchor.column + columns);
if (isBackwards || lead.column !== 0) {
this.$moveSelection(function() {
this.moveCursorTo(lead.row, lead.column + columns);
});
}
};
this.isBackwards = function() {
var anchor = this.anchor;
var lead = this.lead;
return (anchor.row > lead.row || (anchor.row == lead.row && anchor.column > lead.column));
};
this.getRange = function() {
var anchor = this.anchor;
var lead = this.lead;
if (this.isEmpty())
return Range.fromPoints(lead, lead);
if (this.isBackwards()) {
return Range.fromPoints(lead, anchor);
}
else {
return Range.fromPoints(anchor, lead);
}
};
this.clearSelection = function() {
if (!this.$isEmpty) {
this.$isEmpty = true;
this._emit("changeSelection");
}
};
this.selectAll = function() {
var lastRow = this.doc.getLength() - 1;
this.setSelectionAnchor(0, 0);
this.moveCursorTo(lastRow, this.doc.getLine(lastRow).length);
};
this.setRange =
this.setSelectionRange = function(range, reverse) {
if (reverse) {
this.setSelectionAnchor(range.end.row, range.end.column);
this.selectTo(range.start.row, range.start.column);
} else {
this.setSelectionAnchor(range.start.row, range.start.column);
this.selectTo(range.end.row, range.end.column);
}
if (this.getRange().isEmpty())
this.$isEmpty = true;
this.$desiredColumn = null;
};
this.$moveSelection = function(mover) {
var lead = this.lead;
if (this.$isEmpty)
this.setSelectionAnchor(lead.row, lead.column);
mover.call(this);
};
this.selectTo = function(row, column) {
this.$moveSelection(function() {
this.moveCursorTo(row, column);
});
};
this.selectToPosition = function(pos) {
this.$moveSelection(function() {
this.moveCursorToPosition(pos);
});
};
this.moveTo = function(row, column) {
this.clearSelection();
this.moveCursorTo(row, column);
};
this.moveToPosition = function(pos) {
this.clearSelection();
this.moveCursorToPosition(pos);
};
this.selectUp = function() {
this.$moveSelection(this.moveCursorUp);
};
this.selectDown = function() {
this.$moveSelection(this.moveCursorDown);
};
this.selectRight = function() {
this.$moveSelection(this.moveCursorRight);
};
this.selectLeft = function() {
this.$moveSelection(this.moveCursorLeft);
};
this.selectLineStart = function() {
this.$moveSelection(this.moveCursorLineStart);
};
this.selectLineEnd = function() {
this.$moveSelection(this.moveCursorLineEnd);
};
this.selectFileEnd = function() {
this.$moveSelection(this.moveCursorFileEnd);
};
this.selectFileStart = function() {
this.$moveSelection(this.moveCursorFileStart);
};
this.selectWordRight = function() {
this.$moveSelection(this.moveCursorWordRight);
};
this.selectWordLeft = function() {
this.$moveSelection(this.moveCursorWordLeft);
};
this.getWordRange = function(row, column) {
if (typeof column == "undefined") {
var cursor = row || this.lead;
row = cursor.row;
column = cursor.column;
}
return this.session.getWordRange(row, column);
};
this.selectWord = function() {
this.setSelectionRange(this.getWordRange());
};
this.selectAWord = function() {
var cursor = this.getCursor();
var range = this.session.getAWordRange(cursor.row, cursor.column);
this.setSelectionRange(range);
};
this.getLineRange = function(row, excludeLastChar) {
var rowStart = typeof row == "number" ? row : this.lead.row;
var rowEnd;
var foldLine = this.session.getFoldLine(rowStart);
if (foldLine) {
rowStart = foldLine.start.row;
rowEnd = foldLine.end.row;
} else {
rowEnd = rowStart;
}
if (excludeLastChar === true)
return new Range(rowStart, 0, rowEnd, this.session.getLine(rowEnd).length);
else
return new Range(rowStart, 0, rowEnd + 1, 0);
};
this.selectLine = function() {
this.setSelectionRange(this.getLineRange());
};
this.moveCursorUp = function() {
this.moveCursorBy(-1, 0);
};
this.moveCursorDown = function() {
this.moveCursorBy(1, 0);
};
this.moveCursorLeft = function() {
var cursor = this.lead.getPosition(),
fold;
if (fold = this.session.getFoldAt(cursor.row, cursor.column, -1)) {
this.moveCursorTo(fold.start.row, fold.start.column);
} else if (cursor.column === 0) {
if (cursor.row > 0) {
this.moveCursorTo(cursor.row - 1, this.doc.getLine(cursor.row - 1).length);
}
}
else {
var tabSize = this.session.getTabSize();
if (this.session.isTabStop(cursor) && this.doc.getLine(cursor.row).slice(cursor.column-tabSize, cursor.column).split(" ").length-1 == tabSize)
this.moveCursorBy(0, -tabSize);
else
this.moveCursorBy(0, -1);
}
};
this.moveCursorRight = function() {
var cursor = this.lead.getPosition(),
fold;
if (fold = this.session.getFoldAt(cursor.row, cursor.column, 1)) {
this.moveCursorTo(fold.end.row, fold.end.column);
}
else if (this.lead.column == this.doc.getLine(this.lead.row).length) {
if (this.lead.row < this.doc.getLength() - 1) {
this.moveCursorTo(this.lead.row + 1, 0);
}
}
else {
var tabSize = this.session.getTabSize();
var cursor = this.lead;
if (this.session.isTabStop(cursor) && this.doc.getLine(cursor.row).slice(cursor.column, cursor.column+tabSize).split(" ").length-1 == tabSize)
this.moveCursorBy(0, tabSize);
else
this.moveCursorBy(0, 1);
}
};
this.moveCursorLineStart = function() {
var row = this.lead.row;
var column = this.lead.column;
var screenRow = this.session.documentToScreenRow(row, column);
var firstColumnPosition = this.session.screenToDocumentPosition(screenRow, 0);
var beforeCursor = this.session.getDisplayLine(
row, null, firstColumnPosition.row,
firstColumnPosition.column
);
var leadingSpace = beforeCursor.match(/^\s*/);
if (leadingSpace[0].length != column && !this.session.$useEmacsStyleLineStart)
firstColumnPosition.column += leadingSpace[0].length;
this.moveCursorToPosition(firstColumnPosition);
};
this.moveCursorLineEnd = function() {
var lead = this.lead;
var lineEnd = this.session.getDocumentLastRowColumnPosition(lead.row, lead.column);
if (this.lead.column == lineEnd.column) {
var line = this.session.getLine(lineEnd.row);
if (lineEnd.column == line.length) {
var textEnd = line.search(/\s+$/);
if (textEnd > 0)
lineEnd.column = textEnd;
}
}
this.moveCursorTo(lineEnd.row, lineEnd.column);
};
this.moveCursorFileEnd = function() {
var row = this.doc.getLength() - 1;
var column = this.doc.getLine(row).length;
this.moveCursorTo(row, column);
};
this.moveCursorFileStart = function() {
this.moveCursorTo(0, 0);
};
this.moveCursorLongWordRight = function() {
var row = this.lead.row;
var column = this.lead.column;
var line = this.doc.getLine(row);
var rightOfCursor = line.substring(column);
var match;
this.session.nonTokenRe.lastIndex = 0;
this.session.tokenRe.lastIndex = 0;
var fold = this.session.getFoldAt(row, column, 1);
if (fold) {
this.moveCursorTo(fold.end.row, fold.end.column);
return;
}
if (match = this.session.nonTokenRe.exec(rightOfCursor)) {
column += this.session.nonTokenRe.lastIndex;
this.session.nonTokenRe.lastIndex = 0;
rightOfCursor = line.substring(column);
}
if (column >= line.length) {
this.moveCursorTo(row, line.length);
this.moveCursorRight();
if (row < this.doc.getLength() - 1)
this.moveCursorWordRight();
return;
}
if (match = this.session.tokenRe.exec(rightOfCursor)) {
column += this.session.tokenRe.lastIndex;
this.session.tokenRe.lastIndex = 0;
}
this.moveCursorTo(row, column);
};
this.moveCursorLongWordLeft = function() {
var row = this.lead.row;
var column = this.lead.column;
var fold;
if (fold = this.session.getFoldAt(row, column, -1)) {
this.moveCursorTo(fold.start.row, fold.start.column);
return;
}
var str = this.session.getFoldStringAt(row, column, -1);
if (str == null) {
str = this.doc.getLine(row).substring(0, column);
}
var leftOfCursor = lang.stringReverse(str);
var match;
this.session.nonTokenRe.lastIndex = 0;
this.session.tokenRe.lastIndex = 0;
if (match = this.session.nonTokenRe.exec(leftOfCursor)) {
column -= this.session.nonTokenRe.lastIndex;
leftOfCursor = leftOfCursor.slice(this.session.nonTokenRe.lastIndex);
this.session.nonTokenRe.lastIndex = 0;
}
if (column <= 0) {
this.moveCursorTo(row, 0);
this.moveCursorLeft();
if (row > 0)
this.moveCursorWordLeft();
return;
}
if (match = this.session.tokenRe.exec(leftOfCursor)) {
column -= this.session.tokenRe.lastIndex;
this.session.tokenRe.lastIndex = 0;
}
this.moveCursorTo(row, column);
};
this.$shortWordEndIndex = function(rightOfCursor) {
var match, index = 0, ch;
var whitespaceRe = /\s/;
var tokenRe = this.session.tokenRe;
tokenRe.lastIndex = 0;
if (match = this.session.tokenRe.exec(rightOfCursor)) {
index = this.session.tokenRe.lastIndex;
} else {
while ((ch = rightOfCursor[index]) && whitespaceRe.test(ch))
index ++;
if (index < 1) {
tokenRe.lastIndex = 0;
while ((ch = rightOfCursor[index]) && !tokenRe.test(ch)) {
tokenRe.lastIndex = 0;
index ++;
if (whitespaceRe.test(ch)) {
if (index > 2) {
index--;
break;
} else {
while ((ch = rightOfCursor[index]) && whitespaceRe.test(ch))
index ++;
if (index > 2)
break;
}
}
}
}
}
tokenRe.lastIndex = 0;
return index;
};
this.moveCursorShortWordRight = function() {
var row = this.lead.row;
var column = this.lead.column;
var line = this.doc.getLine(row);
var rightOfCursor = line.substring(column);
var fold = this.session.getFoldAt(row, column, 1);
if (fold)
return this.moveCursorTo(fold.end.row, fold.end.column);
if (column == line.length) {
var l = this.doc.getLength();
do {
row++;
rightOfCursor = this.doc.getLine(row);
} while (row < l && /^\s*$/.test(rightOfCursor));
if (!/^\s+/.test(rightOfCursor))
rightOfCursor = "";
column = 0;
}
var index = this.$shortWordEndIndex(rightOfCursor);
this.moveCursorTo(row, column + index);
};
this.moveCursorShortWordLeft = function() {
var row = this.lead.row;
var column = this.lead.column;
var fold;
if (fold = this.session.getFoldAt(row, column, -1))
return this.moveCursorTo(fold.start.row, fold.start.column);
var line = this.session.getLine(row).substring(0, column);
if (column === 0) {
do {
row--;
line = this.doc.getLine(row);
} while (row > 0 && /^\s*$/.test(line));
column = line.length;
if (!/\s+$/.test(line))
line = "";
}
var leftOfCursor = lang.stringReverse(line);
var index = this.$shortWordEndIndex(leftOfCursor);
return this.moveCursorTo(row, column - index);
};
this.moveCursorWordRight = function() {
if (this.session.$selectLongWords)
this.moveCursorLongWordRight();
else
this.moveCursorShortWordRight();
};
this.moveCursorWordLeft = function() {
if (this.session.$selectLongWords)
this.moveCursorLongWordLeft();
else
this.moveCursorShortWordLeft();
};
this.moveCursorBy = function(rows, chars) {
var screenPos = this.session.documentToScreenPosition(
this.lead.row,
this.lead.column
);
if (chars === 0) {
if (this.$desiredColumn)
screenPos.column = this.$desiredColumn;
else
this.$desiredColumn = screenPos.column;
}
var docPos = this.session.screenToDocumentPosition(screenPos.row + rows, screenPos.column);
if (rows !== 0 && chars === 0 && docPos.row === this.lead.row && docPos.column === this.lead.column) {
if (this.session.lineWidgets && this.session.lineWidgets[docPos.row]) {
if (docPos.row > 0 || rows > 0)
docPos.row++;
}
}
this.moveCursorTo(docPos.row, docPos.column + chars, chars === 0);
};
this.moveCursorToPosition = function(position) {
this.moveCursorTo(position.row, position.column);
};
this.moveCursorTo = function(row, column, keepDesiredColumn) {
var fold = this.session.getFoldAt(row, column, 1);
if (fold) {
row = fold.start.row;
column = fold.start.column;
}
this.$keepDesiredColumnOnChange = true;
this.lead.setPosition(row, column);
this.$keepDesiredColumnOnChange = false;
if (!keepDesiredColumn)
this.$desiredColumn = null;
};
this.moveCursorToScreen = function(row, column, keepDesiredColumn) {
var pos = this.session.screenToDocumentPosition(row, column);
this.moveCursorTo(pos.row, pos.column, keepDesiredColumn);
};
this.detach = function() {
this.lead.detach();
this.anchor.detach();
this.session = this.doc = null;
};
this.fromOrientedRange = function(range) {
this.setSelectionRange(range, range.cursor == range.start);
this.$desiredColumn = range.desiredColumn || this.$desiredColumn;
};
this.toOrientedRange = function(range) {
var r = this.getRange();
if (range) {
range.start.column = r.start.column;
range.start.row = r.start.row;
range.end.column = r.end.column;
range.end.row = r.end.row;
} else {
range = r;
}
range.cursor = this.isBackwards() ? range.start : range.end;
range.desiredColumn = this.$desiredColumn;
return range;
};
this.getRangeOfMovements = function(func) {
var start = this.getCursor();
try {
func(this);
var end = this.getCursor();
return Range.fromPoints(start,end);
} catch(e) {
return Range.fromPoints(start,start);
} finally {
this.moveCursorToPosition(start);
}
};
this.toJSON = function() {
if (this.rangeCount) {
var data = this.ranges.map(function(r) {
var r1 = r.clone();
r1.isBackwards = r.cursor == r.start;
return r1;
});
} else {
var data = this.getRange();
data.isBackwards = this.isBackwards();
}
return data;
};
this.fromJSON = function(data) {
if (data.start == undefined) {
if (this.rangeList) {
this.toSingleRange(data[0]);
for (var i = data.length; i--; ) {
var r = Range.fromPoints(data[i].start, data[i].end);
if (data[i].isBackwards)
r.cursor = r.start;
this.addRange(r, true);
}
return;
} else
data = data[0];
}
if (this.rangeList)
this.toSingleRange(data);
this.setSelectionRange(data, data.isBackwards);
};
this.isEqual = function(data) {
if ((data.length || this.rangeCount) && data.length != this.rangeCount)
return false;
if (!data.length || !this.ranges)
return this.getRange().isEqual(data);
for (var i = this.ranges.length; i--; ) {
if (!this.ranges[i].isEqual(data[i]))
return false;
}
return true;
};
}).call(Selection.prototype);
exports.Selection = Selection;
});
ace.define("ace/tokenizer",["require","exports","module","ace/config"], function(acequire, exports, module) {
"use strict";
var config = acequire("./config");
var MAX_TOKEN_COUNT = 2000;
var Tokenizer = function(rules) {
this.states = rules;
this.regExps = {};
this.matchMappings = {};
for (var key in this.states) {
var state = this.states[key];
var ruleRegExps = [];
var matchTotal = 0;
var mapping = this.matchMappings[key] = {defaultToken: "text"};
var flag = "g";
var splitterRurles = [];
for (var i = 0; i < state.length; i++) {
var rule = state[i];
if (rule.defaultToken)
mapping.defaultToken = rule.defaultToken;
if (rule.caseInsensitive)
flag = "gi";
if (rule.regex == null)
continue;
if (rule.regex instanceof RegExp)
rule.regex = rule.regex.toString().slice(1, -1);
var adjustedregex = rule.regex;
var matchcount = new RegExp("(?:(" + adjustedregex + ")|(.))").exec("a").length - 2;
if (Array.isArray(rule.token)) {
if (rule.token.length == 1 || matchcount == 1) {
rule.token = rule.token[0];
} else if (matchcount - 1 != rule.token.length) {
this.reportError("number of classes and regexp groups doesn't match", {
rule: rule,
groupCount: matchcount - 1
});
rule.token = rule.token[0];
} else {
rule.tokenArray = rule.token;
rule.token = null;
rule.onMatch = this.$arrayTokens;
}
} else if (typeof rule.token == "function" && !rule.onMatch) {
if (matchcount > 1)
rule.onMatch = this.$applyToken;
else
rule.onMatch = rule.token;
}
if (matchcount > 1) {
if (/\\\d/.test(rule.regex)) {
adjustedregex = rule.regex.replace(/\\([0-9]+)/g, function(match, digit) {
return "\\" + (parseInt(digit, 10) + matchTotal + 1);
});
} else {
matchcount = 1;
adjustedregex = this.removeCapturingGroups(rule.regex);
}
if (!rule.splitRegex && typeof rule.token != "string")
splitterRurles.push(rule); // flag will be known only at the very end
}
mapping[matchTotal] = i;
matchTotal += matchcount;
ruleRegExps.push(adjustedregex);
if (!rule.onMatch)
rule.onMatch = null;
}
if (!ruleRegExps.length) {
mapping[0] = 0;
ruleRegExps.push("$");
}
splitterRurles.forEach(function(rule) {
rule.splitRegex = this.createSplitterRegexp(rule.regex, flag);
}, this);
this.regExps[key] = new RegExp("(" + ruleRegExps.join(")|(") + ")|($)", flag);
}
};
(function() {
this.$setMaxTokenCount = function(m) {
MAX_TOKEN_COUNT = m | 0;
};
this.$applyToken = function(str) {
var values = this.splitRegex.exec(str).slice(1);
var types = this.token.apply(this, values);
if (typeof types === "string")
return [{type: types, value: str}];
var tokens = [];
for (var i = 0, l = types.length; i < l; i++) {
if (values[i])
tokens[tokens.length] = {
type: types[i],
value: values[i]
};
}
return tokens;
};
this.$arrayTokens = function(str) {
if (!str)
return [];
var values = this.splitRegex.exec(str);
if (!values)
return "text";
var tokens = [];
var types = this.tokenArray;
for (var i = 0, l = types.length; i < l; i++) {
if (values[i + 1])
tokens[tokens.length] = {
type: types[i],
value: values[i + 1]
};
}
return tokens;
};
this.removeCapturingGroups = function(src) {
var r = src.replace(
/\[(?:\\.|[^\]])*?\]|\\.|\(\?[:=!]|(\()/g,
function(x, y) {return y ? "(?:" : x;}
);
return r;
};
this.createSplitterRegexp = function(src, flag) {
if (src.indexOf("(?=") != -1) {
var stack = 0;
var inChClass = false;
var lastCapture = {};
src.replace(/(\\.)|(\((?:\?[=!])?)|(\))|([\[\]])/g, function(
m, esc, parenOpen, parenClose, square, index
) {
if (inChClass) {
inChClass = square != "]";
} else if (square) {
inChClass = true;
} else if (parenClose) {
if (stack == lastCapture.stack) {
lastCapture.end = index+1;
lastCapture.stack = -1;
}
stack--;
} else if (parenOpen) {
stack++;
if (parenOpen.length != 1) {
lastCapture.stack = stack
lastCapture.start = index;
}
}
return m;
});
if (lastCapture.end != null && /^\)*$/.test(src.substr(lastCapture.end)))
src = src.substring(0, lastCapture.start) + src.substr(lastCapture.end);
}
if (src.charAt(0) != "^") src = "^" + src;
if (src.charAt(src.length - 1) != "$") src += "$";
return new RegExp(src, (flag||"").replace("g", ""));
};
this.getLineTokens = function(line, startState) {
if (startState && typeof startState != "string") {
var stack = startState.slice(0);
startState = stack[0];
if (startState === "#tmp") {
stack.shift()
startState = stack.shift()
}
} else
var stack = [];
var currentState = startState || "start";
var state = this.states[currentState];
if (!state) {
currentState = "start";
state = this.states[currentState];
}
var mapping = this.matchMappings[currentState];
var re = this.regExps[currentState];
re.lastIndex = 0;
var match, tokens = [];
var lastIndex = 0;
var matchAttempts = 0;
var token = {type: null, value: ""};
while (match = re.exec(line)) {
var type = mapping.defaultToken;
var rule = null;
var value = match[0];
var index = re.lastIndex;
if (index - value.length > lastIndex) {
var skipped = line.substring(lastIndex, index - value.length);
if (token.type == type) {
token.value += skipped;
} else {
if (token.type)
tokens.push(token);
token = {type: type, value: skipped};
}
}
for (var i = 0; i < match.length-2; i++) {
if (match[i + 1] === undefined)
continue;
rule = state[mapping[i]];
if (rule.onMatch)
type = rule.onMatch(value, currentState, stack);
else
type = rule.token;
if (rule.next) {
if (typeof rule.next == "string") {
currentState = rule.next;
} else {
currentState = rule.next(currentState, stack);
}
state = this.states[currentState];
if (!state) {
this.reportError("state doesn't exist", currentState);
currentState = "start";
state = this.states[currentState];
}
mapping = this.matchMappings[currentState];
lastIndex = index;
re = this.regExps[currentState];
re.lastIndex = index;
}
break;
}
if (value) {
if (typeof type === "string") {
if ((!rule || rule.merge !== false) && token.type === type) {
token.value += value;
} else {
if (token.type)
tokens.push(token);
token = {type: type, value: value};
}
} else if (type) {
if (token.type)
tokens.push(token);
token = {type: null, value: ""};
for (var i = 0; i < type.length; i++)
tokens.push(type[i]);
}
}
if (lastIndex == line.length)
break;
lastIndex = index;
if (matchAttempts++ > MAX_TOKEN_COUNT) {
if (matchAttempts > 2 * line.length) {
this.reportError("infinite loop with in ace tokenizer", {
startState: startState,
line: line
});
}
while (lastIndex < line.length) {
if (token.type)
tokens.push(token);
token = {
value: line.substring(lastIndex, lastIndex += 2000),
type: "overflow"
};
}
currentState = "start";
stack = [];
break;
}
}
if (token.type)
tokens.push(token);
if (stack.length > 1) {
if (stack[0] !== currentState)
stack.unshift("#tmp", currentState);
}
return {
tokens : tokens,
state : stack.length ? stack : currentState
};
};
this.reportError = config.reportError;
}).call(Tokenizer.prototype);
exports.Tokenizer = Tokenizer;
});
ace.define("ace/mode/text_highlight_rules",["require","exports","module","ace/lib/lang"], function(acequire, exports, module) {
"use strict";
var lang = acequire("../lib/lang");
var TextHighlightRules = function() {
this.$rules = {
"start" : [{
token : "empty_line",
regex : '^$'
}, {
defaultToken : "text"
}]
};
};
(function() {
this.addRules = function(rules, prefix) {
if (!prefix) {
for (var key in rules)
this.$rules[key] = rules[key];
return;
}
for (var key in rules) {
var state = rules[key];
for (var i = 0; i < state.length; i++) {
var rule = state[i];
if (rule.next || rule.onMatch) {
if (typeof rule.next == "string") {
if (rule.next.indexOf(prefix) !== 0)
rule.next = prefix + rule.next;
}
if (rule.nextState && rule.nextState.indexOf(prefix) !== 0)
rule.nextState = prefix + rule.nextState;
}
}
this.$rules[prefix + key] = state;
}
};
this.getRules = function() {
return this.$rules;
};
this.embedRules = function (HighlightRules, prefix, escapeRules, states, append) {
var embedRules = typeof HighlightRules == "function"
? new HighlightRules().getRules()
: HighlightRules;
if (states) {
for (var i = 0; i < states.length; i++)
states[i] = prefix + states[i];
} else {
states = [];
for (var key in embedRules)
states.push(prefix + key);
}
this.addRules(embedRules, prefix);
if (escapeRules) {
var addRules = Array.prototype[append ? "push" : "unshift"];
for (var i = 0; i < states.length; i++)
addRules.apply(this.$rules[states[i]], lang.deepCopy(escapeRules));
}
if (!this.$embeds)
this.$embeds = [];
this.$embeds.push(prefix);
};
this.getEmbeds = function() {
return this.$embeds;
};
var pushState = function(currentState, stack) {
if (currentState != "start" || stack.length)
stack.unshift(this.nextState, currentState);
return this.nextState;
};
var popState = function(currentState, stack) {
stack.shift();
return stack.shift() || "start";
};
this.normalizeRules = function() {
var id = 0;
var rules = this.$rules;
function processState(key) {
var state = rules[key];
state.processed = true;
for (var i = 0; i < state.length; i++) {
var rule = state[i];
var toInsert = null;
if (Array.isArray(rule)) {
toInsert = rule;
rule = {};
}
if (!rule.regex && rule.start) {
rule.regex = rule.start;
if (!rule.next)
rule.next = [];
rule.next.push({
defaultToken: rule.token
}, {
token: rule.token + ".end",
regex: rule.end || rule.start,
next: "pop"
});
rule.token = rule.token + ".start";
rule.push = true;
}
var next = rule.next || rule.push;
if (next && Array.isArray(next)) {
var stateName = rule.stateName;
if (!stateName) {
stateName = rule.token;
if (typeof stateName != "string")
stateName = stateName[0] || "";
if (rules[stateName])
stateName += id++;
}
rules[stateName] = next;
rule.next = stateName;
processState(stateName);
} else if (next == "pop") {
rule.next = popState;
}
if (rule.push) {
rule.nextState = rule.next || rule.push;
rule.next = pushState;
delete rule.push;
}
if (rule.rules) {
for (var r in rule.rules) {
if (rules[r]) {
if (rules[r].push)
rules[r].push.apply(rules[r], rule.rules[r]);
} else {
rules[r] = rule.rules[r];
}
}
}
var includeName = typeof rule == "string"
? rule
: typeof rule.include == "string"
? rule.include
: "";
if (includeName) {
toInsert = rules[includeName];
}
if (toInsert) {
var args = [i, 1].concat(toInsert);
if (rule.noEscape)
args = args.filter(function(x) {return !x.next;});
state.splice.apply(state, args);
i--;
}
if (rule.keywordMap) {
rule.token = this.createKeywordMapper(
rule.keywordMap, rule.defaultToken || "text", rule.caseInsensitive
);
delete rule.defaultToken;
}
}
}
Object.keys(rules).forEach(processState, this);
};
this.createKeywordMapper = function(map, defaultToken, ignoreCase, splitChar) {
var keywords = Object.create(null);
Object.keys(map).forEach(function(className) {
var a = map[className];
if (ignoreCase)
a = a.toLowerCase();
var list = a.split(splitChar || "|");
for (var i = list.length; i--; )
keywords[list[i]] = className;
});
if (Object.getPrototypeOf(keywords)) {
keywords.__proto__ = null;
}
this.$keywordList = Object.keys(keywords);
map = null;
return ignoreCase
? function(value) {return keywords[value.toLowerCase()] || defaultToken }
: function(value) {return keywords[value] || defaultToken };
};
this.getKeywords = function() {
return this.$keywords;
};
}).call(TextHighlightRules.prototype);
exports.TextHighlightRules = TextHighlightRules;
});
ace.define("ace/mode/behaviour",["require","exports","module"], function(acequire, exports, module) {
"use strict";
var Behaviour = function() {
this.$behaviours = {};
};
(function () {
this.add = function (name, action, callback) {
switch (undefined) {
case this.$behaviours:
this.$behaviours = {};
case this.$behaviours[name]:
this.$behaviours[name] = {};
}
this.$behaviours[name][action] = callback;
}
this.addBehaviours = function (behaviours) {
for (var key in behaviours) {
for (var action in behaviours[key]) {
this.add(key, action, behaviours[key][action]);
}
}
}
this.remove = function (name) {
if (this.$behaviours && this.$behaviours[name]) {
delete this.$behaviours[name];
}
}
this.inherit = function (mode, filter) {
if (typeof mode === "function") {
var behaviours = new mode().getBehaviours(filter);
} else {
var behaviours = mode.getBehaviours(filter);
}
this.addBehaviours(behaviours);
}
this.getBehaviours = function (filter) {
if (!filter) {
return this.$behaviours;
} else {
var ret = {}
for (var i = 0; i < filter.length; i++) {
if (this.$behaviours[filter[i]]) {
ret[filter[i]] = this.$behaviours[filter[i]];
}
}
return ret;
}
}
}).call(Behaviour.prototype);
exports.Behaviour = Behaviour;
});
ace.define("ace/token_iterator",["require","exports","module"], function(acequire, exports, module) {
"use strict";
var TokenIterator = function(session, initialRow, initialColumn) {
this.$session = session;
this.$row = initialRow;
this.$rowTokens = session.getTokens(initialRow);
var token = session.getTokenAt(initialRow, initialColumn);
this.$tokenIndex = token ? token.index : -1;
};
(function() {
this.stepBackward = function() {
this.$tokenIndex -= 1;
while (this.$tokenIndex < 0) {
this.$row -= 1;
if (this.$row < 0) {
this.$row = 0;
return null;
}
this.$rowTokens = this.$session.getTokens(this.$row);
this.$tokenIndex = this.$rowTokens.length - 1;
}
return this.$rowTokens[this.$tokenIndex];
};
this.stepForward = function() {
this.$tokenIndex += 1;
var rowCount;
while (this.$tokenIndex >= this.$rowTokens.length) {
this.$row += 1;
if (!rowCount)
rowCount = this.$session.getLength();
if (this.$row >= rowCount) {
this.$row = rowCount - 1;
return null;
}
this.$rowTokens = this.$session.getTokens(this.$row);
this.$tokenIndex = 0;
}
return this.$rowTokens[this.$tokenIndex];
};
this.getCurrentToken = function () {
return this.$rowTokens[this.$tokenIndex];
};
this.getCurrentTokenRow = function () {
return this.$row;
};
this.getCurrentTokenColumn = function() {
var rowTokens = this.$rowTokens;
var tokenIndex = this.$tokenIndex;
var column = rowTokens[tokenIndex].start;
if (column !== undefined)
return column;
column = 0;
while (tokenIndex > 0) {
tokenIndex -= 1;
column += rowTokens[tokenIndex].value.length;
}
return column;
};
this.getCurrentTokenPosition = function() {
return {row: this.$row, column: this.getCurrentTokenColumn()};
};
}).call(TokenIterator.prototype);
exports.TokenIterator = TokenIterator;
});
ace.define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(acequire, exports, module) {
"use strict";
var oop = acequire("../../lib/oop");
var Behaviour = acequire("../behaviour").Behaviour;
var TokenIterator = acequire("../../token_iterator").TokenIterator;
var lang = acequire("../../lib/lang");
var SAFE_INSERT_IN_TOKENS =
["text", "paren.rparen", "punctuation.operator"];
var SAFE_INSERT_BEFORE_TOKENS =
["text", "paren.rparen", "punctuation.operator", "comment"];
var context;
var contextCache = {};
var initContext = function(editor) {
var id = -1;
if (editor.multiSelect) {
id = editor.selection.index;
if (contextCache.rangeCount != editor.multiSelect.rangeCount)
contextCache = {rangeCount: editor.multiSelect.rangeCount};
}
if (contextCache[id])
return context = contextCache[id];
context = contextCache[id] = {
autoInsertedBrackets: 0,
autoInsertedRow: -1,
autoInsertedLineEnd: "",
maybeInsertedBrackets: 0,
maybeInsertedRow: -1,
maybeInsertedLineStart: "",
maybeInsertedLineEnd: ""
};
};
var getWrapped = function(selection, selected, opening, closing) {
var rowDiff = selection.end.row - selection.start.row;
return {
text: opening + selected + closing,
selection: [
0,
selection.start.column + 1,
rowDiff,
selection.end.column + (rowDiff ? 0 : 1)
]
};
};
var CstyleBehaviour = function() {
this.add("braces", "insertion", function(state, action, editor, session, text) {
var cursor = editor.getCursorPosition();
var line = session.doc.getLine(cursor.row);
if (text == '{') {
initContext(editor);
var selection = editor.getSelectionRange();
var selected = session.doc.getTextRange(selection);
if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
return getWrapped(selection, selected, '{', '}');
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
CstyleBehaviour.recordAutoInsert(editor, session, "}");
return {
text: '{}',
selection: [1, 1]
};
} else {
CstyleBehaviour.recordMaybeInsert(editor, session, "{");
return {
text: '{',
selection: [1, 1]
};
}
}
} else if (text == '}') {
initContext(editor);
var rightChar = line.substring(cursor.column, cursor.column + 1);
if (rightChar == '}') {
var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
CstyleBehaviour.popAutoInsertedClosing();
return {
text: '',
selection: [1, 1]
};
}
}
} else if (text == "\n" || text == "\r\n") {
initContext(editor);
var closing = "";
if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
CstyleBehaviour.clearMaybeInsertedClosing();
}
var rightChar = line.substring(cursor.column, cursor.column + 1);
if (rightChar === '}') {
var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
if (!openBracePos)
return null;
var next_indent = this.$getIndent(session.getLine(openBracePos.row));
} else if (closing) {
var next_indent = this.$getIndent(line);
} else {
CstyleBehaviour.clearMaybeInsertedClosing();
return;
}
var indent = next_indent + session.getTabString();
return {
text: '\n' + indent + '\n' + next_indent + closing,
selection: [1, indent.length, 1, indent.length]
};
} else {
CstyleBehaviour.clearMaybeInsertedClosing();
}
});
this.add("braces", "deletion", function(state, action, editor, session, range) {
var selected = session.doc.getTextRange(range);
if (!range.isMultiLine() && selected == '{') {
initContext(editor);
var line = session.doc.getLine(range.start.row);
var rightChar = line.substring(range.end.column, range.end.column + 1);
if (rightChar == '}') {
range.end.column++;
return range;
} else {
context.maybeInsertedBrackets--;
}
}
});
this.add("parens", "insertion", function(state, action, editor, session, text) {
if (text == '(') {
initContext(editor);
var selection = editor.getSelectionRange();
var selected = session.doc.getTextRange(selection);
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
return getWrapped(selection, selected, '(', ')');
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
CstyleBehaviour.recordAutoInsert(editor, session, ")");
return {
text: '()',
selection: [1, 1]
};
}
} else if (text == ')') {
initContext(editor);
var cursor = editor.getCursorPosition();
var line = session.doc.getLine(cursor.row);
var rightChar = line.substring(cursor.column, cursor.column + 1);
if (rightChar == ')') {
var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
CstyleBehaviour.popAutoInsertedClosing();
return {
text: '',
selection: [1, 1]
};
}
}
}
});
this.add("parens", "deletion", function(state, action, editor, session, range) {
var selected = session.doc.getTextRange(range);
if (!range.isMultiLine() && selected == '(') {
initContext(editor);
var line = session.doc.getLine(range.start.row);
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
if (rightChar == ')') {
range.end.column++;
return range;
}
}
});
this.add("brackets", "insertion", function(state, action, editor, session, text) {
if (text == '[') {
initContext(editor);
var selection = editor.getSelectionRange();
var selected = session.doc.getTextRange(selection);
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
return getWrapped(selection, selected, '[', ']');
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
CstyleBehaviour.recordAutoInsert(editor, session, "]");
return {
text: '[]',
selection: [1, 1]
};
}
} else if (text == ']') {
initContext(editor);
var cursor = editor.getCursorPosition();
var line = session.doc.getLine(cursor.row);
var rightChar = line.substring(cursor.column, cursor.column + 1);
if (rightChar == ']') {
var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
CstyleBehaviour.popAutoInsertedClosing();
return {
text: '',
selection: [1, 1]
};
}
}
}
});
this.add("brackets", "deletion", function(state, action, editor, session, range) {
var selected = session.doc.getTextRange(range);
if (!range.isMultiLine() && selected == '[') {
initContext(editor);
var line = session.doc.getLine(range.start.row);
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
if (rightChar == ']') {
range.end.column++;
return range;
}
}
});
this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
if (text == '"' || text == "'") {
if (this.lineCommentStart && this.lineCommentStart.indexOf(text) != -1)
return;
initContext(editor);
var quote = text;
var selection = editor.getSelectionRange();
var selected = session.doc.getTextRange(selection);
if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
return getWrapped(selection, selected, quote, quote);
} else if (!selected) {
var cursor = editor.getCursorPosition();
var line = session.doc.getLine(cursor.row);
var leftChar = line.substring(cursor.column-1, cursor.column);
var rightChar = line.substring(cursor.column, cursor.column + 1);
var token = session.getTokenAt(cursor.row, cursor.column);
var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
if (leftChar == "\\" && token && /escape/.test(token.type))
return null;
var stringBefore = token && /string|escape/.test(token.type);
var stringAfter = !rightToken || /string|escape/.test(rightToken.type);
var pair;
if (rightChar == quote) {
pair = stringBefore !== stringAfter;
if (pair && /string\.end/.test(rightToken.type))
pair = false;
} else {
if (stringBefore && !stringAfter)
return null; // wrap string with different quote
if (stringBefore && stringAfter)
return null; // do not pair quotes inside strings
var wordRe = session.$mode.tokenRe;
wordRe.lastIndex = 0;
var isWordBefore = wordRe.test(leftChar);
wordRe.lastIndex = 0;
var isWordAfter = wordRe.test(leftChar);
if (isWordBefore || isWordAfter)
return null; // before or after alphanumeric
if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
return null; // there is rightChar and it isn't closing
pair = true;
}
return {
text: pair ? quote + quote : "",
selection: [1,1]
};
}
}
});
this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
var selected = session.doc.getTextRange(range);
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
initContext(editor);
var line = session.doc.getLine(range.start.row);
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
if (rightChar == selected) {
range.end.column++;
return range;
}
}
});
};
CstyleBehaviour.isSaneInsertion = function(editor, session) {
var cursor = editor.getCursorPosition();
var iterator = new TokenIterator(session, cursor.row, cursor.column);
if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
return false;
}
iterator.stepForward();
return iterator.getCurrentTokenRow() !== cursor.row ||
this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
};
CstyleBehaviour.$matchTokenType = function(token, types) {
return types.indexOf(token.type || token) > -1;
};
CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
var cursor = editor.getCursorPosition();
var line = session.doc.getLine(cursor.row);
if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
context.autoInsertedBrackets = 0;
context.autoInsertedRow = cursor.row;
context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
context.autoInsertedBrackets++;
};
CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
var cursor = editor.getCursorPosition();
var line = session.doc.getLine(cursor.row);
if (!this.isMaybeInsertedClosing(cursor, line))
context.maybeInsertedBrackets = 0;
context.maybeInsertedRow = cursor.row;
context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
context.maybeInsertedLineEnd = line.substr(cursor.column);
context.maybeInsertedBrackets++;
};
CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
return context.autoInsertedBrackets > 0 &&
cursor.row === context.autoInsertedRow &&
bracket === context.autoInsertedLineEnd[0] &&
line.substr(cursor.column) === context.autoInsertedLineEnd;
};
CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
return context.maybeInsertedBrackets > 0 &&
cursor.row === context.maybeInsertedRow &&
line.substr(cursor.column) === context.maybeInsertedLineEnd &&
line.substr(0, cursor.column) == context.maybeInsertedLineStart;
};
CstyleBehaviour.popAutoInsertedClosing = function() {
context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
context.autoInsertedBrackets--;
};
CstyleBehaviour.clearMaybeInsertedClosing = function() {
if (context) {
context.maybeInsertedBrackets = 0;
context.maybeInsertedRow = -1;
}
};
oop.inherits(CstyleBehaviour, Behaviour);
exports.CstyleBehaviour = CstyleBehaviour;
});
ace.define("ace/unicode",["require","exports","module"], function(acequire, exports, module) {
"use strict";
exports.packages = {};
addUnicodePackage({
L: "0041-005A0061-007A00AA00B500BA00C0-00D600D8-00F600F8-02C102C6-02D102E0-02E402EC02EE0370-037403760377037A-037D03860388-038A038C038E-03A103A3-03F503F7-0481048A-05250531-055605590561-058705D0-05EA05F0-05F20621-064A066E066F0671-06D306D506E506E606EE06EF06FA-06FC06FF07100712-072F074D-07A507B107CA-07EA07F407F507FA0800-0815081A082408280904-0939093D09500958-0961097109720979-097F0985-098C098F09900993-09A809AA-09B009B209B6-09B909BD09CE09DC09DD09DF-09E109F009F10A05-0A0A0A0F0A100A13-0A280A2A-0A300A320A330A350A360A380A390A59-0A5C0A5E0A72-0A740A85-0A8D0A8F-0A910A93-0AA80AAA-0AB00AB20AB30AB5-0AB90ABD0AD00AE00AE10B05-0B0C0B0F0B100B13-0B280B2A-0B300B320B330B35-0B390B3D0B5C0B5D0B5F-0B610B710B830B85-0B8A0B8E-0B900B92-0B950B990B9A0B9C0B9E0B9F0BA30BA40BA8-0BAA0BAE-0BB90BD00C05-0C0C0C0E-0C100C12-0C280C2A-0C330C35-0C390C3D0C580C590C600C610C85-0C8C0C8E-0C900C92-0CA80CAA-0CB30CB5-0CB90CBD0CDE0CE00CE10D05-0D0C0D0E-0D100D12-0D280D2A-0D390D3D0D600D610D7A-0D7F0D85-0D960D9A-0DB10DB3-0DBB0DBD0DC0-0DC60E01-0E300E320E330E40-0E460E810E820E840E870E880E8A0E8D0E94-0E970E99-0E9F0EA1-0EA30EA50EA70EAA0EAB0EAD-0EB00EB20EB30EBD0EC0-0EC40EC60EDC0EDD0F000F40-0F470F49-0F6C0F88-0F8B1000-102A103F1050-1055105A-105D106110651066106E-10701075-1081108E10A0-10C510D0-10FA10FC1100-1248124A-124D1250-12561258125A-125D1260-1288128A-128D1290-12B012B2-12B512B8-12BE12C012C2-12C512C8-12D612D8-13101312-13151318-135A1380-138F13A0-13F41401-166C166F-167F1681-169A16A0-16EA1700-170C170E-17111720-17311740-17511760-176C176E-17701780-17B317D717DC1820-18771880-18A818AA18B0-18F51900-191C1950-196D1970-19741980-19AB19C1-19C71A00-1A161A20-1A541AA71B05-1B331B45-1B4B1B83-1BA01BAE1BAF1C00-1C231C4D-1C4F1C5A-1C7D1CE9-1CEC1CEE-1CF11D00-1DBF1E00-1F151F18-1F1D1F20-1F451F48-1F4D1F50-1F571F591F5B1F5D1F5F-1F7D1F80-1FB41FB6-1FBC1FBE1FC2-1FC41FC6-1FCC1FD0-1FD31FD6-1FDB1FE0-1FEC1FF2-1FF41FF6-1FFC2071207F2090-209421022107210A-211321152119-211D212421262128212A-212D212F-2139213C-213F2145-2149214E218321842C00-2C2E2C30-2C5E2C60-2CE42CEB-2CEE2D00-2D252D30-2D652D6F2D80-2D962DA0-2DA62DA8-2DAE2DB0-2DB62DB8-2DBE2DC0-2DC62DC8-2DCE2DD0-2DD62DD8-2DDE2E2F300530063031-3035303B303C3041-3096309D-309F30A1-30FA30FC-30FF3105-312D3131-318E31A0-31B731F0-31FF3400-4DB54E00-9FCBA000-A48CA4D0-A4FDA500-A60CA610-A61FA62AA62BA640-A65FA662-A66EA67F-A697A6A0-A6E5A717-A71FA722-A788A78BA78CA7FB-A801A803-A805A807-A80AA80C-A822A840-A873A882-A8B3A8F2-A8F7A8FBA90A-A925A930-A946A960-A97CA984-A9B2A9CFAA00-AA28AA40-AA42AA44-AA4BAA60-AA76AA7AAA80-AAAFAAB1AAB5AAB6AAB9-AABDAAC0AAC2AADB-AADDABC0-ABE2AC00-D7A3D7B0-D7C6D7CB-D7FBF900-FA2DFA30-FA6DFA70-FAD9FB00-FB06FB13-FB17FB1DFB1F-FB28FB2A-FB36FB38-FB3CFB3EFB40FB41FB43FB44FB46-FBB1FBD3-FD3DFD50-FD8FFD92-FDC7FDF0-FDFBFE70-FE74FE76-FEFCFF21-FF3AFF41-FF5AFF66-FFBEFFC2-FFC7FFCA-FFCFFFD2-FFD7FFDA-FFDC",
Ll: "0061-007A00AA00B500BA00DF-00F600F8-00FF01010103010501070109010B010D010F01110113011501170119011B011D011F01210123012501270129012B012D012F01310133013501370138013A013C013E014001420144014601480149014B014D014F01510153015501570159015B015D015F01610163016501670169016B016D016F0171017301750177017A017C017E-0180018301850188018C018D019201950199-019B019E01A101A301A501A801AA01AB01AD01B001B401B601B901BA01BD-01BF01C601C901CC01CE01D001D201D401D601D801DA01DC01DD01DF01E101E301E501E701E901EB01ED01EF01F001F301F501F901FB01FD01FF02010203020502070209020B020D020F02110213021502170219021B021D021F02210223022502270229022B022D022F02310233-0239023C023F0240024202470249024B024D024F-02930295-02AF037103730377037B-037D039003AC-03CE03D003D103D5-03D703D903DB03DD03DF03E103E303E503E703E903EB03ED03EF-03F303F503F803FB03FC0430-045F04610463046504670469046B046D046F04710473047504770479047B047D047F0481048B048D048F04910493049504970499049B049D049F04A104A304A504A704A904AB04AD04AF04B104B304B504B704B904BB04BD04BF04C204C404C604C804CA04CC04CE04CF04D104D304D504D704D904DB04DD04DF04E104E304E504E704E904EB04ED04EF04F104F304F504F704F904FB04FD04FF05010503050505070509050B050D050F05110513051505170519051B051D051F0521052305250561-05871D00-1D2B1D62-1D771D79-1D9A1E011E031E051E071E091E0B1E0D1E0F1E111E131E151E171E191E1B1E1D1E1F1E211E231E251E271E291E2B1E2D1E2F1E311E331E351E371E391E3B1E3D1E3F1E411E431E451E471E491E4B1E4D1E4F1E511E531E551E571E591E5B1E5D1E5F1E611E631E651E671E691E6B1E6D1E6F1E711E731E751E771E791E7B1E7D1E7F1E811E831E851E871E891E8B1E8D1E8F1E911E931E95-1E9D1E9F1EA11EA31EA51EA71EA91EAB1EAD1EAF1EB11EB31EB51EB71EB91EBB1EBD1EBF1EC11EC31EC51EC71EC91ECB1ECD1ECF1ED11ED31ED51ED71ED91EDB1EDD1EDF1EE11EE31EE51EE71EE91EEB1EED1EEF1EF11EF31EF51EF71EF91EFB1EFD1EFF-1F071F10-1F151F20-1F271F30-1F371F40-1F451F50-1F571F60-1F671F70-1F7D1F80-1F871F90-1F971FA0-1FA71FB0-1FB41FB61FB71FBE1FC2-1FC41FC61FC71FD0-1FD31FD61FD71FE0-1FE71FF2-1FF41FF61FF7210A210E210F2113212F21342139213C213D2146-2149214E21842C30-2C5E2C612C652C662C682C6A2C6C2C712C732C742C76-2C7C2C812C832C852C872C892C8B2C8D2C8F2C912C932C952C972C992C9B2C9D2C9F2CA12CA32CA52CA72CA92CAB2CAD2CAF2CB12CB32CB52CB72CB92CBB2CBD2CBF2CC12CC32CC52CC72CC92CCB2CCD2CCF2CD12CD32CD52CD72CD92CDB2CDD2CDF2CE12CE32CE42CEC2CEE2D00-2D25A641A643A645A647A649A64BA64DA64FA651A653A655A657A659A65BA65DA65FA663A665A667A669A66BA66DA681A683A685A687A689A68BA68DA68FA691A693A695A697A723A725A727A729A72BA72DA72F-A731A733A735A737A739A73BA73DA73FA741A743A745A747A749A74BA74DA74FA751A753A755A757A759A75BA75DA75FA761A763A765A767A769A76BA76DA76FA771-A778A77AA77CA77FA781A783A785A787A78CFB00-FB06FB13-FB17FF41-FF5A",
Lu: "0041-005A00C0-00D600D8-00DE01000102010401060108010A010C010E01100112011401160118011A011C011E01200122012401260128012A012C012E01300132013401360139013B013D013F0141014301450147014A014C014E01500152015401560158015A015C015E01600162016401660168016A016C016E017001720174017601780179017B017D018101820184018601870189-018B018E-0191019301940196-0198019C019D019F01A001A201A401A601A701A901AC01AE01AF01B1-01B301B501B701B801BC01C401C701CA01CD01CF01D101D301D501D701D901DB01DE01E001E201E401E601E801EA01EC01EE01F101F401F6-01F801FA01FC01FE02000202020402060208020A020C020E02100212021402160218021A021C021E02200222022402260228022A022C022E02300232023A023B023D023E02410243-02460248024A024C024E03700372037603860388-038A038C038E038F0391-03A103A3-03AB03CF03D2-03D403D803DA03DC03DE03E003E203E403E603E803EA03EC03EE03F403F703F903FA03FD-042F04600462046404660468046A046C046E04700472047404760478047A047C047E0480048A048C048E04900492049404960498049A049C049E04A004A204A404A604A804AA04AC04AE04B004B204B404B604B804BA04BC04BE04C004C104C304C504C704C904CB04CD04D004D204D404D604D804DA04DC04DE04E004E204E404E604E804EA04EC04EE04F004F204F404F604F804FA04FC04FE05000502050405060508050A050C050E05100512051405160518051A051C051E0520052205240531-055610A0-10C51E001E021E041E061E081E0A1E0C1E0E1E101E121E141E161E181E1A1E1C1E1E1E201E221E241E261E281E2A1E2C1E2E1E301E321E341E361E381E3A1E3C1E3E1E401E421E441E461E481E4A1E4C1E4E1E501E521E541E561E581E5A1E5C1E5E1E601E621E641E661E681E6A1E6C1E6E1E701E721E741E761E781E7A1E7C1E7E1E801E821E841E861E881E8A1E8C1E8E1E901E921E941E9E1EA01EA21EA41EA61EA81EAA1EAC1EAE1EB01EB21EB41EB61EB81EBA1EBC1EBE1EC01EC21EC41EC61EC81ECA1ECC1ECE1ED01ED21ED41ED61ED81EDA1EDC1EDE1EE01EE21EE41EE61EE81EEA1EEC1EEE1EF01EF21EF41EF61EF81EFA1EFC1EFE1F08-1F0F1F18-1F1D1F28-1F2F1F38-1F3F1F48-1F4D1F591F5B1F5D1F5F1F68-1F6F1FB8-1FBB1FC8-1FCB1FD8-1FDB1FE8-1FEC1FF8-1FFB21022107210B-210D2110-211221152119-211D212421262128212A-212D2130-2133213E213F214521832C00-2C2E2C602C62-2C642C672C692C6B2C6D-2C702C722C752C7E-2C802C822C842C862C882C8A2C8C2C8E2C902C922C942C962C982C9A2C9C2C9E2CA02CA22CA42CA62CA82CAA2CAC2CAE2CB02CB22CB42CB62CB82CBA2CBC2CBE2CC02CC22CC42CC62CC82CCA2CCC2CCE2CD02CD22CD42CD62CD82CDA2CDC2CDE2CE02CE22CEB2CEDA640A642A644A646A648A64AA64CA64EA650A652A654A656A658A65AA65CA65EA662A664A666A668A66AA66CA680A682A684A686A688A68AA68CA68EA690A692A694A696A722A724A726A728A72AA72CA72EA732A734A736A738A73AA73CA73EA740A742A744A746A748A74AA74CA74EA750A752A754A756A758A75AA75CA75EA760A762A764A766A768A76AA76CA76EA779A77BA77DA77EA780A782A784A786A78BFF21-FF3A",
Lt: "01C501C801CB01F21F88-1F8F1F98-1F9F1FA8-1FAF1FBC1FCC1FFC",
Lm: "02B0-02C102C6-02D102E0-02E402EC02EE0374037A0559064006E506E607F407F507FA081A0824082809710E460EC610FC17D718431AA71C78-1C7D1D2C-1D611D781D9B-1DBF2071207F2090-20942C7D2D6F2E2F30053031-3035303B309D309E30FC-30FEA015A4F8-A4FDA60CA67FA717-A71FA770A788A9CFAA70AADDFF70FF9EFF9F",
Lo: "01BB01C0-01C3029405D0-05EA05F0-05F20621-063F0641-064A066E066F0671-06D306D506EE06EF06FA-06FC06FF07100712-072F074D-07A507B107CA-07EA0800-08150904-0939093D09500958-096109720979-097F0985-098C098F09900993-09A809AA-09B009B209B6-09B909BD09CE09DC09DD09DF-09E109F009F10A05-0A0A0A0F0A100A13-0A280A2A-0A300A320A330A350A360A380A390A59-0A5C0A5E0A72-0A740A85-0A8D0A8F-0A910A93-0AA80AAA-0AB00AB20AB30AB5-0AB90ABD0AD00AE00AE10B05-0B0C0B0F0B100B13-0B280B2A-0B300B320B330B35-0B390B3D0B5C0B5D0B5F-0B610B710B830B85-0B8A0B8E-0B900B92-0B950B990B9A0B9C0B9E0B9F0BA30BA40BA8-0BAA0BAE-0BB90BD00C05-0C0C0C0E-0C100C12-0C280C2A-0C330C35-0C390C3D0C580C590C600C610C85-0C8C0C8E-0C900C92-0CA80CAA-0CB30CB5-0CB90CBD0CDE0CE00CE10D05-0D0C0D0E-0D100D12-0D280D2A-0D390D3D0D600D610D7A-0D7F0D85-0D960D9A-0DB10DB3-0DBB0DBD0DC0-0DC60E01-0E300E320E330E40-0E450E810E820E840E870E880E8A0E8D0E94-0E970E99-0E9F0EA1-0EA30EA50EA70EAA0EAB0EAD-0EB00EB20EB30EBD0EC0-0EC40EDC0EDD0F000F40-0F470F49-0F6C0F88-0F8B1000-102A103F1050-1055105A-105D106110651066106E-10701075-1081108E10D0-10FA1100-1248124A-124D1250-12561258125A-125D1260-1288128A-128D1290-12B012B2-12B512B8-12BE12C012C2-12C512C8-12D612D8-13101312-13151318-135A1380-138F13A0-13F41401-166C166F-167F1681-169A16A0-16EA1700-170C170E-17111720-17311740-17511760-176C176E-17701780-17B317DC1820-18421844-18771880-18A818AA18B0-18F51900-191C1950-196D1970-19741980-19AB19C1-19C71A00-1A161A20-1A541B05-1B331B45-1B4B1B83-1BA01BAE1BAF1C00-1C231C4D-1C4F1C5A-1C771CE9-1CEC1CEE-1CF12135-21382D30-2D652D80-2D962DA0-2DA62DA8-2DAE2DB0-2DB62DB8-2DBE2DC0-2DC62DC8-2DCE2DD0-2DD62DD8-2DDE3006303C3041-3096309F30A1-30FA30FF3105-312D3131-318E31A0-31B731F0-31FF3400-4DB54E00-9FCBA000-A014A016-A48CA4D0-A4F7A500-A60BA610-A61FA62AA62BA66EA6A0-A6E5A7FB-A801A803-A805A807-A80AA80C-A822A840-A873A882-A8B3A8F2-A8F7A8FBA90A-A925A930-A946A960-A97CA984-A9B2AA00-AA28AA40-AA42AA44-AA4BAA60-AA6FAA71-AA76AA7AAA80-AAAFAAB1AAB5AAB6AAB9-AABDAAC0AAC2AADBAADCABC0-ABE2AC00-D7A3D7B0-D7C6D7CB-D7FBF900-FA2DFA30-FA6DFA70-FAD9FB1DFB1F-FB28FB2A-FB36FB38-FB3CFB3EFB40FB41FB43FB44FB46-FBB1FBD3-FD3DFD50-FD8FFD92-FDC7FDF0-FDFBFE70-FE74FE76-FEFCFF66-FF6FFF71-FF9DFFA0-FFBEFFC2-FFC7FFCA-FFCFFFD2-FFD7FFDA-FFDC",
M: "0300-036F0483-04890591-05BD05BF05C105C205C405C505C70610-061A064B-065E067006D6-06DC06DE-06E406E706E806EA-06ED07110730-074A07A6-07B007EB-07F30816-0819081B-08230825-08270829-082D0900-0903093C093E-094E0951-0955096209630981-098309BC09BE-09C409C709C809CB-09CD09D709E209E30A01-0A030A3C0A3E-0A420A470A480A4B-0A4D0A510A700A710A750A81-0A830ABC0ABE-0AC50AC7-0AC90ACB-0ACD0AE20AE30B01-0B030B3C0B3E-0B440B470B480B4B-0B4D0B560B570B620B630B820BBE-0BC20BC6-0BC80BCA-0BCD0BD70C01-0C030C3E-0C440C46-0C480C4A-0C4D0C550C560C620C630C820C830CBC0CBE-0CC40CC6-0CC80CCA-0CCD0CD50CD60CE20CE30D020D030D3E-0D440D46-0D480D4A-0D4D0D570D620D630D820D830DCA0DCF-0DD40DD60DD8-0DDF0DF20DF30E310E34-0E3A0E47-0E4E0EB10EB4-0EB90EBB0EBC0EC8-0ECD0F180F190F350F370F390F3E0F3F0F71-0F840F860F870F90-0F970F99-0FBC0FC6102B-103E1056-1059105E-10601062-10641067-106D1071-10741082-108D108F109A-109D135F1712-17141732-1734175217531772177317B6-17D317DD180B-180D18A91920-192B1930-193B19B0-19C019C819C91A17-1A1B1A55-1A5E1A60-1A7C1A7F1B00-1B041B34-1B441B6B-1B731B80-1B821BA1-1BAA1C24-1C371CD0-1CD21CD4-1CE81CED1CF21DC0-1DE61DFD-1DFF20D0-20F02CEF-2CF12DE0-2DFF302A-302F3099309AA66F-A672A67CA67DA6F0A6F1A802A806A80BA823-A827A880A881A8B4-A8C4A8E0-A8F1A926-A92DA947-A953A980-A983A9B3-A9C0AA29-AA36AA43AA4CAA4DAA7BAAB0AAB2-AAB4AAB7AAB8AABEAABFAAC1ABE3-ABEAABECABEDFB1EFE00-FE0FFE20-FE26",
Mn: "0300-036F0483-04870591-05BD05BF05C105C205C405C505C70610-061A064B-065E067006D6-06DC06DF-06E406E706E806EA-06ED07110730-074A07A6-07B007EB-07F30816-0819081B-08230825-08270829-082D0900-0902093C0941-0948094D0951-095509620963098109BC09C1-09C409CD09E209E30A010A020A3C0A410A420A470A480A4B-0A4D0A510A700A710A750A810A820ABC0AC1-0AC50AC70AC80ACD0AE20AE30B010B3C0B3F0B41-0B440B4D0B560B620B630B820BC00BCD0C3E-0C400C46-0C480C4A-0C4D0C550C560C620C630CBC0CBF0CC60CCC0CCD0CE20CE30D41-0D440D4D0D620D630DCA0DD2-0DD40DD60E310E34-0E3A0E47-0E4E0EB10EB4-0EB90EBB0EBC0EC8-0ECD0F180F190F350F370F390F71-0F7E0F80-0F840F860F870F90-0F970F99-0FBC0FC6102D-10301032-10371039103A103D103E10581059105E-10601071-1074108210851086108D109D135F1712-17141732-1734175217531772177317B7-17BD17C617C9-17D317DD180B-180D18A91920-19221927192819321939-193B1A171A181A561A58-1A5E1A601A621A65-1A6C1A73-1A7C1A7F1B00-1B031B341B36-1B3A1B3C1B421B6B-1B731B801B811BA2-1BA51BA81BA91C2C-1C331C361C371CD0-1CD21CD4-1CE01CE2-1CE81CED1DC0-1DE61DFD-1DFF20D0-20DC20E120E5-20F02CEF-2CF12DE0-2DFF302A-302F3099309AA66FA67CA67DA6F0A6F1A802A806A80BA825A826A8C4A8E0-A8F1A926-A92DA947-A951A980-A982A9B3A9B6-A9B9A9BCAA29-AA2EAA31AA32AA35AA36AA43AA4CAAB0AAB2-AAB4AAB7AAB8AABEAABFAAC1ABE5ABE8ABEDFB1EFE00-FE0FFE20-FE26",
Mc: "0903093E-09400949-094C094E0982098309BE-09C009C709C809CB09CC09D70A030A3E-0A400A830ABE-0AC00AC90ACB0ACC0B020B030B3E0B400B470B480B4B0B4C0B570BBE0BBF0BC10BC20BC6-0BC80BCA-0BCC0BD70C01-0C030C41-0C440C820C830CBE0CC0-0CC40CC70CC80CCA0CCB0CD50CD60D020D030D3E-0D400D46-0D480D4A-0D4C0D570D820D830DCF-0DD10DD8-0DDF0DF20DF30F3E0F3F0F7F102B102C10311038103B103C105610571062-10641067-106D108310841087-108C108F109A-109C17B617BE-17C517C717C81923-19261929-192B193019311933-193819B0-19C019C819C91A19-1A1B1A551A571A611A631A641A6D-1A721B041B351B3B1B3D-1B411B431B441B821BA11BA61BA71BAA1C24-1C2B1C341C351CE11CF2A823A824A827A880A881A8B4-A8C3A952A953A983A9B4A9B5A9BAA9BBA9BD-A9C0AA2FAA30AA33AA34AA4DAA7BABE3ABE4ABE6ABE7ABE9ABEAABEC",
Me: "0488048906DE20DD-20E020E2-20E4A670-A672",
N: "0030-003900B200B300B900BC-00BE0660-066906F0-06F907C0-07C90966-096F09E6-09EF09F4-09F90A66-0A6F0AE6-0AEF0B66-0B6F0BE6-0BF20C66-0C6F0C78-0C7E0CE6-0CEF0D66-0D750E50-0E590ED0-0ED90F20-0F331040-10491090-10991369-137C16EE-16F017E0-17E917F0-17F91810-18191946-194F19D0-19DA1A80-1A891A90-1A991B50-1B591BB0-1BB91C40-1C491C50-1C5920702074-20792080-20892150-21822185-21892460-249B24EA-24FF2776-27932CFD30073021-30293038-303A3192-31953220-32293251-325F3280-328932B1-32BFA620-A629A6E6-A6EFA830-A835A8D0-A8D9A900-A909A9D0-A9D9AA50-AA59ABF0-ABF9FF10-FF19",
Nd: "0030-00390660-066906F0-06F907C0-07C90966-096F09E6-09EF0A66-0A6F0AE6-0AEF0B66-0B6F0BE6-0BEF0C66-0C6F0CE6-0CEF0D66-0D6F0E50-0E590ED0-0ED90F20-0F291040-10491090-109917E0-17E91810-18191946-194F19D0-19DA1A80-1A891A90-1A991B50-1B591BB0-1BB91C40-1C491C50-1C59A620-A629A8D0-A8D9A900-A909A9D0-A9D9AA50-AA59ABF0-ABF9FF10-FF19",
Nl: "16EE-16F02160-21822185-218830073021-30293038-303AA6E6-A6EF",
No: "00B200B300B900BC-00BE09F4-09F90BF0-0BF20C78-0C7E0D70-0D750F2A-0F331369-137C17F0-17F920702074-20792080-20892150-215F21892460-249B24EA-24FF2776-27932CFD3192-31953220-32293251-325F3280-328932B1-32BFA830-A835",
P: "0021-00230025-002A002C-002F003A003B003F0040005B-005D005F007B007D00A100AB00B700BB00BF037E0387055A-055F0589058A05BE05C005C305C605F305F40609060A060C060D061B061E061F066A-066D06D40700-070D07F7-07F90830-083E0964096509700DF40E4F0E5A0E5B0F04-0F120F3A-0F3D0F850FD0-0FD4104A-104F10FB1361-13681400166D166E169B169C16EB-16ED1735173617D4-17D617D8-17DA1800-180A1944194519DE19DF1A1E1A1F1AA0-1AA61AA8-1AAD1B5A-1B601C3B-1C3F1C7E1C7F1CD32010-20272030-20432045-20512053-205E207D207E208D208E2329232A2768-277527C527C627E6-27EF2983-299829D8-29DB29FC29FD2CF9-2CFC2CFE2CFF2E00-2E2E2E302E313001-30033008-30113014-301F3030303D30A030FBA4FEA4FFA60D-A60FA673A67EA6F2-A6F7A874-A877A8CEA8CFA8F8-A8FAA92EA92FA95FA9C1-A9CDA9DEA9DFAA5C-AA5FAADEAADFABEBFD3EFD3FFE10-FE19FE30-FE52FE54-FE61FE63FE68FE6AFE6BFF01-FF03FF05-FF0AFF0C-FF0FFF1AFF1BFF1FFF20FF3B-FF3DFF3FFF5BFF5DFF5F-FF65",
Pd: "002D058A05BE140018062010-20152E172E1A301C303030A0FE31FE32FE58FE63FF0D",
Ps: "0028005B007B0F3A0F3C169B201A201E2045207D208D23292768276A276C276E27702772277427C527E627E827EA27EC27EE2983298529872989298B298D298F299129932995299729D829DA29FC2E222E242E262E283008300A300C300E3010301430163018301A301DFD3EFE17FE35FE37FE39FE3BFE3DFE3FFE41FE43FE47FE59FE5BFE5DFF08FF3BFF5BFF5FFF62",
Pe: "0029005D007D0F3B0F3D169C2046207E208E232A2769276B276D276F27712773277527C627E727E927EB27ED27EF298429862988298A298C298E2990299229942996299829D929DB29FD2E232E252E272E293009300B300D300F3011301530173019301B301E301FFD3FFE18FE36FE38FE3AFE3CFE3EFE40FE42FE44FE48FE5AFE5CFE5EFF09FF3DFF5DFF60FF63",
Pi: "00AB2018201B201C201F20392E022E042E092E0C2E1C2E20",
Pf: "00BB2019201D203A2E032E052E0A2E0D2E1D2E21",
Pc: "005F203F20402054FE33FE34FE4D-FE4FFF3F",
Po: "0021-00230025-0027002A002C002E002F003A003B003F0040005C00A100B700BF037E0387055A-055F058905C005C305C605F305F40609060A060C060D061B061E061F066A-066D06D40700-070D07F7-07F90830-083E0964096509700DF40E4F0E5A0E5B0F04-0F120F850FD0-0FD4104A-104F10FB1361-1368166D166E16EB-16ED1735173617D4-17D617D8-17DA1800-18051807-180A1944194519DE19DF1A1E1A1F1AA0-1AA61AA8-1AAD1B5A-1B601C3B-1C3F1C7E1C7F1CD3201620172020-20272030-2038203B-203E2041-20432047-205120532055-205E2CF9-2CFC2CFE2CFF2E002E012E06-2E082E0B2E0E-2E162E182E192E1B2E1E2E1F2E2A-2E2E2E302E313001-3003303D30FBA4FEA4FFA60D-A60FA673A67EA6F2-A6F7A874-A877A8CEA8CFA8F8-A8FAA92EA92FA95FA9C1-A9CDA9DEA9DFAA5C-AA5FAADEAADFABEBFE10-FE16FE19FE30FE45FE46FE49-FE4CFE50-FE52FE54-FE57FE5F-FE61FE68FE6AFE6BFF01-FF03FF05-FF07FF0AFF0CFF0EFF0FFF1AFF1BFF1FFF20FF3CFF61FF64FF65",
S: "0024002B003C-003E005E0060007C007E00A2-00A900AC00AE-00B100B400B600B800D700F702C2-02C502D2-02DF02E5-02EB02ED02EF-02FF03750384038503F604820606-0608060B060E060F06E906FD06FE07F609F209F309FA09FB0AF10B700BF3-0BFA0C7F0CF10CF20D790E3F0F01-0F030F13-0F170F1A-0F1F0F340F360F380FBE-0FC50FC7-0FCC0FCE0FCF0FD5-0FD8109E109F13601390-139917DB194019E0-19FF1B61-1B6A1B74-1B7C1FBD1FBF-1FC11FCD-1FCF1FDD-1FDF1FED-1FEF1FFD1FFE20442052207A-207C208A-208C20A0-20B8210021012103-21062108210921142116-2118211E-2123212521272129212E213A213B2140-2144214A-214D214F2190-2328232B-23E82400-24262440-244A249C-24E92500-26CD26CF-26E126E326E8-26FF2701-27042706-2709270C-27272729-274B274D274F-27522756-275E2761-276727942798-27AF27B1-27BE27C0-27C427C7-27CA27CC27D0-27E527F0-29822999-29D729DC-29FB29FE-2B4C2B50-2B592CE5-2CEA2E80-2E992E9B-2EF32F00-2FD52FF0-2FFB300430123013302030363037303E303F309B309C319031913196-319F31C0-31E33200-321E322A-32503260-327F328A-32B032C0-32FE3300-33FF4DC0-4DFFA490-A4C6A700-A716A720A721A789A78AA828-A82BA836-A839AA77-AA79FB29FDFCFDFDFE62FE64-FE66FE69FF04FF0BFF1C-FF1EFF3EFF40FF5CFF5EFFE0-FFE6FFE8-FFEEFFFCFFFD",
Sm: "002B003C-003E007C007E00AC00B100D700F703F60606-060820442052207A-207C208A-208C2140-2144214B2190-2194219A219B21A021A321A621AE21CE21CF21D221D421F4-22FF2308-230B23202321237C239B-23B323DC-23E125B725C125F8-25FF266F27C0-27C427C7-27CA27CC27D0-27E527F0-27FF2900-29822999-29D729DC-29FB29FE-2AFF2B30-2B442B47-2B4CFB29FE62FE64-FE66FF0BFF1C-FF1EFF5CFF5EFFE2FFE9-FFEC",
Sc: "002400A2-00A5060B09F209F309FB0AF10BF90E3F17DB20A0-20B8A838FDFCFE69FF04FFE0FFE1FFE5FFE6",
Sk: "005E006000A800AF00B400B802C2-02C502D2-02DF02E5-02EB02ED02EF-02FF0375038403851FBD1FBF-1FC11FCD-1FCF1FDD-1FDF1FED-1FEF1FFD1FFE309B309CA700-A716A720A721A789A78AFF3EFF40FFE3",
So: "00A600A700A900AE00B000B60482060E060F06E906FD06FE07F609FA0B700BF3-0BF80BFA0C7F0CF10CF20D790F01-0F030F13-0F170F1A-0F1F0F340F360F380FBE-0FC50FC7-0FCC0FCE0FCF0FD5-0FD8109E109F13601390-1399194019E0-19FF1B61-1B6A1B74-1B7C210021012103-21062108210921142116-2118211E-2123212521272129212E213A213B214A214C214D214F2195-2199219C-219F21A121A221A421A521A7-21AD21AF-21CD21D021D121D321D5-21F32300-2307230C-231F2322-2328232B-237B237D-239A23B4-23DB23E2-23E82400-24262440-244A249C-24E92500-25B625B8-25C025C2-25F72600-266E2670-26CD26CF-26E126E326E8-26FF2701-27042706-2709270C-27272729-274B274D274F-27522756-275E2761-276727942798-27AF27B1-27BE2800-28FF2B00-2B2F2B452B462B50-2B592CE5-2CEA2E80-2E992E9B-2EF32F00-2FD52FF0-2FFB300430123013302030363037303E303F319031913196-319F31C0-31E33200-321E322A-32503260-327F328A-32B032C0-32FE3300-33FF4DC0-4DFFA490-A4C6A828-A82BA836A837A839AA77-AA79FDFDFFE4FFE8FFEDFFEEFFFCFFFD",
Z: "002000A01680180E2000-200A20282029202F205F3000",
Zs: "002000A01680180E2000-200A202F205F3000",
Zl: "2028",
Zp: "2029",
C: "0000-001F007F-009F00AD03780379037F-0383038B038D03A20526-05300557055805600588058B-059005C8-05CF05EB-05EF05F5-0605061C061D0620065F06DD070E070F074B074C07B2-07BF07FB-07FF082E082F083F-08FF093A093B094F095609570973-097809800984098D098E0991099209A909B109B3-09B509BA09BB09C509C609C909CA09CF-09D609D8-09DB09DE09E409E509FC-0A000A040A0B-0A0E0A110A120A290A310A340A370A3A0A3B0A3D0A43-0A460A490A4A0A4E-0A500A52-0A580A5D0A5F-0A650A76-0A800A840A8E0A920AA90AB10AB40ABA0ABB0AC60ACA0ACE0ACF0AD1-0ADF0AE40AE50AF00AF2-0B000B040B0D0B0E0B110B120B290B310B340B3A0B3B0B450B460B490B4A0B4E-0B550B58-0B5B0B5E0B640B650B72-0B810B840B8B-0B8D0B910B96-0B980B9B0B9D0BA0-0BA20BA5-0BA70BAB-0BAD0BBA-0BBD0BC3-0BC50BC90BCE0BCF0BD1-0BD60BD8-0BE50BFB-0C000C040C0D0C110C290C340C3A-0C3C0C450C490C4E-0C540C570C5A-0C5F0C640C650C70-0C770C800C810C840C8D0C910CA90CB40CBA0CBB0CC50CC90CCE-0CD40CD7-0CDD0CDF0CE40CE50CF00CF3-0D010D040D0D0D110D290D3A-0D3C0D450D490D4E-0D560D58-0D5F0D640D650D76-0D780D800D810D840D97-0D990DB20DBC0DBE0DBF0DC7-0DC90DCB-0DCE0DD50DD70DE0-0DF10DF5-0E000E3B-0E3E0E5C-0E800E830E850E860E890E8B0E8C0E8E-0E930E980EA00EA40EA60EA80EA90EAC0EBA0EBE0EBF0EC50EC70ECE0ECF0EDA0EDB0EDE-0EFF0F480F6D-0F700F8C-0F8F0F980FBD0FCD0FD9-0FFF10C6-10CF10FD-10FF1249124E124F12571259125E125F1289128E128F12B112B612B712BF12C112C612C712D7131113161317135B-135E137D-137F139A-139F13F5-13FF169D-169F16F1-16FF170D1715-171F1737-173F1754-175F176D17711774-177F17B417B517DE17DF17EA-17EF17FA-17FF180F181A-181F1878-187F18AB-18AF18F6-18FF191D-191F192C-192F193C-193F1941-1943196E196F1975-197F19AC-19AF19CA-19CF19DB-19DD1A1C1A1D1A5F1A7D1A7E1A8A-1A8F1A9A-1A9F1AAE-1AFF1B4C-1B4F1B7D-1B7F1BAB-1BAD1BBA-1BFF1C38-1C3A1C4A-1C4C1C80-1CCF1CF3-1CFF1DE7-1DFC1F161F171F1E1F1F1F461F471F4E1F4F1F581F5A1F5C1F5E1F7E1F7F1FB51FC51FD41FD51FDC1FF01FF11FF51FFF200B-200F202A-202E2060-206F20722073208F2095-209F20B9-20CF20F1-20FF218A-218F23E9-23FF2427-243F244B-245F26CE26E226E4-26E727002705270A270B2728274C274E2753-2755275F27602795-279727B027BF27CB27CD-27CF2B4D-2B4F2B5A-2BFF2C2F2C5F2CF2-2CF82D26-2D2F2D66-2D6E2D70-2D7F2D97-2D9F2DA72DAF2DB72DBF2DC72DCF2DD72DDF2E32-2E7F2E9A2EF4-2EFF2FD6-2FEF2FFC-2FFF3040309730983100-3104312E-3130318F31B8-31BF31E4-31EF321F32FF4DB6-4DBF9FCC-9FFFA48D-A48FA4C7-A4CFA62C-A63FA660A661A674-A67BA698-A69FA6F8-A6FFA78D-A7FAA82C-A82FA83A-A83FA878-A87FA8C5-A8CDA8DA-A8DFA8FC-A8FFA954-A95EA97D-A97FA9CEA9DA-A9DDA9E0-A9FFAA37-AA3FAA4EAA4FAA5AAA5BAA7C-AA7FAAC3-AADAAAE0-ABBFABEEABEFABFA-ABFFD7A4-D7AFD7C7-D7CAD7FC-F8FFFA2EFA2FFA6EFA6FFADA-FAFFFB07-FB12FB18-FB1CFB37FB3DFB3FFB42FB45FBB2-FBD2FD40-FD4FFD90FD91FDC8-FDEFFDFEFDFFFE1A-FE1FFE27-FE2FFE53FE67FE6C-FE6FFE75FEFD-FF00FFBF-FFC1FFC8FFC9FFD0FFD1FFD8FFD9FFDD-FFDFFFE7FFEF-FFFBFFFEFFFF",
Cc: "0000-001F007F-009F",
Cf: "00AD0600-060306DD070F17B417B5200B-200F202A-202E2060-2064206A-206FFEFFFFF9-FFFB",
Co: "E000-F8FF",
Cs: "D800-DFFF",
Cn: "03780379037F-0383038B038D03A20526-05300557055805600588058B-059005C8-05CF05EB-05EF05F5-05FF06040605061C061D0620065F070E074B074C07B2-07BF07FB-07FF082E082F083F-08FF093A093B094F095609570973-097809800984098D098E0991099209A909B109B3-09B509BA09BB09C509C609C909CA09CF-09D609D8-09DB09DE09E409E509FC-0A000A040A0B-0A0E0A110A120A290A310A340A370A3A0A3B0A3D0A43-0A460A490A4A0A4E-0A500A52-0A580A5D0A5F-0A650A76-0A800A840A8E0A920AA90AB10AB40ABA0ABB0AC60ACA0ACE0ACF0AD1-0ADF0AE40AE50AF00AF2-0B000B040B0D0B0E0B110B120B290B310B340B3A0B3B0B450B460B490B4A0B4E-0B550B58-0B5B0B5E0B640B650B72-0B810B840B8B-0B8D0B910B96-0B980B9B0B9D0BA0-0BA20BA5-0BA70BAB-0BAD0BBA-0BBD0BC3-0BC50BC90BCE0BCF0BD1-0BD60BD8-0BE50BFB-0C000C040C0D0C110C290C340C3A-0C3C0C450C490C4E-0C540C570C5A-0C5F0C640C650C70-0C770C800C810C840C8D0C910CA90CB40CBA0CBB0CC50CC90CCE-0CD40CD7-0CDD0CDF0CE40CE50CF00CF3-0D010D040D0D0D110D290D3A-0D3C0D450D490D4E-0D560D58-0D5F0D640D650D76-0D780D800D810D840D97-0D990DB20DBC0DBE0DBF0DC7-0DC90DCB-0DCE0DD50DD70DE0-0DF10DF5-0E000E3B-0E3E0E5C-0E800E830E850E860E890E8B0E8C0E8E-0E930E980EA00EA40EA60EA80EA90EAC0EBA0EBE0EBF0EC50EC70ECE0ECF0EDA0EDB0EDE-0EFF0F480F6D-0F700F8C-0F8F0F980FBD0FCD0FD9-0FFF10C6-10CF10FD-10FF1249124E124F12571259125E125F1289128E128F12B112B612B712BF12C112C612C712D7131113161317135B-135E137D-137F139A-139F13F5-13FF169D-169F16F1-16FF170D1715-171F1737-173F1754-175F176D17711774-177F17DE17DF17EA-17EF17FA-17FF180F181A-181F1878-187F18AB-18AF18F6-18FF191D-191F192C-192F193C-193F1941-1943196E196F1975-197F19AC-19AF19CA-19CF19DB-19DD1A1C1A1D1A5F1A7D1A7E1A8A-1A8F1A9A-1A9F1AAE-1AFF1B4C-1B4F1B7D-1B7F1BAB-1BAD1BBA-1BFF1C38-1C3A1C4A-1C4C1C80-1CCF1CF3-1CFF1DE7-1DFC1F161F171F1E1F1F1F461F471F4E1F4F1F581F5A1F5C1F5E1F7E1F7F1FB51FC51FD41FD51FDC1FF01FF11FF51FFF2065-206920722073208F2095-209F20B9-20CF20F1-20FF218A-218F23E9-23FF2427-243F244B-245F26CE26E226E4-26E727002705270A270B2728274C274E2753-2755275F27602795-279727B027BF27CB27CD-27CF2B4D-2B4F2B5A-2BFF2C2F2C5F2CF2-2CF82D26-2D2F2D66-2D6E2D70-2D7F2D97-2D9F2DA72DAF2DB72DBF2DC72DCF2DD72DDF2E32-2E7F2E9A2EF4-2EFF2FD6-2FEF2FFC-2FFF3040309730983100-3104312E-3130318F31B8-31BF31E4-31EF321F32FF4DB6-4DBF9FCC-9FFFA48D-A48FA4C7-A4CFA62C-A63FA660A661A674-A67BA698-A69FA6F8-A6FFA78D-A7FAA82C-A82FA83A-A83FA878-A87FA8C5-A8CDA8DA-A8DFA8FC-A8FFA954-A95EA97D-A97FA9CEA9DA-A9DDA9E0-A9FFAA37-AA3FAA4EAA4FAA5AAA5BAA7C-AA7FAAC3-AADAAAE0-ABBFABEEABEFABFA-ABFFD7A4-D7AFD7C7-D7CAD7FC-D7FFFA2EFA2FFA6EFA6FFADA-FAFFFB07-FB12FB18-FB1CFB37FB3DFB3FFB42FB45FBB2-FBD2FD40-FD4FFD90FD91FDC8-FDEFFDFEFDFFFE1A-FE1FFE27-FE2FFE53FE67FE6C-FE6FFE75FEFDFEFEFF00FFBF-FFC1FFC8FFC9FFD0FFD1FFD8FFD9FFDD-FFDFFFE7FFEF-FFF8FFFEFFFF"
});
function addUnicodePackage (pack) {
var codePoint = /\w{4}/g;
for (var name in pack)
exports.packages[name] = pack[name].replace(codePoint, "\\u$&");
}
});
ace.define("ace/mode/text",["require","exports","module","ace/tokenizer","ace/mode/text_highlight_rules","ace/mode/behaviour/cstyle","ace/unicode","ace/lib/lang","ace/token_iterator","ace/range"], function(acequire, exports, module) {
"use strict";
var Tokenizer = acequire("../tokenizer").Tokenizer;
var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;
var CstyleBehaviour = acequire("./behaviour/cstyle").CstyleBehaviour;
var unicode = acequire("../unicode");
var lang = acequire("../lib/lang");
var TokenIterator = acequire("../token_iterator").TokenIterator;
var Range = acequire("../range").Range;
var Mode = function() {
this.HighlightRules = TextHighlightRules;
};
(function() {
this.$defaultBehaviour = new CstyleBehaviour();
this.tokenRe = new RegExp("^["
+ unicode.packages.L
+ unicode.packages.Mn + unicode.packages.Mc
+ unicode.packages.Nd
+ unicode.packages.Pc + "\\$_]+", "g"
);
this.nonTokenRe = new RegExp("^(?:[^"
+ unicode.packages.L
+ unicode.packages.Mn + unicode.packages.Mc
+ unicode.packages.Nd
+ unicode.packages.Pc + "\\$_]|\\s])+", "g"
);
this.getTokenizer = function() {
if (!this.$tokenizer) {
this.$highlightRules = this.$highlightRules || new this.HighlightRules(this.$highlightRuleConfig);
this.$tokenizer = new Tokenizer(this.$highlightRules.getRules());
}
return this.$tokenizer;
};
this.lineCommentStart = "";
this.blockComment = "";
this.toggleCommentLines = function(state, session, startRow, endRow) {
var doc = session.doc;
var ignoreBlankLines = true;
var shouldRemove = true;
var minIndent = Infinity;
var tabSize = session.getTabSize();
var insertAtTabStop = false;
if (!this.lineCommentStart) {
if (!this.blockComment)
return false;
var lineCommentStart = this.blockComment.start;
var lineCommentEnd = this.blockComment.end;
var regexpStart = new RegExp("^(\\s*)(?:" + lang.escapeRegExp(lineCommentStart) + ")");
var regexpEnd = new RegExp("(?:" + lang.escapeRegExp(lineCommentEnd) + ")\\s*$");
var comment = function(line, i) {
if (testRemove(line, i))
return;
if (!ignoreBlankLines || /\S/.test(line)) {
doc.insertInLine({row: i, column: line.length}, lineCommentEnd);
doc.insertInLine({row: i, column: minIndent}, lineCommentStart);
}
};
var uncomment = function(line, i) {
var m;
if (m = line.match(regexpEnd))
doc.removeInLine(i, line.length - m[0].length, line.length);
if (m = line.match(regexpStart))
doc.removeInLine(i, m[1].length, m[0].length);
};
var testRemove = function(line, row) {
if (regexpStart.test(line))
return true;
var tokens = session.getTokens(row);
for (var i = 0; i < tokens.length; i++) {
if (tokens[i].type === "comment")
return true;
}
};
} else {
if (Array.isArray(this.lineCommentStart)) {
var regexpStart = this.lineCommentStart.map(lang.escapeRegExp).join("|");
var lineCommentStart = this.lineCommentStart[0];
} else {
var regexpStart = lang.escapeRegExp(this.lineCommentStart);
var lineCommentStart = this.lineCommentStart;
}
regexpStart = new RegExp("^(\\s*)(?:" + regexpStart + ") ?");
insertAtTabStop = session.getUseSoftTabs();
var uncomment = function(line, i) {
var m = line.match(regexpStart);
if (!m) return;
var start = m[1].length, end = m[0].length;
if (!shouldInsertSpace(line, start, end) && m[0][end - 1] == " ")
end--;
doc.removeInLine(i, start, end);
};
var commentWithSpace = lineCommentStart + " ";
var comment = function(line, i) {
if (!ignoreBlankLines || /\S/.test(line)) {
if (shouldInsertSpace(line, minIndent, minIndent))
doc.insertInLine({row: i, column: minIndent}, commentWithSpace);
else
doc.insertInLine({row: i, column: minIndent}, lineCommentStart);
}
};
var testRemove = function(line, i) {
return regexpStart.test(line);
};
var shouldInsertSpace = function(line, before, after) {
var spaces = 0;
while (before-- && line.charAt(before) == " ")
spaces++;
if (spaces % tabSize != 0)
return false;
var spaces = 0;
while (line.charAt(after++) == " ")
spaces++;
if (tabSize > 2)
return spaces % tabSize != tabSize - 1;
else
return spaces % tabSize == 0;
return true;
};
}
function iter(fun) {
for (var i = startRow; i <= endRow; i++)
fun(doc.getLine(i), i);
}
var minEmptyLength = Infinity;
iter(function(line, i) {
var indent = line.search(/\S/);
if (indent !== -1) {
if (indent < minIndent)
minIndent = indent;
if (shouldRemove && !testRemove(line, i))
shouldRemove = false;
} else if (minEmptyLength > line.length) {
minEmptyLength = line.length;
}
});
if (minIndent == Infinity) {
minIndent = minEmptyLength;
ignoreBlankLines = false;
shouldRemove = false;
}
if (insertAtTabStop && minIndent % tabSize != 0)
minIndent = Math.floor(minIndent / tabSize) * tabSize;
iter(shouldRemove ? uncomment : comment);
};
this.toggleBlockComment = function(state, session, range, cursor) {
var comment = this.blockComment;
if (!comment)
return;
if (!comment.start && comment[0])
comment = comment[0];
var iterator = new TokenIterator(session, cursor.row, cursor.column);
var token = iterator.getCurrentToken();
var sel = session.selection;
var initialRange = session.selection.toOrientedRange();
var startRow, colDiff;
if (token && /comment/.test(token.type)) {
var startRange, endRange;
while (token && /comment/.test(token.type)) {
var i = token.value.indexOf(comment.start);
if (i != -1) {
var row = iterator.getCurrentTokenRow();
var column = iterator.getCurrentTokenColumn() + i;
startRange = new Range(row, column, row, column + comment.start.length);
break;
}
token = iterator.stepBackward();
}
var iterator = new TokenIterator(session, cursor.row, cursor.column);
var token = iterator.getCurrentToken();
while (token && /comment/.test(token.type)) {
var i = token.value.indexOf(comment.end);
if (i != -1) {
var row = iterator.getCurrentTokenRow();
var column = iterator.getCurrentTokenColumn() + i;
endRange = new Range(row, column, row, column + comment.end.length);
break;
}
token = iterator.stepForward();
}
if (endRange)
session.remove(endRange);
if (startRange) {
session.remove(startRange);
startRow = startRange.start.row;
colDiff = -comment.start.length;
}
} else {
colDiff = comment.start.length;
startRow = range.start.row;
session.insert(range.end, comment.end);
session.insert(range.start, comment.start);
}
if (initialRange.start.row == startRow)
initialRange.start.column += colDiff;
if (initialRange.end.row == startRow)
initialRange.end.column += colDiff;
session.selection.fromOrientedRange(initialRange);
};
this.getNextLineIndent = function(state, line, tab) {
return this.$getIndent(line);
};
this.checkOutdent = function(state, line, input) {
return false;
};
this.autoOutdent = function(state, doc, row) {
};
this.$getIndent = function(line) {
return line.match(/^\s*/)[0];
};
this.createWorker = function(session) {
return null;
};
this.createModeDelegates = function (mapping) {
this.$embeds = [];
this.$modes = {};
for (var i in mapping) {
if (mapping[i]) {
this.$embeds.push(i);
this.$modes[i] = new mapping[i]();
}
}
var delegations = ["toggleBlockComment", "toggleCommentLines", "getNextLineIndent",
"checkOutdent", "autoOutdent", "transformAction", "getCompletions"];
for (var i = 0; i < delegations.length; i++) {
(function(scope) {
var functionName = delegations[i];
var defaultHandler = scope[functionName];
scope[delegations[i]] = function() {
return this.$delegator(functionName, arguments, defaultHandler);
};
}(this));
}
};
this.$delegator = function(method, args, defaultHandler) {
var state = args[0];
if (typeof state != "string")
state = state[0];
for (var i = 0; i < this.$embeds.length; i++) {
if (!this.$modes[this.$embeds[i]]) continue;
var split = state.split(this.$embeds[i]);
if (!split[0] && split[1]) {
args[0] = split[1];
var mode = this.$modes[this.$embeds[i]];
return mode[method].apply(mode, args);
}
}
var ret = defaultHandler.apply(this, args);
return defaultHandler ? ret : undefined;
};
this.transformAction = function(state, action, editor, session, param) {
if (this.$behaviour) {
var behaviours = this.$behaviour.getBehaviours();
for (var key in behaviours) {
if (behaviours[key][action]) {
var ret = behaviours[key][action].apply(this, arguments);
if (ret) {
return ret;
}
}
}
}
};
this.getKeywords = function(append) {
if (!this.completionKeywords) {
var rules = this.$tokenizer.rules;
var completionKeywords = [];
for (var rule in rules) {
var ruleItr = rules[rule];
for (var r = 0, l = ruleItr.length; r < l; r++) {
if (typeof ruleItr[r].token === "string") {
if (/keyword|support|storage/.test(ruleItr[r].token))
completionKeywords.push(ruleItr[r].regex);
}
else if (typeof ruleItr[r].token === "object") {
for (var a = 0, aLength = ruleItr[r].token.length; a < aLength; a++) {
if (/keyword|support|storage/.test(ruleItr[r].token[a])) {
var rule = ruleItr[r].regex.match(/\(.+?\)/g)[a];
completionKeywords.push(rule.substr(1, rule.length - 2));
}
}
}
}
}
this.completionKeywords = completionKeywords;
}
if (!append)
return this.$keywordList;
return completionKeywords.concat(this.$keywordList || []);
};
this.$createKeywordList = function() {
if (!this.$highlightRules)
this.getTokenizer();
return this.$keywordList = this.$highlightRules.$keywordList || [];
};
this.getCompletions = function(state, session, pos, prefix) {
var keywords = this.$keywordList || this.$createKeywordList();
return keywords.map(function(word) {
return {
name: word,
value: word,
score: 0,
meta: "keyword"
};
});
};
this.$id = "ace/mode/text";
}).call(Mode.prototype);
exports.Mode = Mode;
});
ace.define("ace/apply_delta",["require","exports","module"], function(acequire, exports, module) {
"use strict";
function throwDeltaError(delta, errorText){
console.log("Invalid Delta:", delta);
throw "Invalid Delta: " + errorText;
}
function positionInDocument(docLines, position) {
return position.row >= 0 && position.row < docLines.length &&
position.column >= 0 && position.column <= docLines[position.row].length;
}
function validateDelta(docLines, delta) {
if (delta.action != "insert" && delta.action != "remove")
throwDeltaError(delta, "delta.action must be 'insert' or 'remove'");
if (!(delta.lines instanceof Array))
throwDeltaError(delta, "delta.lines must be an Array");
if (!delta.start || !delta.end)
throwDeltaError(delta, "delta.start/end must be an present");
var start = delta.start;
if (!positionInDocument(docLines, delta.start))
throwDeltaError(delta, "delta.start must be contained in document");
var end = delta.end;
if (delta.action == "remove" && !positionInDocument(docLines, end))
throwDeltaError(delta, "delta.end must contained in document for 'remove' actions");
var numRangeRows = end.row - start.row;
var numRangeLastLineChars = (end.column - (numRangeRows == 0 ? start.column : 0));
if (numRangeRows != delta.lines.length - 1 || delta.lines[numRangeRows].length != numRangeLastLineChars)
throwDeltaError(delta, "delta.range must match delta lines");
}
exports.applyDelta = function(docLines, delta, doNotValidate) {
var row = delta.start.row;
var startColumn = delta.start.column;
var line = docLines[row] || "";
switch (delta.action) {
case "insert":
var lines = delta.lines;
if (lines.length === 1) {
docLines[row] = line.substring(0, startColumn) + delta.lines[0] + line.substring(startColumn);
} else {
var args = [row, 1].concat(delta.lines);
docLines.splice.apply(docLines, args);
docLines[row] = line.substring(0, startColumn) + docLines[row];
docLines[row + delta.lines.length - 1] += line.substring(startColumn);
}
break;
case "remove":
var endColumn = delta.end.column;
var endRow = delta.end.row;
if (row === endRow) {
docLines[row] = line.substring(0, startColumn) + line.substring(endColumn);
} else {
docLines.splice(
row, endRow - row + 1,
line.substring(0, startColumn) + docLines[endRow].substring(endColumn)
);
}
break;
}
}
});
ace.define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"], function(acequire, exports, module) {
"use strict";
var oop = acequire("./lib/oop");
var EventEmitter = acequire("./lib/event_emitter").EventEmitter;
var Anchor = exports.Anchor = function(doc, row, column) {
this.$onChange = this.onChange.bind(this);
this.attach(doc);
if (typeof column == "undefined")
this.setPosition(row.row, row.column);
else
this.setPosition(row, column);
};
(function() {
oop.implement(this, EventEmitter);
this.getPosition = function() {
return this.$clipPositionToDocument(this.row, this.column);
};
this.getDocument = function() {
return this.document;
};
this.$insertRight = false;
this.onChange = function(delta) {
if (delta.start.row == delta.end.row && delta.start.row != this.row)
return;
if (delta.start.row > this.row)
return;
var point = $getTransformedPoint(delta, {row: this.row, column: this.column}, this.$insertRight);
this.setPosition(point.row, point.column, true);
};
function $pointsInOrder(point1, point2, equalPointsInOrder) {
var bColIsAfter = equalPointsInOrder ? point1.column <= point2.column : point1.column < point2.column;
return (point1.row < point2.row) || (point1.row == point2.row && bColIsAfter);
}
function $getTransformedPoint(delta, point, moveIfEqual) {
var deltaIsInsert = delta.action == "insert";
var deltaRowShift = (deltaIsInsert ? 1 : -1) * (delta.end.row - delta.start.row);
var deltaColShift = (deltaIsInsert ? 1 : -1) * (delta.end.column - delta.start.column);
var deltaStart = delta.start;
var deltaEnd = deltaIsInsert ? deltaStart : delta.end; // Collapse insert range.
if ($pointsInOrder(point, deltaStart, moveIfEqual)) {
return {
row: point.row,
column: point.column
};
}
if ($pointsInOrder(deltaEnd, point, !moveIfEqual)) {
return {
row: point.row + deltaRowShift,
column: point.column + (point.row == deltaEnd.row ? deltaColShift : 0)
};
}
return {
row: deltaStart.row,
column: deltaStart.column
};
}
this.setPosition = function(row, column, noClip) {
var pos;
if (noClip) {
pos = {
row: row,
column: column
};
} else {
pos = this.$clipPositionToDocument(row, column);
}
if (this.row == pos.row && this.column == pos.column)
return;
var old = {
row: this.row,
column: this.column
};
this.row = pos.row;
this.column = pos.column;
this._signal("change", {
old: old,
value: pos
});
};
this.detach = function() {
this.document.removeEventListener("change", this.$onChange);
};
this.attach = function(doc) {
this.document = doc || this.document;
this.document.on("change", this.$onChange);
};
this.$clipPositionToDocument = function(row, column) {
var pos = {};
if (row >= this.document.getLength()) {
pos.row = Math.max(0, this.document.getLength() - 1);
pos.column = this.document.getLine(pos.row).length;
}
else if (row < 0) {
pos.row = 0;
pos.column = 0;
}
else {
pos.row = row;
pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column));
}
if (column < 0)
pos.column = 0;
return pos;
};
}).call(Anchor.prototype);
});
ace.define("ace/document",["require","exports","module","ace/lib/oop","ace/apply_delta","ace/lib/event_emitter","ace/range","ace/anchor"], function(acequire, exports, module) {
"use strict";
var oop = acequire("./lib/oop");
var applyDelta = acequire("./apply_delta").applyDelta;
var EventEmitter = acequire("./lib/event_emitter").EventEmitter;
var Range = acequire("./range").Range;
var Anchor = acequire("./anchor").Anchor;
var Document = function(textOrLines) {
this.$lines = [""];
if (textOrLines.length === 0) {
this.$lines = [""];
} else if (Array.isArray(textOrLines)) {
this.insertMergedLines({row: 0, column: 0}, textOrLines);
} else {
this.insert({row: 0, column:0}, textOrLines);
}
};
(function() {
oop.implement(this, EventEmitter);
this.setValue = function(text) {
var len = this.getLength() - 1;
this.remove(new Range(0, 0, len, this.getLine(len).length));
this.insert({row: 0, column: 0}, text);
};
this.getValue = function() {
return this.getAllLines().join(this.getNewLineCharacter());
};
this.createAnchor = function(row, column) {
return new Anchor(this, row, column);
};
if ("aaa".split(/a/).length === 0) {
this.$split = function(text) {
return text.replace(/\r\n|\r/g, "\n").split("\n");
};
} else {
this.$split = function(text) {
return text.split(/\r\n|\r|\n/);
};
}
this.$detectNewLine = function(text) {
var match = text.match(/^.*?(\r\n|\r|\n)/m);
this.$autoNewLine = match ? match[1] : "\n";
this._signal("changeNewLineMode");
};
this.getNewLineCharacter = function() {
switch (this.$newLineMode) {
case "windows":
return "\r\n";
case "unix":
return "\n";
default:
return this.$autoNewLine || "\n";
}
};
this.$autoNewLine = "";
this.$newLineMode = "auto";
this.setNewLineMode = function(newLineMode) {
if (this.$newLineMode === newLineMode)
return;
this.$newLineMode = newLineMode;
this._signal("changeNewLineMode");
};
this.getNewLineMode = function() {
return this.$newLineMode;
};
this.isNewLine = function(text) {
return (text == "\r\n" || text == "\r" || text == "\n");
};
this.getLine = function(row) {
return this.$lines[row] || "";
};
this.getLines = function(firstRow, lastRow) {
return this.$lines.slice(firstRow, lastRow + 1);
};
this.getAllLines = function() {
return this.getLines(0, this.getLength());
};
this.getLength = function() {
return this.$lines.length;
};
this.getTextRange = function(range) {
return this.getLinesForRange(range).join(this.getNewLineCharacter());
};
this.getLinesForRange = function(range) {
var lines;
if (range.start.row === range.end.row) {
lines = [this.getLine(range.start.row).substring(range.start.column, range.end.column)];
} else {
lines = this.getLines(range.start.row, range.end.row);
lines[0] = (lines[0] || "").substring(range.start.column);
var l = lines.length - 1;
if (range.end.row - range.start.row == l)
lines[l] = lines[l].substring(0, range.end.column);
}
return lines;
};
this.insertLines = function(row, lines) {
console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead.");
return this.insertFullLines(row, lines);
};
this.removeLines = function(firstRow, lastRow) {
console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead.");
return this.removeFullLines(firstRow, lastRow);
};
this.insertNewLine = function(position) {
console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead.");
return this.insertMergedLines(position, ["", ""]);
};
this.insert = function(position, text) {
if (this.getLength() <= 1)
this.$detectNewLine(text);
return this.insertMergedLines(position, this.$split(text));
};
this.insertInLine = function(position, text) {
var start = this.clippedPos(position.row, position.column);
var end = this.pos(position.row, position.column + text.length);
this.applyDelta({
start: start,
end: end,
action: "insert",
lines: [text]
}, true);
return this.clonePos(end);
};
this.clippedPos = function(row, column) {
var length = this.getLength();
if (row === undefined) {
row = length;
} else if (row < 0) {
row = 0;
} else if (row >= length) {
row = length - 1;
column = undefined;
}
var line = this.getLine(row);
if (column == undefined)
column = line.length;
column = Math.min(Math.max(column, 0), line.length);
return {row: row, column: column};
};
this.clonePos = function(pos) {
return {row: pos.row, column: pos.column};
};
this.pos = function(row, column) {
return {row: row, column: column};
};
this.$clipPosition = function(position) {
var length = this.getLength();
if (position.row >= length) {
position.row = Math.max(0, length - 1);
position.column = this.getLine(length - 1).length;
} else {
position.row = Math.max(0, position.row);
position.column = Math.min(Math.max(position.column, 0), this.getLine(position.row).length);
}
return position;
};
this.insertFullLines = function(row, lines) {
row = Math.min(Math.max(row, 0), this.getLength());
var column = 0;
if (row < this.getLength()) {
lines = lines.concat([""]);
column = 0;
} else {
lines = [""].concat(lines);
row--;
column = this.$lines[row].length;
}
this.insertMergedLines({row: row, column: column}, lines);
};
this.insertMergedLines = function(position, lines) {
var start = this.clippedPos(position.row, position.column);
var end = {
row: start.row + lines.length - 1,
column: (lines.length == 1 ? start.column : 0) + lines[lines.length - 1].length
};
this.applyDelta({
start: start,
end: end,
action: "insert",
lines: lines
});
return this.clonePos(end);
};
this.remove = function(range) {
var start = this.clippedPos(range.start.row, range.start.column);
var end = this.clippedPos(range.end.row, range.end.column);
this.applyDelta({
start: start,
end: end,
action: "remove",
lines: this.getLinesForRange({start: start, end: end})
});
return this.clonePos(start);
};
this.removeInLine = function(row, startColumn, endColumn) {
var start = this.clippedPos(row, startColumn);
var end = this.clippedPos(row, endColumn);
this.applyDelta({
start: start,
end: end,
action: "remove",
lines: this.getLinesForRange({start: start, end: end})
}, true);
return this.clonePos(start);
};
this.removeFullLines = function(firstRow, lastRow) {
firstRow = Math.min(Math.max(0, firstRow), this.getLength() - 1);
lastRow = Math.min(Math.max(0, lastRow ), this.getLength() - 1);
var deleteFirstNewLine = lastRow == this.getLength() - 1 && firstRow > 0;
var deleteLastNewLine = lastRow < this.getLength() - 1;
var startRow = ( deleteFirstNewLine ? firstRow - 1 : firstRow );
var startCol = ( deleteFirstNewLine ? this.getLine(startRow).length : 0 );
var endRow = ( deleteLastNewLine ? lastRow + 1 : lastRow );
var endCol = ( deleteLastNewLine ? 0 : this.getLine(endRow).length );
var range = new Range(startRow, startCol, endRow, endCol);
var deletedLines = this.$lines.slice(firstRow, lastRow + 1);
this.applyDelta({
start: range.start,
end: range.end,
action: "remove",
lines: this.getLinesForRange(range)
});
return deletedLines;
};
this.removeNewLine = function(row) {
if (row < this.getLength() - 1 && row >= 0) {
this.applyDelta({
start: this.pos(row, this.getLine(row).length),
end: this.pos(row + 1, 0),
action: "remove",
lines: ["", ""]
});
}
};
this.replace = function(range, text) {
if (!(range instanceof Range))
range = Range.fromPoints(range.start, range.end);
if (text.length === 0 && range.isEmpty())
return range.start;
if (text == this.getTextRange(range))
return range.end;
this.remove(range);
var end;
if (text) {
end = this.insert(range.start, text);
}
else {
end = range.start;
}
return end;
};
this.applyDeltas = function(deltas) {
for (var i=0; i<deltas.length; i++) {
this.applyDelta(deltas[i]);
}
};
this.revertDeltas = function(deltas) {
for (var i=deltas.length-1; i>=0; i--) {
this.revertDelta(deltas[i]);
}
};
this.applyDelta = function(delta, doNotValidate) {
var isInsert = delta.action == "insert";
if (isInsert ? delta.lines.length <= 1 && !delta.lines[0]
: !Range.comparePoints(delta.start, delta.end)) {
return;
}
if (isInsert && delta.lines.length > 20000)
this.$splitAndapplyLargeDelta(delta, 20000);
applyDelta(this.$lines, delta, doNotValidate);
this._signal("change", delta);
};
this.$splitAndapplyLargeDelta = function(delta, MAX) {
var lines = delta.lines;
var l = lines.length;
var row = delta.start.row;
var column = delta.start.column;
var from = 0, to = 0;
do {
from = to;
to += MAX - 1;
var chunk = lines.slice(from, to);
if (to > l) {
delta.lines = chunk;
delta.start.row = row + from;
delta.start.column = column;
break;
}
chunk.push("");
this.applyDelta({
start: this.pos(row + from, column),
end: this.pos(row + to, column = 0),
action: delta.action,
lines: chunk
}, true);
} while(true);
};
this.revertDelta = function(delta) {
this.applyDelta({
start: this.clonePos(delta.start),
end: this.clonePos(delta.end),
action: (delta.action == "insert" ? "remove" : "insert"),
lines: delta.lines.slice()
});
};
this.indexToPosition = function(index, startRow) {
var lines = this.$lines || this.getAllLines();
var newlineLength = this.getNewLineCharacter().length;
for (var i = startRow || 0, l = lines.length; i < l; i++) {
index -= lines[i].length + newlineLength;
if (index < 0)
return {row: i, column: index + lines[i].length + newlineLength};
}
return {row: l-1, column: lines[l-1].length};
};
this.positionToIndex = function(pos, startRow) {
var lines = this.$lines || this.getAllLines();
var newlineLength = this.getNewLineCharacter().length;
var index = 0;
var row = Math.min(pos.row, lines.length);
for (var i = startRow || 0; i < row; ++i)
index += lines[i].length + newlineLength;
return index + pos.column;
};
}).call(Document.prototype);
exports.Document = Document;
});
ace.define("ace/background_tokenizer",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"], function(acequire, exports, module) {
"use strict";
var oop = acequire("./lib/oop");
var EventEmitter = acequire("./lib/event_emitter").EventEmitter;
var BackgroundTokenizer = function(tokenizer, editor) {
this.running = false;
this.lines = [];
this.states = [];
this.currentLine = 0;
this.tokenizer = tokenizer;
var self = this;
this.$worker = function() {
if (!self.running) { return; }
var workerStart = new Date();
var currentLine = self.currentLine;
var endLine = -1;
var doc = self.doc;
var startLine = currentLine;
while (self.lines[currentLine])
currentLine++;
var len = doc.getLength();
var processedLines = 0;
self.running = false;
while (currentLine < len) {
self.$tokenizeRow(currentLine);
endLine = currentLine;
do {
currentLine++;
} while (self.lines[currentLine]);
processedLines ++;
if ((processedLines % 5 === 0) && (new Date() - workerStart) > 20) {
self.running = setTimeout(self.$worker, 20);
break;
}
}
self.currentLine = currentLine;
if (startLine <= endLine)
self.fireUpdateEvent(startLine, endLine);
};
};
(function(){
oop.implement(this, EventEmitter);
this.setTokenizer = function(tokenizer) {
this.tokenizer = tokenizer;
this.lines = [];
this.states = [];
this.start(0);
};
this.setDocument = function(doc) {
this.doc = doc;
this.lines = [];
this.states = [];
this.stop();
};
this.fireUpdateEvent = function(firstRow, lastRow) {
var data = {
first: firstRow,
last: lastRow
};
this._signal("update", {data: data});
};
this.start = function(startRow) {
this.currentLine = Math.min(startRow || 0, this.currentLine, this.doc.getLength());
this.lines.splice(this.currentLine, this.lines.length);
this.states.splice(this.currentLine, this.states.length);
this.stop();
this.running = setTimeout(this.$worker, 700);
};
this.scheduleStart = function() {
if (!this.running)
this.running = setTimeout(this.$worker, 700);
}
this.$updateOnChange = function(delta) {
var startRow = delta.start.row;
var len = delta.end.row - startRow;
if (len === 0) {
this.lines[startRow] = null;
} else if (delta.action == "remove") {
this.lines.splice(startRow, len + 1, null);
this.states.splice(startRow, len + 1, null);
} else {
var args = Array(len + 1);
args.unshift(startRow, 1);
this.lines.splice.apply(this.lines, args);
this.states.splice.apply(this.states, args);
}
this.currentLine = Math.min(startRow, this.currentLine, this.doc.getLength());
this.stop();
};
this.stop = function() {
if (this.running)
clearTimeout(this.running);
this.running = false;
};
this.getTokens = function(row) {
return this.lines[row] || this.$tokenizeRow(row);
};
this.getState = function(row) {
if (this.currentLine == row)
this.$tokenizeRow(row);
return this.states[row] || "start";
};
this.$tokenizeRow = function(row) {
var line = this.doc.getLine(row);
var state = this.states[row - 1];
var data = this.tokenizer.getLineTokens(line, state, row);
if (this.states[row] + "" !== data.state + "") {
this.states[row] = data.state;
this.lines[row + 1] = null;
if (this.currentLine > row + 1)
this.currentLine = row + 1;
} else if (this.currentLine == row) {
this.currentLine = row + 1;
}
return this.lines[row] = data.tokens;
};
}).call(BackgroundTokenizer.prototype);
exports.BackgroundTokenizer = BackgroundTokenizer;
});
ace.define("ace/search_highlight",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"], function(acequire, exports, module) {
"use strict";
var lang = acequire("./lib/lang");
var oop = acequire("./lib/oop");
var Range = acequire("./range").Range;
var SearchHighlight = function(regExp, clazz, type) {
this.setRegexp(regExp);
this.clazz = clazz;
this.type = type || "text";
};
(function() {
this.MAX_RANGES = 500;
this.setRegexp = function(regExp) {
if (this.regExp+"" == regExp+"")
return;
this.regExp = regExp;
this.cache = [];
};
this.update = function(html, markerLayer, session, config) {
if (!this.regExp)
return;
var start = config.firstRow, end = config.lastRow;
for (var i = start; i <= end; i++) {
var ranges = this.cache[i];
if (ranges == null) {
ranges = lang.getMatchOffsets(session.getLine(i), this.regExp);
if (ranges.length > this.MAX_RANGES)
ranges = ranges.slice(0, this.MAX_RANGES);
ranges = ranges.map(function(match) {
return new Range(i, match.offset, i, match.offset + match.length);
});
this.cache[i] = ranges.length ? ranges : "";
}
for (var j = ranges.length; j --; ) {
markerLayer.drawSingleLineMarker(
html, ranges[j].toScreenRange(session), this.clazz, config);
}
}
};
}).call(SearchHighlight.prototype);
exports.SearchHighlight = SearchHighlight;
});
ace.define("ace/edit_session/fold_line",["require","exports","module","ace/range"], function(acequire, exports, module) {
"use strict";
var Range = acequire("../range").Range;
function FoldLine(foldData, folds) {
this.foldData = foldData;
if (Array.isArray(folds)) {
this.folds = folds;
} else {
folds = this.folds = [ folds ];
}
var last = folds[folds.length - 1];
this.range = new Range(folds[0].start.row, folds[0].start.column,
last.end.row, last.end.column);
this.start = this.range.start;
this.end = this.range.end;
this.folds.forEach(function(fold) {
fold.setFoldLine(this);
}, this);
}
(function() {
this.shiftRow = function(shift) {
this.start.row += shift;
this.end.row += shift;
this.folds.forEach(function(fold) {
fold.start.row += shift;
fold.end.row += shift;
});
};
this.addFold = function(fold) {
if (fold.sameRow) {
if (fold.start.row < this.startRow || fold.endRow > this.endRow) {
throw new Error("Can't add a fold to this FoldLine as it has no connection");
}
this.folds.push(fold);
this.folds.sort(function(a, b) {
return -a.range.compareEnd(b.start.row, b.start.column);
});
if (this.range.compareEnd(fold.start.row, fold.start.column) > 0) {
this.end.row = fold.end.row;
this.end.column = fold.end.column;
} else if (this.range.compareStart(fold.end.row, fold.end.column) < 0) {
this.start.row = fold.start.row;
this.start.column = fold.start.column;
}
} else if (fold.start.row == this.end.row) {
this.folds.push(fold);
this.end.row = fold.end.row;
this.end.column = fold.end.column;
} else if (fold.end.row == this.start.row) {
this.folds.unshift(fold);
this.start.row = fold.start.row;
this.start.column = fold.start.column;
} else {
throw new Error("Trying to add fold to FoldRow that doesn't have a matching row");
}
fold.foldLine = this;
};
this.containsRow = function(row) {
return row >= this.start.row && row <= this.end.row;
};
this.walk = function(callback, endRow, endColumn) {
var lastEnd = 0,
folds = this.folds,
fold,
cmp, stop, isNewRow = true;
if (endRow == null) {
endRow = this.end.row;
endColumn = this.end.column;
}
for (var i = 0; i < folds.length; i++) {
fold = folds[i];
cmp = fold.range.compareStart(endRow, endColumn);
if (cmp == -1) {
callback(null, endRow, endColumn, lastEnd, isNewRow);
return;
}
stop = callback(null, fold.start.row, fold.start.column, lastEnd, isNewRow);
stop = !stop && callback(fold.placeholder, fold.start.row, fold.start.column, lastEnd);
if (stop || cmp === 0) {
return;
}
isNewRow = !fold.sameRow;
lastEnd = fold.end.column;
}
callback(null, endRow, endColumn, lastEnd, isNewRow);
};
this.getNextFoldTo = function(row, column) {
var fold, cmp;
for (var i = 0; i < this.folds.length; i++) {
fold = this.folds[i];
cmp = fold.range.compareEnd(row, column);
if (cmp == -1) {
return {
fold: fold,
kind: "after"
};
} else if (cmp === 0) {
return {
fold: fold,
kind: "inside"
};
}
}
return null;
};
this.addRemoveChars = function(row, column, len) {
var ret = this.getNextFoldTo(row, column),
fold, folds;
if (ret) {
fold = ret.fold;
if (ret.kind == "inside"
&& fold.start.column != column
&& fold.start.row != row)
{
window.console && window.console.log(row, column, fold);
} else if (fold.start.row == row) {
folds = this.folds;
var i = folds.indexOf(fold);
if (i === 0) {
this.start.column += len;
}
for (i; i < folds.length; i++) {
fold = folds[i];
fold.start.column += len;
if (!fold.sameRow) {
return;
}
fold.end.column += len;
}
this.end.column += len;
}
}
};
this.split = function(row, column) {
var pos = this.getNextFoldTo(row, column);
if (!pos || pos.kind == "inside")
return null;
var fold = pos.fold;
var folds = this.folds;
var foldData = this.foldData;
var i = folds.indexOf(fold);
var foldBefore = folds[i - 1];
this.end.row = foldBefore.end.row;
this.end.column = foldBefore.end.column;
folds = folds.splice(i, folds.length - i);
var newFoldLine = new FoldLine(foldData, folds);
foldData.splice(foldData.indexOf(this) + 1, 0, newFoldLine);
return newFoldLine;
};
this.merge = function(foldLineNext) {
var folds = foldLineNext.folds;
for (var i = 0; i < folds.length; i++) {
this.addFold(folds[i]);
}
var foldData = this.foldData;
foldData.splice(foldData.indexOf(foldLineNext), 1);
};
this.toString = function() {
var ret = [this.range.toString() + ": [" ];
this.folds.forEach(function(fold) {
ret.push(" " + fold.toString());
});
ret.push("]");
return ret.join("\n");
};
this.idxToPosition = function(idx) {
var lastFoldEndColumn = 0;
for (var i = 0; i < this.folds.length; i++) {
var fold = this.folds[i];
idx -= fold.start.column - lastFoldEndColumn;
if (idx < 0) {
return {
row: fold.start.row,
column: fold.start.column + idx
};
}
idx -= fold.placeholder.length;
if (idx < 0) {
return fold.start;
}
lastFoldEndColumn = fold.end.column;
}
return {
row: this.end.row,
column: this.end.column + idx
};
};
}).call(FoldLine.prototype);
exports.FoldLine = FoldLine;
});
ace.define("ace/range_list",["require","exports","module","ace/range"], function(acequire, exports, module) {
"use strict";
var Range = acequire("./range").Range;
var comparePoints = Range.comparePoints;
var RangeList = function() {
this.ranges = [];
};
(function() {
this.comparePoints = comparePoints;
this.pointIndex = function(pos, excludeEdges, startIndex) {
var list = this.ranges;
for (var i = startIndex || 0; i < list.length; i++) {
var range = list[i];
var cmpEnd = comparePoints(pos, range.end);
if (cmpEnd > 0)
continue;
var cmpStart = comparePoints(pos, range.start);
if (cmpEnd === 0)
return excludeEdges && cmpStart !== 0 ? -i-2 : i;
if (cmpStart > 0 || (cmpStart === 0 && !excludeEdges))
return i;
return -i-1;
}
return -i - 1;
};
this.add = function(range) {
var excludeEdges = !range.isEmpty();
var startIndex = this.pointIndex(range.start, excludeEdges);
if (startIndex < 0)
startIndex = -startIndex - 1;
var endIndex = this.pointIndex(range.end, excludeEdges, startIndex);
if (endIndex < 0)
endIndex = -endIndex - 1;
else
endIndex++;
return this.ranges.splice(startIndex, endIndex - startIndex, range);
};
this.addList = function(list) {
var removed = [];
for (var i = list.length; i--; ) {
removed.push.apply(removed, this.add(list[i]));
}
return removed;
};
this.substractPoint = function(pos) {
var i = this.pointIndex(pos);
if (i >= 0)
return this.ranges.splice(i, 1);
};
this.merge = function() {
var removed = [];
var list = this.ranges;
list = list.sort(function(a, b) {
return comparePoints(a.start, b.start);
});
var next = list[0], range;
for (var i = 1; i < list.length; i++) {
range = next;
next = list[i];
var cmp = comparePoints(range.end, next.start);
if (cmp < 0)
continue;
if (cmp == 0 && !range.isEmpty() && !next.isEmpty())
continue;
if (comparePoints(range.end, next.end) < 0) {
range.end.row = next.end.row;
range.end.column = next.end.column;
}
list.splice(i, 1);
removed.push(next);
next = range;
i--;
}
this.ranges = list;
return removed;
};
this.contains = function(row, column) {
return this.pointIndex({row: row, column: column}) >= 0;
};
this.containsPoint = function(pos) {
return this.pointIndex(pos) >= 0;
};
this.rangeAtPoint = function(pos) {
var i = this.pointIndex(pos);
if (i >= 0)
return this.ranges[i];
};
this.clipRows = function(startRow, endRow) {
var list = this.ranges;
if (list[0].start.row > endRow || list[list.length - 1].start.row < startRow)
return [];
var startIndex = this.pointIndex({row: startRow, column: 0});
if (startIndex < 0)
startIndex = -startIndex - 1;
var endIndex = this.pointIndex({row: endRow, column: 0}, startIndex);
if (endIndex < 0)
endIndex = -endIndex - 1;
var clipped = [];
for (var i = startIndex; i < endIndex; i++) {
clipped.push(list[i]);
}
return clipped;
};
this.removeAll = function() {
return this.ranges.splice(0, this.ranges.length);
};
this.attach = function(session) {
if (this.session)
this.detach();
this.session = session;
this.onChange = this.$onChange.bind(this);
this.session.on('change', this.onChange);
};
this.detach = function() {
if (!this.session)
return;
this.session.removeListener('change', this.onChange);
this.session = null;
};
this.$onChange = function(delta) {
if (delta.action == "insert"){
var start = delta.start;
var end = delta.end;
} else {
var end = delta.start;
var start = delta.end;
}
var startRow = start.row;
var endRow = end.row;
var lineDif = endRow - startRow;
var colDiff = -start.column + end.column;
var ranges = this.ranges;
for (var i = 0, n = ranges.length; i < n; i++) {
var r = ranges[i];
if (r.end.row < startRow)
continue;
if (r.start.row > startRow)
break;
if (r.start.row == startRow && r.start.column >= start.column ) {
if (r.start.column == start.column && this.$insertRight) {
} else {
r.start.column += colDiff;
r.start.row += lineDif;
}
}
if (r.end.row == startRow && r.end.column >= start.column) {
if (r.end.column == start.column && this.$insertRight) {
continue;
}
if (r.end.column == start.column && colDiff > 0 && i < n - 1) {
if (r.end.column > r.start.column && r.end.column == ranges[i+1].start.column)
r.end.column -= colDiff;
}
r.end.column += colDiff;
r.end.row += lineDif;
}
}
if (lineDif != 0 && i < n) {
for (; i < n; i++) {
var r = ranges[i];
r.start.row += lineDif;
r.end.row += lineDif;
}
}
};
}).call(RangeList.prototype);
exports.RangeList = RangeList;
});
ace.define("ace/edit_session/fold",["require","exports","module","ace/range","ace/range_list","ace/lib/oop"], function(acequire, exports, module) {
"use strict";
var Range = acequire("../range").Range;
var RangeList = acequire("../range_list").RangeList;
var oop = acequire("../lib/oop")
var Fold = exports.Fold = function(range, placeholder) {
this.foldLine = null;
this.placeholder = placeholder;
this.range = range;
this.start = range.start;
this.end = range.end;
this.sameRow = range.start.row == range.end.row;
this.subFolds = this.ranges = [];
};
oop.inherits(Fold, RangeList);
(function() {
this.toString = function() {
return '"' + this.placeholder + '" ' + this.range.toString();
};
this.setFoldLine = function(foldLine) {
this.foldLine = foldLine;
this.subFolds.forEach(function(fold) {
fold.setFoldLine(foldLine);
});
};
this.clone = function() {
var range = this.range.clone();
var fold = new Fold(range, this.placeholder);
this.subFolds.forEach(function(subFold) {
fold.subFolds.push(subFold.clone());
});
fold.collapseChildren = this.collapseChildren;
return fold;
};
this.addSubFold = function(fold) {
if (this.range.isEqual(fold))
return;
if (!this.range.containsRange(fold))
throw new Error("A fold can't intersect already existing fold" + fold.range + this.range);
consumeRange(fold, this.start);
var row = fold.start.row, column = fold.start.column;
for (var i = 0, cmp = -1; i < this.subFolds.length; i++) {
cmp = this.subFolds[i].range.compare(row, column);
if (cmp != 1)
break;
}
var afterStart = this.subFolds[i];
if (cmp == 0)
return afterStart.addSubFold(fold);
var row = fold.range.end.row, column = fold.range.end.column;
for (var j = i, cmp = -1; j < this.subFolds.length; j++) {
cmp = this.subFolds[j].range.compare(row, column);
if (cmp != 1)
break;
}
var afterEnd = this.subFolds[j];
if (cmp == 0)
throw new Error("A fold can't intersect already existing fold" + fold.range + this.range);
var consumedFolds = this.subFolds.splice(i, j - i, fold);
fold.setFoldLine(this.foldLine);
return fold;
};
this.restoreRange = function(range) {
return restoreRange(range, this.start);
};
}).call(Fold.prototype);
function consumePoint(point, anchor) {
point.row -= anchor.row;
if (point.row == 0)
point.column -= anchor.column;
}
function consumeRange(range, anchor) {
consumePoint(range.start, anchor);
consumePoint(range.end, anchor);
}
function restorePoint(point, anchor) {
if (point.row == 0)
point.column += anchor.column;
point.row += anchor.row;
}
function restoreRange(range, anchor) {
restorePoint(range.start, anchor);
restorePoint(range.end, anchor);
}
});
ace.define("ace/edit_session/folding",["require","exports","module","ace/range","ace/edit_session/fold_line","ace/edit_session/fold","ace/token_iterator"], function(acequire, exports, module) {
"use strict";
var Range = acequire("../range").Range;
var FoldLine = acequire("./fold_line").FoldLine;
var Fold = acequire("./fold").Fold;
var TokenIterator = acequire("../token_iterator").TokenIterator;
function Folding() {
this.getFoldAt = function(row, column, side) {
var foldLine = this.getFoldLine(row);
if (!foldLine)
return null;
var folds = foldLine.folds;
for (var i = 0; i < folds.length; i++) {
var fold = folds[i];
if (fold.range.contains(row, column)) {
if (side == 1 && fold.range.isEnd(row, column)) {
continue;
} else if (side == -1 && fold.range.isStart(row, column)) {
continue;
}
return fold;
}
}
};
this.getFoldsInRange = function(range) {
var start = range.start;
var end = range.end;
var foldLines = this.$foldData;
var foundFolds = [];
start.column += 1;
end.column -= 1;
for (var i = 0; i < foldLines.length; i++) {
var cmp = foldLines[i].range.compareRange(range);
if (cmp == 2) {
continue;
}
else if (cmp == -2) {
break;
}
var folds = foldLines[i].folds;
for (var j = 0; j < folds.length; j++) {
var fold = folds[j];
cmp = fold.range.compareRange(range);
if (cmp == -2) {
break;
} else if (cmp == 2) {
continue;
} else
if (cmp == 42) {
break;
}
foundFolds.push(fold);
}
}
start.column -= 1;
end.column += 1;
return foundFolds;
};
this.getFoldsInRangeList = function(ranges) {
if (Array.isArray(ranges)) {
var folds = [];
ranges.forEach(function(range) {
folds = folds.concat(this.getFoldsInRange(range));
}, this);
} else {
var folds = this.getFoldsInRange(ranges);
}
return folds;
};
this.getAllFolds = function() {
var folds = [];
var foldLines = this.$foldData;
for (var i = 0; i < foldLines.length; i++)
for (var j = 0; j < foldLines[i].folds.length; j++)
folds.push(foldLines[i].folds[j]);
return folds;
};
this.getFoldStringAt = function(row, column, trim, foldLine) {
foldLine = foldLine || this.getFoldLine(row);
if (!foldLine)
return null;
var lastFold = {
end: { column: 0 }
};
var str, fold;
for (var i = 0; i < foldLine.folds.length; i++) {
fold = foldLine.folds[i];
var cmp = fold.range.compareEnd(row, column);
if (cmp == -1) {
str = this
.getLine(fold.start.row)
.substring(lastFold.end.column, fold.start.column);
break;
}
else if (cmp === 0) {
return null;
}
lastFold = fold;
}
if (!str)
str = this.getLine(fold.start.row).substring(lastFold.end.column);
if (trim == -1)
return str.substring(0, column - lastFold.end.column);
else if (trim == 1)
return str.substring(column - lastFold.end.column);
else
return str;
};
this.getFoldLine = function(docRow, startFoldLine) {
var foldData = this.$foldData;
var i = 0;
if (startFoldLine)
i = foldData.indexOf(startFoldLine);
if (i == -1)
i = 0;
for (i; i < foldData.length; i++) {
var foldLine = foldData[i];
if (foldLine.start.row <= docRow && foldLine.end.row >= docRow) {
return foldLine;
} else if (foldLine.end.row > docRow) {
return null;
}
}
return null;
};
this.getNextFoldLine = function(docRow, startFoldLine) {
var foldData = this.$foldData;
var i = 0;
if (startFoldLine)
i = foldData.indexOf(startFoldLine);
if (i == -1)
i = 0;
for (i; i < foldData.length; i++) {
var foldLine = foldData[i];
if (foldLine.end.row >= docRow) {
return foldLine;
}
}
return null;
};
this.getFoldedRowCount = function(first, last) {
var foldData = this.$foldData, rowCount = last-first+1;
for (var i = 0; i < foldData.length; i++) {
var foldLine = foldData[i],
end = foldLine.end.row,
start = foldLine.start.row;
if (end >= last) {
if (start < last) {
if (start >= first)
rowCount -= last-start;
else
rowCount = 0; // in one fold
}
break;
} else if (end >= first){
if (start >= first) // fold inside range
rowCount -= end-start;
else
rowCount -= end-first+1;
}
}
return rowCount;
};
this.$addFoldLine = function(foldLine) {
this.$foldData.push(foldLine);
this.$foldData.sort(function(a, b) {
return a.start.row - b.start.row;
});
return foldLine;
};
this.addFold = function(placeholder, range) {
var foldData = this.$foldData;
var added = false;
var fold;
if (placeholder instanceof Fold)
fold = placeholder;
else {
fold = new Fold(range, placeholder);
fold.collapseChildren = range.collapseChildren;
}
this.$clipRangeToDocument(fold.range);
var startRow = fold.start.row;
var startColumn = fold.start.column;
var endRow = fold.end.row;
var endColumn = fold.end.column;
if (!(startRow < endRow ||
startRow == endRow && startColumn <= endColumn - 2))
throw new Error("The range has to be at least 2 characters width");
var startFold = this.getFoldAt(startRow, startColumn, 1);
var endFold = this.getFoldAt(endRow, endColumn, -1);
if (startFold && endFold == startFold)
return startFold.addSubFold(fold);
if (startFold && !startFold.range.isStart(startRow, startColumn))
this.removeFold(startFold);
if (endFold && !endFold.range.isEnd(endRow, endColumn))
this.removeFold(endFold);
var folds = this.getFoldsInRange(fold.range);
if (folds.length > 0) {
this.removeFolds(folds);
folds.forEach(function(subFold) {
fold.addSubFold(subFold);
});
}
for (var i = 0; i < foldData.length; i++) {
var foldLine = foldData[i];
if (endRow == foldLine.start.row) {
foldLine.addFold(fold);
added = true;
break;
} else if (startRow == foldLine.end.row) {
foldLine.addFold(fold);
added = true;
if (!fold.sameRow) {
var foldLineNext = foldData[i + 1];
if (foldLineNext && foldLineNext.start.row == endRow) {
foldLine.merge(foldLineNext);
break;
}
}
break;
} else if (endRow <= foldLine.start.row) {
break;
}
}
if (!added)
foldLine = this.$addFoldLine(new FoldLine(this.$foldData, fold));
if (this.$useWrapMode)
this.$updateWrapData(foldLine.start.row, foldLine.start.row);
else
this.$updateRowLengthCache(foldLine.start.row, foldLine.start.row);
this.$modified = true;
this._signal("changeFold", { data: fold, action: "add" });
return fold;
};
this.addFolds = function(folds) {
folds.forEach(function(fold) {
this.addFold(fold);
}, this);
};
this.removeFold = function(fold) {
var foldLine = fold.foldLine;
var startRow = foldLine.start.row;
var endRow = foldLine.end.row;
var foldLines = this.$foldData;
var folds = foldLine.folds;
if (folds.length == 1) {
foldLines.splice(foldLines.indexOf(foldLine), 1);
} else
if (foldLine.range.isEnd(fold.end.row, fold.end.column)) {
folds.pop();
foldLine.end.row = folds[folds.length - 1].end.row;
foldLine.end.column = folds[folds.length - 1].end.column;
} else
if (foldLine.range.isStart(fold.start.row, fold.start.column)) {
folds.shift();
foldLine.start.row = folds[0].start.row;
foldLine.start.column = folds[0].start.column;
} else
if (fold.sameRow) {
folds.splice(folds.indexOf(fold), 1);
} else
{
var newFoldLine = foldLine.split(fold.start.row, fold.start.column);
folds = newFoldLine.folds;
folds.shift();
newFoldLine.start.row = folds[0].start.row;
newFoldLine.start.column = folds[0].start.column;
}
if (!this.$updating) {
if (this.$useWrapMode)
this.$updateWrapData(startRow, endRow);
else
this.$updateRowLengthCache(startRow, endRow);
}
this.$modified = true;
this._signal("changeFold", { data: fold, action: "remove" });
};
this.removeFolds = function(folds) {
var cloneFolds = [];
for (var i = 0; i < folds.length; i++) {
cloneFolds.push(folds[i]);
}
cloneFolds.forEach(function(fold) {
this.removeFold(fold);
}, this);
this.$modified = true;
};
this.expandFold = function(fold) {
this.removeFold(fold);
fold.subFolds.forEach(function(subFold) {
fold.restoreRange(subFold);
this.addFold(subFold);
}, this);
if (fold.collapseChildren > 0) {
this.foldAll(fold.start.row+1, fold.end.row, fold.collapseChildren-1);
}
fold.subFolds = [];
};
this.expandFolds = function(folds) {
folds.forEach(function(fold) {
this.expandFold(fold);
}, this);
};
this.unfold = function(location, expandInner) {
var range, folds;
if (location == null) {
range = new Range(0, 0, this.getLength(), 0);
expandInner = true;
} else if (typeof location == "number")
range = new Range(location, 0, location, this.getLine(location).length);
else if ("row" in location)
range = Range.fromPoints(location, location);
else
range = location;
folds = this.getFoldsInRangeList(range);
if (expandInner) {
this.removeFolds(folds);
} else {
var subFolds = folds;
while (subFolds.length) {
this.expandFolds(subFolds);
subFolds = this.getFoldsInRangeList(range);
}
}
if (folds.length)
return folds;
};
this.isRowFolded = function(docRow, startFoldRow) {
return !!this.getFoldLine(docRow, startFoldRow);
};
this.getRowFoldEnd = function(docRow, startFoldRow) {
var foldLine = this.getFoldLine(docRow, startFoldRow);
return foldLine ? foldLine.end.row : docRow;
};
this.getRowFoldStart = function(docRow, startFoldRow) {
var foldLine = this.getFoldLine(docRow, startFoldRow);
return foldLine ? foldLine.start.row : docRow;
};
this.getFoldDisplayLine = function(foldLine, endRow, endColumn, startRow, startColumn) {
if (startRow == null)
startRow = foldLine.start.row;
if (startColumn == null)
startColumn = 0;
if (endRow == null)
endRow = foldLine.end.row;
if (endColumn == null)
endColumn = this.getLine(endRow).length;
var doc = this.doc;
var textLine = "";
foldLine.walk(function(placeholder, row, column, lastColumn) {
if (row < startRow)
return;
if (row == startRow) {
if (column < startColumn)
return;
lastColumn = Math.max(startColumn, lastColumn);
}
if (placeholder != null) {
textLine += placeholder;
} else {
textLine += doc.getLine(row).substring(lastColumn, column);
}
}, endRow, endColumn);
return textLine;
};
this.getDisplayLine = function(row, endColumn, startRow, startColumn) {
var foldLine = this.getFoldLine(row);
if (!foldLine) {
var line;
line = this.doc.getLine(row);
return line.substring(startColumn || 0, endColumn || line.length);
} else {
return this.getFoldDisplayLine(
foldLine, row, endColumn, startRow, startColumn);
}
};
this.$cloneFoldData = function() {
var fd = [];
fd = this.$foldData.map(function(foldLine) {
var folds = foldLine.folds.map(function(fold) {
return fold.clone();
});
return new FoldLine(fd, folds);
});
return fd;
};
this.toggleFold = function(tryToUnfold) {
var selection = this.selection;
var range = selection.getRange();
var fold;
var bracketPos;
if (range.isEmpty()) {
var cursor = range.start;
fold = this.getFoldAt(cursor.row, cursor.column);
if (fold) {
this.expandFold(fold);
return;
} else if (bracketPos = this.findMatchingBracket(cursor)) {
if (range.comparePoint(bracketPos) == 1) {
range.end = bracketPos;
} else {
range.start = bracketPos;
range.start.column++;
range.end.column--;
}
} else if (bracketPos = this.findMatchingBracket({row: cursor.row, column: cursor.column + 1})) {
if (range.comparePoint(bracketPos) == 1)
range.end = bracketPos;
else
range.start = bracketPos;
range.start.column++;
} else {
range = this.getCommentFoldRange(cursor.row, cursor.column) || range;
}
} else {
var folds = this.getFoldsInRange(range);
if (tryToUnfold && folds.length) {
this.expandFolds(folds);
return;
} else if (folds.length == 1 ) {
fold = folds[0];
}
}
if (!fold)
fold = this.getFoldAt(range.start.row, range.start.column);
if (fold && fold.range.toString() == range.toString()) {
this.expandFold(fold);
return;
}
var placeholder = "...";
if (!range.isMultiLine()) {
placeholder = this.getTextRange(range);
if (placeholder.length < 4)
return;
placeholder = placeholder.trim().substring(0, 2) + "..";
}
this.addFold(placeholder, range);
};
this.getCommentFoldRange = function(row, column, dir) {
var iterator = new TokenIterator(this, row, column);
var token = iterator.getCurrentToken();
if (token && /^comment|string/.test(token.type)) {
var range = new Range();
var re = new RegExp(token.type.replace(/\..*/, "\\."));
if (dir != 1) {
do {
token = iterator.stepBackward();
} while (token && re.test(token.type));
iterator.stepForward();
}
range.start.row = iterator.getCurrentTokenRow();
range.start.column = iterator.getCurrentTokenColumn() + 2;
iterator = new TokenIterator(this, row, column);
if (dir != -1) {
do {
token = iterator.stepForward();
} while (token && re.test(token.type));
token = iterator.stepBackward();
} else
token = iterator.getCurrentToken();
range.end.row = iterator.getCurrentTokenRow();
range.end.column = iterator.getCurrentTokenColumn() + token.value.length - 2;
return range;
}
};
this.foldAll = function(startRow, endRow, depth) {
if (depth == undefined)
depth = 100000; // JSON.stringify doesn't hanle Infinity
var foldWidgets = this.foldWidgets;
if (!foldWidgets)
return; // mode doesn't support folding
endRow = endRow || this.getLength();
startRow = startRow || 0;
for (var row = startRow; row < endRow; row++) {
if (foldWidgets[row] == null)
foldWidgets[row] = this.getFoldWidget(row);
if (foldWidgets[row] != "start")
continue;
var range = this.getFoldWidgetRange(row);
if (range && range.isMultiLine()
&& range.end.row <= endRow
&& range.start.row >= startRow
) {
row = range.end.row;
try {
var fold = this.addFold("...", range);
if (fold)
fold.collapseChildren = depth;
} catch(e) {}
}
}
};
this.$foldStyles = {
"manual": 1,
"markbegin": 1,
"markbeginend": 1
};
this.$foldStyle = "markbegin";
this.setFoldStyle = function(style) {
if (!this.$foldStyles[style])
throw new Error("invalid fold style: " + style + "[" + Object.keys(this.$foldStyles).join(", ") + "]");
if (this.$foldStyle == style)
return;
this.$foldStyle = style;
if (style == "manual")
this.unfold();
var mode = this.$foldMode;
this.$setFolding(null);
this.$setFolding(mode);
};
this.$setFolding = function(foldMode) {
if (this.$foldMode == foldMode)
return;
this.$foldMode = foldMode;
this.off('change', this.$updateFoldWidgets);
this.off('tokenizerUpdate', this.$tokenizerUpdateFoldWidgets);
this._signal("changeAnnotation");
if (!foldMode || this.$foldStyle == "manual") {
this.foldWidgets = null;
return;
}
this.foldWidgets = [];
this.getFoldWidget = foldMode.getFoldWidget.bind(foldMode, this, this.$foldStyle);
this.getFoldWidgetRange = foldMode.getFoldWidgetRange.bind(foldMode, this, this.$foldStyle);
this.$updateFoldWidgets = this.updateFoldWidgets.bind(this);
this.$tokenizerUpdateFoldWidgets = this.tokenizerUpdateFoldWidgets.bind(this);
this.on('change', this.$updateFoldWidgets);
this.on('tokenizerUpdate', this.$tokenizerUpdateFoldWidgets);
};
this.getParentFoldRangeData = function (row, ignoreCurrent) {
var fw = this.foldWidgets;
if (!fw || (ignoreCurrent && fw[row]))
return {};
var i = row - 1, firstRange;
while (i >= 0) {
var c = fw[i];
if (c == null)
c = fw[i] = this.getFoldWidget(i);
if (c == "start") {
var range = this.getFoldWidgetRange(i);
if (!firstRange)
firstRange = range;
if (range && range.end.row >= row)
break;
}
i--;
}
return {
range: i !== -1 && range,
firstRange: firstRange
};
};
this.onFoldWidgetClick = function(row, e) {
e = e.domEvent;
var options = {
children: e.shiftKey,
all: e.ctrlKey || e.metaKey,
siblings: e.altKey
};
var range = this.$toggleFoldWidget(row, options);
if (!range) {
var el = (e.target || e.srcElement);
if (el && /ace_fold-widget/.test(el.className))
el.className += " ace_invalid";
}
};
this.$toggleFoldWidget = function(row, options) {
if (!this.getFoldWidget)
return;
var type = this.getFoldWidget(row);
var line = this.getLine(row);
var dir = type === "end" ? -1 : 1;
var fold = this.getFoldAt(row, dir === -1 ? 0 : line.length, dir);
if (fold) {
if (options.children || options.all)
this.removeFold(fold);
else
this.expandFold(fold);
return fold;
}
var range = this.getFoldWidgetRange(row, true);
if (range && !range.isMultiLine()) {
fold = this.getFoldAt(range.start.row, range.start.column, 1);
if (fold && range.isEqual(fold.range)) {
this.removeFold(fold);
return fold;
}
}
if (options.siblings) {
var data = this.getParentFoldRangeData(row);
if (data.range) {
var startRow = data.range.start.row + 1;
var endRow = data.range.end.row;
}
this.foldAll(startRow, endRow, options.all ? 10000 : 0);
} else if (options.children) {
endRow = range ? range.end.row : this.getLength();
this.foldAll(row + 1, endRow, options.all ? 10000 : 0);
} else if (range) {
if (options.all)
range.collapseChildren = 10000;
this.addFold("...", range);
}
return range;
};
this.toggleFoldWidget = function(toggleParent) {
var row = this.selection.getCursor().row;
row = this.getRowFoldStart(row);
var range = this.$toggleFoldWidget(row, {});
if (range)
return;
var data = this.getParentFoldRangeData(row, true);
range = data.range || data.firstRange;
if (range) {
row = range.start.row;
var fold = this.getFoldAt(row, this.getLine(row).length, 1);
if (fold) {
this.removeFold(fold);
} else {
this.addFold("...", range);
}
}
};
this.updateFoldWidgets = function(delta) {
var firstRow = delta.start.row;
var len = delta.end.row - firstRow;
if (len === 0) {
this.foldWidgets[firstRow] = null;
} else if (delta.action == 'remove') {
this.foldWidgets.splice(firstRow, len + 1, null);
} else {
var args = Array(len + 1);
args.unshift(firstRow, 1);
this.foldWidgets.splice.apply(this.foldWidgets, args);
}
};
this.tokenizerUpdateFoldWidgets = function(e) {
var rows = e.data;
if (rows.first != rows.last) {
if (this.foldWidgets.length > rows.first)
this.foldWidgets.splice(rows.first, this.foldWidgets.length);
}
};
}
exports.Folding = Folding;
});
ace.define("ace/edit_session/bracket_match",["require","exports","module","ace/token_iterator","ace/range"], function(acequire, exports, module) {
"use strict";
var TokenIterator = acequire("../token_iterator").TokenIterator;
var Range = acequire("../range").Range;
function BracketMatch() {
this.findMatchingBracket = function(position, chr) {
if (position.column == 0) return null;
var charBeforeCursor = chr || this.getLine(position.row).charAt(position.column-1);
if (charBeforeCursor == "") return null;
var match = charBeforeCursor.match(/([\(\[\{])|([\)\]\}])/);
if (!match)
return null;
if (match[1])
return this.$findClosingBracket(match[1], position);
else
return this.$findOpeningBracket(match[2], position);
};
this.getBracketRange = function(pos) {
var line = this.getLine(pos.row);
var before = true, range;
var chr = line.charAt(pos.column-1);
var match = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
if (!match) {
chr = line.charAt(pos.column);
pos = {row: pos.row, column: pos.column + 1};
match = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
before = false;
}
if (!match)
return null;
if (match[1]) {
var bracketPos = this.$findClosingBracket(match[1], pos);
if (!bracketPos)
return null;
range = Range.fromPoints(pos, bracketPos);
if (!before) {
range.end.column++;
range.start.column--;
}
range.cursor = range.end;
} else {
var bracketPos = this.$findOpeningBracket(match[2], pos);
if (!bracketPos)
return null;
range = Range.fromPoints(bracketPos, pos);
if (!before) {
range.start.column++;
range.end.column--;
}
range.cursor = range.start;
}
return range;
};
this.$brackets = {
")": "(",
"(": ")",
"]": "[",
"[": "]",
"{": "}",
"}": "{"
};
this.$findOpeningBracket = function(bracket, position, typeRe) {
var openBracket = this.$brackets[bracket];
var depth = 1;
var iterator = new TokenIterator(this, position.row, position.column);
var token = iterator.getCurrentToken();
if (!token)
token = iterator.stepForward();
if (!token)
return;
if (!typeRe){
typeRe = new RegExp(
"(\\.?" +
token.type.replace(".", "\\.").replace("rparen", ".paren")
.replace(/\b(?:end)\b/, "(?:start|begin|end)")
+ ")+"
);
}
var valueIndex = position.column - iterator.getCurrentTokenColumn() - 2;
var value = token.value;
while (true) {
while (valueIndex >= 0) {
var chr = value.charAt(valueIndex);
if (chr == openBracket) {
depth -= 1;
if (depth == 0) {
return {row: iterator.getCurrentTokenRow(),
column: valueIndex + iterator.getCurrentTokenColumn()};
}
}
else if (chr == bracket) {
depth += 1;
}
valueIndex -= 1;
}
do {
token = iterator.stepBackward();
} while (token && !typeRe.test(token.type));
if (token == null)
break;
value = token.value;
valueIndex = value.length - 1;
}
return null;
};
this.$findClosingBracket = function(bracket, position, typeRe) {
var closingBracket = this.$brackets[bracket];
var depth = 1;
var iterator = new TokenIterator(this, position.row, position.column);
var token = iterator.getCurrentToken();
if (!token)
token = iterator.stepForward();
if (!token)
return;
if (!typeRe){
typeRe = new RegExp(
"(\\.?" +
token.type.replace(".", "\\.").replace("lparen", ".paren")
.replace(/\b(?:start|begin)\b/, "(?:start|begin|end)")
+ ")+"
);
}
var valueIndex = position.column - iterator.getCurrentTokenColumn();
while (true) {
var value = token.value;
var valueLength = value.length;
while (valueIndex < valueLength) {
var chr = value.charAt(valueIndex);
if (chr == closingBracket) {
depth -= 1;
if (depth == 0) {
return {row: iterator.getCurrentTokenRow(),
column: valueIndex + iterator.getCurrentTokenColumn()};
}
}
else if (chr == bracket) {
depth += 1;
}
valueIndex += 1;
}
do {
token = iterator.stepForward();
} while (token && !typeRe.test(token.type));
if (token == null)
break;
valueIndex = 0;
}
return null;
};
}
exports.BracketMatch = BracketMatch;
});
ace.define("ace/edit_session",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/config","ace/lib/event_emitter","ace/selection","ace/mode/text","ace/range","ace/document","ace/background_tokenizer","ace/search_highlight","ace/edit_session/folding","ace/edit_session/bracket_match"], function(acequire, exports, module) {
"use strict";
var oop = acequire("./lib/oop");
var lang = acequire("./lib/lang");
var config = acequire("./config");
var EventEmitter = acequire("./lib/event_emitter").EventEmitter;
var Selection = acequire("./selection").Selection;
var TextMode = acequire("./mode/text").Mode;
var Range = acequire("./range").Range;
var Document = acequire("./document").Document;
var BackgroundTokenizer = acequire("./background_tokenizer").BackgroundTokenizer;
var SearchHighlight = acequire("./search_highlight").SearchHighlight;
var EditSession = function(text, mode) {
this.$breakpoints = [];
this.$decorations = [];
this.$frontMarkers = {};
this.$backMarkers = {};
this.$markerId = 1;
this.$undoSelect = true;
this.$foldData = [];
this.id = "session" + (++EditSession.$uid);
this.$foldData.toString = function() {
return this.join("\n");
};
this.on("changeFold", this.onChangeFold.bind(this));
this.$onChange = this.onChange.bind(this);
if (typeof text != "object" || !text.getLine)
text = new Document(text);
this.setDocument(text);
this.selection = new Selection(this);
config.resetOptions(this);
this.setMode(mode);
config._signal("session", this);
};
(function() {
oop.implement(this, EventEmitter);
this.setDocument = function(doc) {
if (this.doc)
this.doc.removeListener("change", this.$onChange);
this.doc = doc;
doc.on("change", this.$onChange);
if (this.bgTokenizer)
this.bgTokenizer.setDocument(this.getDocument());
this.resetCaches();
};
this.getDocument = function() {
return this.doc;
};
this.$resetRowCache = function(docRow) {
if (!docRow) {
this.$docRowCache = [];
this.$screenRowCache = [];
return;
}
var l = this.$docRowCache.length;
var i = this.$getRowCacheIndex(this.$docRowCache, docRow) + 1;
if (l > i) {
this.$docRowCache.splice(i, l);
this.$screenRowCache.splice(i, l);
}
};
this.$getRowCacheIndex = function(cacheArray, val) {
var low = 0;
var hi = cacheArray.length - 1;
while (low <= hi) {
var mid = (low + hi) >> 1;
var c = cacheArray[mid];
if (val > c)
low = mid + 1;
else if (val < c)
hi = mid - 1;
else
return mid;
}
return low -1;
};
this.resetCaches = function() {
this.$modified = true;
this.$wrapData = [];
this.$rowLengthCache = [];
this.$resetRowCache(0);
if (this.bgTokenizer)
this.bgTokenizer.start(0);
};
this.onChangeFold = function(e) {
var fold = e.data;
this.$resetRowCache(fold.start.row);
};
this.onChange = function(delta) {
this.$modified = true;
this.$resetRowCache(delta.start.row);
var removedFolds = this.$updateInternalDataOnChange(delta);
if (!this.$fromUndo && this.$undoManager && !delta.ignore) {
this.$deltasDoc.push(delta);
if (removedFolds && removedFolds.length != 0) {
this.$deltasFold.push({
action: "removeFolds",
folds: removedFolds
});
}
this.$informUndoManager.schedule();
}
this.bgTokenizer && this.bgTokenizer.$updateOnChange(delta);
this._signal("change", delta);
};
this.setValue = function(text) {
this.doc.setValue(text);
this.selection.moveTo(0, 0);
this.$resetRowCache(0);
this.$deltas = [];
this.$deltasDoc = [];
this.$deltasFold = [];
this.setUndoManager(this.$undoManager);
this.getUndoManager().reset();
};
this.getValue =
this.toString = function() {
return this.doc.getValue();
};
this.getSelection = function() {
return this.selection;
};
this.getState = function(row) {
return this.bgTokenizer.getState(row);
};
this.getTokens = function(row) {
return this.bgTokenizer.getTokens(row);
};
this.getTokenAt = function(row, column) {
var tokens = this.bgTokenizer.getTokens(row);
var token, c = 0;
if (column == null) {
i = tokens.length - 1;
c = this.getLine(row).length;
} else {
for (var i = 0; i < tokens.length; i++) {
c += tokens[i].value.length;
if (c >= column)
break;
}
}
token = tokens[i];
if (!token)
return null;
token.index = i;
token.start = c - token.value.length;
return token;
};
this.setUndoManager = function(undoManager) {
this.$undoManager = undoManager;
this.$deltas = [];
this.$deltasDoc = [];
this.$deltasFold = [];
if (this.$informUndoManager)
this.$informUndoManager.cancel();
if (undoManager) {
var self = this;
this.$syncInformUndoManager = function() {
self.$informUndoManager.cancel();
if (self.$deltasFold.length) {
self.$deltas.push({
group: "fold",
deltas: self.$deltasFold
});
self.$deltasFold = [];
}
if (self.$deltasDoc.length) {
self.$deltas.push({
group: "doc",
deltas: self.$deltasDoc
});
self.$deltasDoc = [];
}
if (self.$deltas.length > 0) {
undoManager.execute({
action: "aceupdate",
args: [self.$deltas, self],
merge: self.mergeUndoDeltas
});
}
self.mergeUndoDeltas = false;
self.$deltas = [];
};
this.$informUndoManager = lang.delayedCall(this.$syncInformUndoManager);
}
};
this.markUndoGroup = function() {
if (this.$syncInformUndoManager)
this.$syncInformUndoManager();
};
this.$defaultUndoManager = {
undo: function() {},
redo: function() {},
reset: function() {}
};
this.getUndoManager = function() {
return this.$undoManager || this.$defaultUndoManager;
};
this.getTabString = function() {
if (this.getUseSoftTabs()) {
return lang.stringRepeat(" ", this.getTabSize());
} else {
return "\t";
}
};
this.setUseSoftTabs = function(val) {
this.setOption("useSoftTabs", val);
};
this.getUseSoftTabs = function() {
return this.$useSoftTabs && !this.$mode.$indentWithTabs;
};
this.setTabSize = function(tabSize) {
this.setOption("tabSize", tabSize);
};
this.getTabSize = function() {
return this.$tabSize;
};
this.isTabStop = function(position) {
return this.$useSoftTabs && (position.column % this.$tabSize === 0);
};
this.$overwrite = false;
this.setOverwrite = function(overwrite) {
this.setOption("overwrite", overwrite);
};
this.getOverwrite = function() {
return this.$overwrite;
};
this.toggleOverwrite = function() {
this.setOverwrite(!this.$overwrite);
};
this.addGutterDecoration = function(row, className) {
if (!this.$decorations[row])
this.$decorations[row] = "";
this.$decorations[row] += " " + className;
this._signal("changeBreakpoint", {});
};
this.removeGutterDecoration = function(row, className) {
this.$decorations[row] = (this.$decorations[row] || "").replace(" " + className, "");
this._signal("changeBreakpoint", {});
};
this.getBreakpoints = function() {
return this.$breakpoints;
};
this.setBreakpoints = function(rows) {
this.$breakpoints = [];
for (var i=0; i<rows.length; i++) {
this.$breakpoints[rows[i]] = "ace_breakpoint";
}
this._signal("changeBreakpoint", {});
};
this.clearBreakpoints = function() {
this.$breakpoints = [];
this._signal("changeBreakpoint", {});
};
this.setBreakpoint = function(row, className) {
if (className === undefined)
className = "ace_breakpoint";
if (className)
this.$breakpoints[row] = className;
else
delete this.$breakpoints[row];
this._signal("changeBreakpoint", {});
};
this.clearBreakpoint = function(row) {
delete this.$breakpoints[row];
this._signal("changeBreakpoint", {});
};
this.addMarker = function(range, clazz, type, inFront) {
var id = this.$markerId++;
var marker = {
range : range,
type : type || "line",
renderer: typeof type == "function" ? type : null,
clazz : clazz,
inFront: !!inFront,
id: id
};
if (inFront) {
this.$frontMarkers[id] = marker;
this._signal("changeFrontMarker");
} else {
this.$backMarkers[id] = marker;
this._signal("changeBackMarker");
}
return id;
};
this.addDynamicMarker = function(marker, inFront) {
if (!marker.update)
return;
var id = this.$markerId++;
marker.id = id;
marker.inFront = !!inFront;
if (inFront) {
this.$frontMarkers[id] = marker;
this._signal("changeFrontMarker");
} else {
this.$backMarkers[id] = marker;
this._signal("changeBackMarker");
}
return marker;
};
this.removeMarker = function(markerId) {
var marker = this.$frontMarkers[markerId] || this.$backMarkers[markerId];
if (!marker)
return;
var markers = marker.inFront ? this.$frontMarkers : this.$backMarkers;
if (marker) {
delete (markers[markerId]);
this._signal(marker.inFront ? "changeFrontMarker" : "changeBackMarker");
}
};
this.getMarkers = function(inFront) {
return inFront ? this.$frontMarkers : this.$backMarkers;
};
this.highlight = function(re) {
if (!this.$searchHighlight) {
var highlight = new SearchHighlight(null, "ace_selected-word", "text");
this.$searchHighlight = this.addDynamicMarker(highlight);
}
this.$searchHighlight.setRegexp(re);
};
this.highlightLines = function(startRow, endRow, clazz, inFront) {
if (typeof endRow != "number") {
clazz = endRow;
endRow = startRow;
}
if (!clazz)
clazz = "ace_step";
var range = new Range(startRow, 0, endRow, Infinity);
range.id = this.addMarker(range, clazz, "fullLine", inFront);
return range;
};
this.setAnnotations = function(annotations) {
this.$annotations = annotations;
this._signal("changeAnnotation", {});
};
this.getAnnotations = function() {
return this.$annotations || [];
};
this.clearAnnotations = function() {
this.setAnnotations([]);
};
this.$detectNewLine = function(text) {
var match = text.match(/^.*?(\r?\n)/m);
if (match) {
this.$autoNewLine = match[1];
} else {
this.$autoNewLine = "\n";
}
};
this.getWordRange = function(row, column) {
var line = this.getLine(row);
var inToken = false;
if (column > 0)
inToken = !!line.charAt(column - 1).match(this.tokenRe);
if (!inToken)
inToken = !!line.charAt(column).match(this.tokenRe);
if (inToken)
var re = this.tokenRe;
else if (/^\s+$/.test(line.slice(column-1, column+1)))
var re = /\s/;
else
var re = this.nonTokenRe;
var start = column;
if (start > 0) {
do {
start--;
}
while (start >= 0 && line.charAt(start).match(re));
start++;
}
var end = column;
while (end < line.length && line.charAt(end).match(re)) {
end++;
}
return new Range(row, start, row, end);
};
this.getAWordRange = function(row, column) {
var wordRange = this.getWordRange(row, column);
var line = this.getLine(wordRange.end.row);
while (line.charAt(wordRange.end.column).match(/[ \t]/)) {
wordRange.end.column += 1;
}
return wordRange;
};
this.setNewLineMode = function(newLineMode) {
this.doc.setNewLineMode(newLineMode);
};
this.getNewLineMode = function() {
return this.doc.getNewLineMode();
};
this.setUseWorker = function(useWorker) { this.setOption("useWorker", useWorker); };
this.getUseWorker = function() { return this.$useWorker; };
this.onReloadTokenizer = function(e) {
var rows = e.data;
this.bgTokenizer.start(rows.first);
this._signal("tokenizerUpdate", e);
};
this.$modes = {};
this.$mode = null;
this.$modeId = null;
this.setMode = function(mode, cb) {
if (mode && typeof mode === "object") {
if (mode.getTokenizer)
return this.$onChangeMode(mode);
var options = mode;
var path = options.path;
} else {
path = mode || "ace/mode/text";
}
if (!this.$modes["ace/mode/text"])
this.$modes["ace/mode/text"] = new TextMode();
if (this.$modes[path] && !options) {
this.$onChangeMode(this.$modes[path]);
cb && cb();
return;
}
this.$modeId = path;
config.loadModule(["mode", path], function(m) {
if (this.$modeId !== path)
return cb && cb();
if (this.$modes[path] && !options) {
this.$onChangeMode(this.$modes[path]);
} else if (m && m.Mode) {
m = new m.Mode(options);
if (!options) {
this.$modes[path] = m;
m.$id = path;
}
this.$onChangeMode(m);
}
cb && cb();
}.bind(this));
if (!this.$mode)
this.$onChangeMode(this.$modes["ace/mode/text"], true);
};
this.$onChangeMode = function(mode, $isPlaceholder) {
if (!$isPlaceholder)
this.$modeId = mode.$id;
if (this.$mode === mode)
return;
this.$mode = mode;
this.$stopWorker();
if (this.$useWorker)
this.$startWorker();
var tokenizer = mode.getTokenizer();
if(tokenizer.addEventListener !== undefined) {
var onReloadTokenizer = this.onReloadTokenizer.bind(this);
tokenizer.addEventListener("update", onReloadTokenizer);
}
if (!this.bgTokenizer) {
this.bgTokenizer = new BackgroundTokenizer(tokenizer);
var _self = this;
this.bgTokenizer.addEventListener("update", function(e) {
_self._signal("tokenizerUpdate", e);
});
} else {
this.bgTokenizer.setTokenizer(tokenizer);
}
this.bgTokenizer.setDocument(this.getDocument());
this.tokenRe = mode.tokenRe;
this.nonTokenRe = mode.nonTokenRe;
if (!$isPlaceholder) {
if (mode.attachToSession)
mode.attachToSession(this);
this.$options.wrapMethod.set.call(this, this.$wrapMethod);
this.$setFolding(mode.foldingRules);
this.bgTokenizer.start(0);
this._emit("changeMode");
}
};
this.$stopWorker = function() {
if (this.$worker) {
this.$worker.terminate();
this.$worker = null;
}
};
this.$startWorker = function() {
try {
this.$worker = this.$mode.createWorker(this);
} catch (e) {
config.warn("Could not load worker", e);
this.$worker = null;
}
};
this.getMode = function() {
return this.$mode;
};
this.$scrollTop = 0;
this.setScrollTop = function(scrollTop) {
if (this.$scrollTop === scrollTop || isNaN(scrollTop))
return;
this.$scrollTop = scrollTop;
this._signal("changeScrollTop", scrollTop);
};
this.getScrollTop = function() {
return this.$scrollTop;
};
this.$scrollLeft = 0;
this.setScrollLeft = function(scrollLeft) {
if (this.$scrollLeft === scrollLeft || isNaN(scrollLeft))
return;
this.$scrollLeft = scrollLeft;
this._signal("changeScrollLeft", scrollLeft);
};
this.getScrollLeft = function() {
return this.$scrollLeft;
};
this.getScreenWidth = function() {
this.$computeWidth();
if (this.lineWidgets)
return Math.max(this.getLineWidgetMaxWidth(), this.screenWidth);
return this.screenWidth;
};
this.getLineWidgetMaxWidth = function() {
if (this.lineWidgetsWidth != null) return this.lineWidgetsWidth;
var width = 0;
this.lineWidgets.forEach(function(w) {
if (w && w.screenWidth > width)
width = w.screenWidth;
});
return this.lineWidgetWidth = width;
};
this.$computeWidth = function(force) {
if (this.$modified || force) {
this.$modified = false;
if (this.$useWrapMode)
return this.screenWidth = this.$wrapLimit;
var lines = this.doc.getAllLines();
var cache = this.$rowLengthCache;
var longestScreenLine = 0;
var foldIndex = 0;
var foldLine = this.$foldData[foldIndex];
var foldStart = foldLine ? foldLine.start.row : Infinity;
var len = lines.length;
for (var i = 0; i < len; i++) {
if (i > foldStart) {
i = foldLine.end.row + 1;
if (i >= len)
break;
foldLine = this.$foldData[foldIndex++];
foldStart = foldLine ? foldLine.start.row : Infinity;
}
if (cache[i] == null)
cache[i] = this.$getStringScreenWidth(lines[i])[0];
if (cache[i] > longestScreenLine)
longestScreenLine = cache[i];
}
this.screenWidth = longestScreenLine;
}
};
this.getLine = function(row) {
return this.doc.getLine(row);
};
this.getLines = function(firstRow, lastRow) {
return this.doc.getLines(firstRow, lastRow);
};
this.getLength = function() {
return this.doc.getLength();
};
this.getTextRange = function(range) {
return this.doc.getTextRange(range || this.selection.getRange());
};
this.insert = function(position, text) {
return this.doc.insert(position, text);
};
this.remove = function(range) {
return this.doc.remove(range);
};
this.removeFullLines = function(firstRow, lastRow){
return this.doc.removeFullLines(firstRow, lastRow);
};
this.undoChanges = function(deltas, dontSelect) {
if (!deltas.length)
return;
this.$fromUndo = true;
var lastUndoRange = null;
for (var i = deltas.length - 1; i != -1; i--) {
var delta = deltas[i];
if (delta.group == "doc") {
this.doc.revertDeltas(delta.deltas);
lastUndoRange =
this.$getUndoSelection(delta.deltas, true, lastUndoRange);
} else {
delta.deltas.forEach(function(foldDelta) {
this.addFolds(foldDelta.folds);
}, this);
}
}
this.$fromUndo = false;
lastUndoRange &&
this.$undoSelect &&
!dontSelect &&
this.selection.setSelectionRange(lastUndoRange);
return lastUndoRange;
};
this.redoChanges = function(deltas, dontSelect) {
if (!deltas.length)
return;
this.$fromUndo = true;
var lastUndoRange = null;
for (var i = 0; i < deltas.length; i++) {
var delta = deltas[i];
if (delta.group == "doc") {
this.doc.applyDeltas(delta.deltas);
lastUndoRange =
this.$getUndoSelection(delta.deltas, false, lastUndoRange);
}
}
this.$fromUndo = false;
lastUndoRange &&
this.$undoSelect &&
!dontSelect &&
this.selection.setSelectionRange(lastUndoRange);
return lastUndoRange;
};
this.setUndoSelect = function(enable) {
this.$undoSelect = enable;
};
this.$getUndoSelection = function(deltas, isUndo, lastUndoRange) {
function isInsert(delta) {
return isUndo ? delta.action !== "insert" : delta.action === "insert";
}
var delta = deltas[0];
var range, point;
var lastDeltaIsInsert = false;
if (isInsert(delta)) {
range = Range.fromPoints(delta.start, delta.end);
lastDeltaIsInsert = true;
} else {
range = Range.fromPoints(delta.start, delta.start);
lastDeltaIsInsert = false;
}
for (var i = 1; i < deltas.length; i++) {
delta = deltas[i];
if (isInsert(delta)) {
point = delta.start;
if (range.compare(point.row, point.column) == -1) {
range.setStart(point);
}
point = delta.end;
if (range.compare(point.row, point.column) == 1) {
range.setEnd(point);
}
lastDeltaIsInsert = true;
} else {
point = delta.start;
if (range.compare(point.row, point.column) == -1) {
range = Range.fromPoints(delta.start, delta.start);
}
lastDeltaIsInsert = false;
}
}
if (lastUndoRange != null) {
if (Range.comparePoints(lastUndoRange.start, range.start) === 0) {
lastUndoRange.start.column += range.end.column - range.start.column;
lastUndoRange.end.column += range.end.column - range.start.column;
}
var cmp = lastUndoRange.compareRange(range);
if (cmp == 1) {
range.setStart(lastUndoRange.start);
} else if (cmp == -1) {
range.setEnd(lastUndoRange.end);
}
}
return range;
};
this.replace = function(range, text) {
return this.doc.replace(range, text);
};
this.moveText = function(fromRange, toPosition, copy) {
var text = this.getTextRange(fromRange);
var folds = this.getFoldsInRange(fromRange);
var toRange = Range.fromPoints(toPosition, toPosition);
if (!copy) {
this.remove(fromRange);
var rowDiff = fromRange.start.row - fromRange.end.row;
var collDiff = rowDiff ? -fromRange.end.column : fromRange.start.column - fromRange.end.column;
if (collDiff) {
if (toRange.start.row == fromRange.end.row && toRange.start.column > fromRange.end.column)
toRange.start.column += collDiff;
if (toRange.end.row == fromRange.end.row && toRange.end.column > fromRange.end.column)
toRange.end.column += collDiff;
}
if (rowDiff && toRange.start.row >= fromRange.end.row) {
toRange.start.row += rowDiff;
toRange.end.row += rowDiff;
}
}
toRange.end = this.insert(toRange.start, text);
if (folds.length) {
var oldStart = fromRange.start;
var newStart = toRange.start;
var rowDiff = newStart.row - oldStart.row;
var collDiff = newStart.column - oldStart.column;
this.addFolds(folds.map(function(x) {
x = x.clone();
if (x.start.row == oldStart.row)
x.start.column += collDiff;
if (x.end.row == oldStart.row)
x.end.column += collDiff;
x.start.row += rowDiff;
x.end.row += rowDiff;
return x;
}));
}
return toRange;
};
this.indentRows = function(startRow, endRow, indentString) {
indentString = indentString.replace(/\t/g, this.getTabString());
for (var row=startRow; row<=endRow; row++)
this.doc.insertInLine({row: row, column: 0}, indentString);
};
this.outdentRows = function (range) {
var rowRange = range.collapseRows();
var deleteRange = new Range(0, 0, 0, 0);
var size = this.getTabSize();
for (var i = rowRange.start.row; i <= rowRange.end.row; ++i) {
var line = this.getLine(i);
deleteRange.start.row = i;
deleteRange.end.row = i;
for (var j = 0; j < size; ++j)
if (line.charAt(j) != ' ')
break;
if (j < size && line.charAt(j) == '\t') {
deleteRange.start.column = j;
deleteRange.end.column = j + 1;
} else {
deleteRange.start.column = 0;
deleteRange.end.column = j;
}
this.remove(deleteRange);
}
};
this.$moveLines = function(firstRow, lastRow, dir) {
firstRow = this.getRowFoldStart(firstRow);
lastRow = this.getRowFoldEnd(lastRow);
if (dir < 0) {
var row = this.getRowFoldStart(firstRow + dir);
if (row < 0) return 0;
var diff = row-firstRow;
} else if (dir > 0) {
var row = this.getRowFoldEnd(lastRow + dir);
if (row > this.doc.getLength()-1) return 0;
var diff = row-lastRow;
} else {
firstRow = this.$clipRowToDocument(firstRow);
lastRow = this.$clipRowToDocument(lastRow);
var diff = lastRow - firstRow + 1;
}
var range = new Range(firstRow, 0, lastRow, Number.MAX_VALUE);
var folds = this.getFoldsInRange(range).map(function(x){
x = x.clone();
x.start.row += diff;
x.end.row += diff;
return x;
});
var lines = dir == 0
? this.doc.getLines(firstRow, lastRow)
: this.doc.removeFullLines(firstRow, lastRow);
this.doc.insertFullLines(firstRow+diff, lines);
folds.length && this.addFolds(folds);
return diff;
};
this.moveLinesUp = function(firstRow, lastRow) {
return this.$moveLines(firstRow, lastRow, -1);
};
this.moveLinesDown = function(firstRow, lastRow) {
return this.$moveLines(firstRow, lastRow, 1);
};
this.duplicateLines = function(firstRow, lastRow) {
return this.$moveLines(firstRow, lastRow, 0);
};
this.$clipRowToDocument = function(row) {
return Math.max(0, Math.min(row, this.doc.getLength()-1));
};
this.$clipColumnToRow = function(row, column) {
if (column < 0)
return 0;
return Math.min(this.doc.getLine(row).length, column);
};
this.$clipPositionToDocument = function(row, column) {
column = Math.max(0, column);
if (row < 0) {
row = 0;
column = 0;
} else {
var len = this.doc.getLength();
if (row >= len) {
row = len - 1;
column = this.doc.getLine(len-1).length;
} else {
column = Math.min(this.doc.getLine(row).length, column);
}
}
return {
row: row,
column: column
};
};
this.$clipRangeToDocument = function(range) {
if (range.start.row < 0) {
range.start.row = 0;
range.start.column = 0;
} else {
range.start.column = this.$clipColumnToRow(
range.start.row,
range.start.column
);
}
var len = this.doc.getLength() - 1;
if (range.end.row > len) {
range.end.row = len;
range.end.column = this.doc.getLine(len).length;
} else {
range.end.column = this.$clipColumnToRow(
range.end.row,
range.end.column
);
}
return range;
};
this.$wrapLimit = 80;
this.$useWrapMode = false;
this.$wrapLimitRange = {
min : null,
max : null
};
this.setUseWrapMode = function(useWrapMode) {
if (useWrapMode != this.$useWrapMode) {
this.$useWrapMode = useWrapMode;
this.$modified = true;
this.$resetRowCache(0);
if (useWrapMode) {
var len = this.getLength();
this.$wrapData = Array(len);
this.$updateWrapData(0, len - 1);
}
this._signal("changeWrapMode");
}
};
this.getUseWrapMode = function() {
return this.$useWrapMode;
};
this.setWrapLimitRange = function(min, max) {
if (this.$wrapLimitRange.min !== min || this.$wrapLimitRange.max !== max) {
this.$wrapLimitRange = { min: min, max: max };
this.$modified = true;
if (this.$useWrapMode)
this._signal("changeWrapMode");
}
};
this.adjustWrapLimit = function(desiredLimit, $printMargin) {
var limits = this.$wrapLimitRange;
if (limits.max < 0)
limits = {min: $printMargin, max: $printMargin};
var wrapLimit = this.$constrainWrapLimit(desiredLimit, limits.min, limits.max);
if (wrapLimit != this.$wrapLimit && wrapLimit > 1) {
this.$wrapLimit = wrapLimit;
this.$modified = true;
if (this.$useWrapMode) {
this.$updateWrapData(0, this.getLength() - 1);
this.$resetRowCache(0);
this._signal("changeWrapLimit");
}
return true;
}
return false;
};
this.$constrainWrapLimit = function(wrapLimit, min, max) {
if (min)
wrapLimit = Math.max(min, wrapLimit);
if (max)
wrapLimit = Math.min(max, wrapLimit);
return wrapLimit;
};
this.getWrapLimit = function() {
return this.$wrapLimit;
};
this.setWrapLimit = function (limit) {
this.setWrapLimitRange(limit, limit);
};
this.getWrapLimitRange = function() {
return {
min : this.$wrapLimitRange.min,
max : this.$wrapLimitRange.max
};
};
this.$updateInternalDataOnChange = function(delta) {
var useWrapMode = this.$useWrapMode;
var action = delta.action;
var start = delta.start;
var end = delta.end;
var firstRow = start.row;
var lastRow = end.row;
var len = lastRow - firstRow;
var removedFolds = null;
this.$updating = true;
if (len != 0) {
if (action === "remove") {
this[useWrapMode ? "$wrapData" : "$rowLengthCache"].splice(firstRow, len);
var foldLines = this.$foldData;
removedFolds = this.getFoldsInRange(delta);
this.removeFolds(removedFolds);
var foldLine = this.getFoldLine(end.row);
var idx = 0;
if (foldLine) {
foldLine.addRemoveChars(end.row, end.column, start.column - end.column);
foldLine.shiftRow(-len);
var foldLineBefore = this.getFoldLine(firstRow);
if (foldLineBefore && foldLineBefore !== foldLine) {
foldLineBefore.merge(foldLine);
foldLine = foldLineBefore;
}
idx = foldLines.indexOf(foldLine) + 1;
}
for (idx; idx < foldLines.length; idx++) {
var foldLine = foldLines[idx];
if (foldLine.start.row >= end.row) {
foldLine.shiftRow(-len);
}
}
lastRow = firstRow;
} else {
var args = Array(len);
args.unshift(firstRow, 0);
var arr = useWrapMode ? this.$wrapData : this.$rowLengthCache
arr.splice.apply(arr, args);
var foldLines = this.$foldData;
var foldLine = this.getFoldLine(firstRow);
var idx = 0;
if (foldLine) {
var cmp = foldLine.range.compareInside(start.row, start.column);
if (cmp == 0) {
foldLine = foldLine.split(start.row, start.column);
if (foldLine) {
foldLine.shiftRow(len);
foldLine.addRemoveChars(lastRow, 0, end.column - start.column);
}
} else
if (cmp == -1) {
foldLine.addRemoveChars(firstRow, 0, end.column - start.column);
foldLine.shiftRow(len);
}
idx = foldLines.indexOf(foldLine) + 1;
}
for (idx; idx < foldLines.length; idx++) {
var foldLine = foldLines[idx];
if (foldLine.start.row >= firstRow) {
foldLine.shiftRow(len);
}
}
}
} else {
len = Math.abs(delta.start.column - delta.end.column);
if (action === "remove") {
removedFolds = this.getFoldsInRange(delta);
this.removeFolds(removedFolds);
len = -len;
}
var foldLine = this.getFoldLine(firstRow);
if (foldLine) {
foldLine.addRemoveChars(firstRow, start.column, len);
}
}
if (useWrapMode && this.$wrapData.length != this.doc.getLength()) {
console.error("doc.getLength() and $wrapData.length have to be the same!");
}
this.$updating = false;
if (useWrapMode)
this.$updateWrapData(firstRow, lastRow);
else
this.$updateRowLengthCache(firstRow, lastRow);
return removedFolds;
};
this.$updateRowLengthCache = function(firstRow, lastRow, b) {
this.$rowLengthCache[firstRow] = null;
this.$rowLengthCache[lastRow] = null;
};
this.$updateWrapData = function(firstRow, lastRow) {
var lines = this.doc.getAllLines();
var tabSize = this.getTabSize();
var wrapData = this.$wrapData;
var wrapLimit = this.$wrapLimit;
var tokens;
var foldLine;
var row = firstRow;
lastRow = Math.min(lastRow, lines.length - 1);
while (row <= lastRow) {
foldLine = this.getFoldLine(row, foldLine);
if (!foldLine) {
tokens = this.$getDisplayTokens(lines[row]);
wrapData[row] = this.$computeWrapSplits(tokens, wrapLimit, tabSize);
row ++;
} else {
tokens = [];
foldLine.walk(function(placeholder, row, column, lastColumn) {
var walkTokens;
if (placeholder != null) {
walkTokens = this.$getDisplayTokens(
placeholder, tokens.length);
walkTokens[0] = PLACEHOLDER_START;
for (var i = 1; i < walkTokens.length; i++) {
walkTokens[i] = PLACEHOLDER_BODY;
}
} else {
walkTokens = this.$getDisplayTokens(
lines[row].substring(lastColumn, column),
tokens.length);
}
tokens = tokens.concat(walkTokens);
}.bind(this),
foldLine.end.row,
lines[foldLine.end.row].length + 1
);
wrapData[foldLine.start.row] = this.$computeWrapSplits(tokens, wrapLimit, tabSize);
row = foldLine.end.row + 1;
}
}
};
var CHAR = 1,
CHAR_EXT = 2,
PLACEHOLDER_START = 3,
PLACEHOLDER_BODY = 4,
PUNCTUATION = 9,
SPACE = 10,
TAB = 11,
TAB_SPACE = 12;
this.$computeWrapSplits = function(tokens, wrapLimit, tabSize) {
if (tokens.length == 0) {
return [];
}
var splits = [];
var displayLength = tokens.length;
var lastSplit = 0, lastDocSplit = 0;
var isCode = this.$wrapAsCode;
var indentedSoftWrap = this.$indentedSoftWrap;
var maxIndent = wrapLimit <= Math.max(2 * tabSize, 8)
|| indentedSoftWrap === false ? 0 : Math.floor(wrapLimit / 2);
function getWrapIndent() {
var indentation = 0;
if (maxIndent === 0)
return indentation;
if (indentedSoftWrap) {
for (var i = 0; i < tokens.length; i++) {
var token = tokens[i];
if (token == SPACE)
indentation += 1;
else if (token == TAB)
indentation += tabSize;
else if (token == TAB_SPACE)
continue;
else
break;
}
}
if (isCode && indentedSoftWrap !== false)
indentation += tabSize;
return Math.min(indentation, maxIndent);
}
function addSplit(screenPos) {
var displayed = tokens.slice(lastSplit, screenPos);
var len = displayed.length;
displayed.join("")
.replace(/12/g, function() {
len -= 1;
})
.replace(/2/g, function() {
len -= 1;
});
if (!splits.length) {
indent = getWrapIndent();
splits.indent = indent;
}
lastDocSplit += len;
splits.push(lastDocSplit);
lastSplit = screenPos;
}
var indent = 0;
while (displayLength - lastSplit > wrapLimit - indent) {
var split = lastSplit + wrapLimit - indent;
if (tokens[split - 1] >= SPACE && tokens[split] >= SPACE) {
addSplit(split);
continue;
}
if (tokens[split] == PLACEHOLDER_START || tokens[split] == PLACEHOLDER_BODY) {
for (split; split != lastSplit - 1; split--) {
if (tokens[split] == PLACEHOLDER_START) {
break;
}
}
if (split > lastSplit) {
addSplit(split);
continue;
}
split = lastSplit + wrapLimit;
for (split; split < tokens.length; split++) {
if (tokens[split] != PLACEHOLDER_BODY) {
break;
}
}
if (split == tokens.length) {
break; // Breaks the while-loop.
}
addSplit(split);
continue;
}
var minSplit = Math.max(split - (wrapLimit -(wrapLimit>>2)), lastSplit - 1);
while (split > minSplit && tokens[split] < PLACEHOLDER_START) {
split --;
}
if (isCode) {
while (split > minSplit && tokens[split] < PLACEHOLDER_START) {
split --;
}
while (split > minSplit && tokens[split] == PUNCTUATION) {
split --;
}
} else {
while (split > minSplit && tokens[split] < SPACE) {
split --;
}
}
if (split > minSplit) {
addSplit(++split);
continue;
}
split = lastSplit + wrapLimit;
if (tokens[split] == CHAR_EXT)
split--;
addSplit(split - indent);
}
return splits;
};
this.$getDisplayTokens = function(str, offset) {
var arr = [];
var tabSize;
offset = offset || 0;
for (var i = 0; i < str.length; i++) {
var c = str.charCodeAt(i);
if (c == 9) {
tabSize = this.getScreenTabSize(arr.length + offset);
arr.push(TAB);
for (var n = 1; n < tabSize; n++) {
arr.push(TAB_SPACE);
}
}
else if (c == 32) {
arr.push(SPACE);
} else if((c > 39 && c < 48) || (c > 57 && c < 64)) {
arr.push(PUNCTUATION);
}
else if (c >= 0x1100 && isFullWidth(c)) {
arr.push(CHAR, CHAR_EXT);
} else {
arr.push(CHAR);
}
}
return arr;
};
this.$getStringScreenWidth = function(str, maxScreenColumn, screenColumn) {
if (maxScreenColumn == 0)
return [0, 0];
if (maxScreenColumn == null)
maxScreenColumn = Infinity;
screenColumn = screenColumn || 0;
var c, column;
for (column = 0; column < str.length; column++) {
c = str.charCodeAt(column);
if (c == 9) {
screenColumn += this.getScreenTabSize(screenColumn);
}
else if (c >= 0x1100 && isFullWidth(c)) {
screenColumn += 2;
} else {
screenColumn += 1;
}
if (screenColumn > maxScreenColumn) {
break;
}
}
return [screenColumn, column];
};
this.lineWidgets = null;
this.getRowLength = function(row) {
if (this.lineWidgets)
var h = this.lineWidgets[row] && this.lineWidgets[row].rowCount || 0;
else
h = 0
if (!this.$useWrapMode || !this.$wrapData[row]) {
return 1 + h;
} else {
return this.$wrapData[row].length + 1 + h;
}
};
this.getRowLineCount = function(row) {
if (!this.$useWrapMode || !this.$wrapData[row]) {
return 1;
} else {
return this.$wrapData[row].length + 1;
}
};
this.getRowWrapIndent = function(screenRow) {
if (this.$useWrapMode) {
var pos = this.screenToDocumentPosition(screenRow, Number.MAX_VALUE);
var splits = this.$wrapData[pos.row];
return splits.length && splits[0] < pos.column ? splits.indent : 0;
} else {
return 0;
}
}
this.getScreenLastRowColumn = function(screenRow) {
var pos = this.screenToDocumentPosition(screenRow, Number.MAX_VALUE);
return this.documentToScreenColumn(pos.row, pos.column);
};
this.getDocumentLastRowColumn = function(docRow, docColumn) {
var screenRow = this.documentToScreenRow(docRow, docColumn);
return this.getScreenLastRowColumn(screenRow);
};
this.getDocumentLastRowColumnPosition = function(docRow, docColumn) {
var screenRow = this.documentToScreenRow(docRow, docColumn);
return this.screenToDocumentPosition(screenRow, Number.MAX_VALUE / 10);
};
this.getRowSplitData = function(row) {
if (!this.$useWrapMode) {
return undefined;
} else {
return this.$wrapData[row];
}
};
this.getScreenTabSize = function(screenColumn) {
return this.$tabSize - screenColumn % this.$tabSize;
};
this.screenToDocumentRow = function(screenRow, screenColumn) {
return this.screenToDocumentPosition(screenRow, screenColumn).row;
};
this.screenToDocumentColumn = function(screenRow, screenColumn) {
return this.screenToDocumentPosition(screenRow, screenColumn).column;
};
this.screenToDocumentPosition = function(screenRow, screenColumn) {
if (screenRow < 0)
return {row: 0, column: 0};
var line;
var docRow = 0;
var docColumn = 0;
var column;
var row = 0;
var rowLength = 0;
var rowCache = this.$screenRowCache;
var i = this.$getRowCacheIndex(rowCache, screenRow);
var l = rowCache.length;
if (l && i >= 0) {
var row = rowCache[i];
var docRow = this.$docRowCache[i];
var doCache = screenRow > rowCache[l - 1];
} else {
var doCache = !l;
}
var maxRow = this.getLength() - 1;
var foldLine = this.getNextFoldLine(docRow);
var foldStart = foldLine ? foldLine.start.row : Infinity;
while (row <= screenRow) {
rowLength = this.getRowLength(docRow);
if (row + rowLength > screenRow || docRow >= maxRow) {
break;
} else {
row += rowLength;
docRow++;
if (docRow > foldStart) {
docRow = foldLine.end.row+1;
foldLine = this.getNextFoldLine(docRow, foldLine);
foldStart = foldLine ? foldLine.start.row : Infinity;
}
}
if (doCache) {
this.$docRowCache.push(docRow);
this.$screenRowCache.push(row);
}
}
if (foldLine && foldLine.start.row <= docRow) {
line = this.getFoldDisplayLine(foldLine);
docRow = foldLine.start.row;
} else if (row + rowLength <= screenRow || docRow > maxRow) {
return {
row: maxRow,
column: this.getLine(maxRow).length
};
} else {
line = this.getLine(docRow);
foldLine = null;
}
var wrapIndent = 0;
if (this.$useWrapMode) {
var splits = this.$wrapData[docRow];
if (splits) {
var splitIndex = Math.floor(screenRow - row);
column = splits[splitIndex];
if(splitIndex > 0 && splits.length) {
wrapIndent = splits.indent;
docColumn = splits[splitIndex - 1] || splits[splits.length - 1];
line = line.substring(docColumn);
}
}
}
docColumn += this.$getStringScreenWidth(line, screenColumn - wrapIndent)[1];
if (this.$useWrapMode && docColumn >= column)
docColumn = column - 1;
if (foldLine)
return foldLine.idxToPosition(docColumn);
return {row: docRow, column: docColumn};
};
this.documentToScreenPosition = function(docRow, docColumn) {
if (typeof docColumn === "undefined")
var pos = this.$clipPositionToDocument(docRow.row, docRow.column);
else
pos = this.$clipPositionToDocument(docRow, docColumn);
docRow = pos.row;
docColumn = pos.column;
var screenRow = 0;
var foldStartRow = null;
var fold = null;
fold = this.getFoldAt(docRow, docColumn, 1);
if (fold) {
docRow = fold.start.row;
docColumn = fold.start.column;
}
var rowEnd, row = 0;
var rowCache = this.$docRowCache;
var i = this.$getRowCacheIndex(rowCache, docRow);
var l = rowCache.length;
if (l && i >= 0) {
var row = rowCache[i];
var screenRow = this.$screenRowCache[i];
var doCache = docRow > rowCache[l - 1];
} else {
var doCache = !l;
}
var foldLine = this.getNextFoldLine(row);
var foldStart = foldLine ?foldLine.start.row :Infinity;
while (row < docRow) {
if (row >= foldStart) {
rowEnd = foldLine.end.row + 1;
if (rowEnd > docRow)
break;
foldLine = this.getNextFoldLine(rowEnd, foldLine);
foldStart = foldLine ?foldLine.start.row :Infinity;
}
else {
rowEnd = row + 1;
}
screenRow += this.getRowLength(row);
row = rowEnd;
if (doCache) {
this.$docRowCache.push(row);
this.$screenRowCache.push(screenRow);
}
}
var textLine = "";
if (foldLine && row >= foldStart) {
textLine = this.getFoldDisplayLine(foldLine, docRow, docColumn);
foldStartRow = foldLine.start.row;
} else {
textLine = this.getLine(docRow).substring(0, docColumn);
foldStartRow = docRow;
}
var wrapIndent = 0;
if (this.$useWrapMode) {
var wrapRow = this.$wrapData[foldStartRow];
if (wrapRow) {
var screenRowOffset = 0;
while (textLine.length >= wrapRow[screenRowOffset]) {
screenRow ++;
screenRowOffset++;
}
textLine = textLine.substring(
wrapRow[screenRowOffset - 1] || 0, textLine.length
);
wrapIndent = screenRowOffset > 0 ? wrapRow.indent : 0;
}
}
return {
row: screenRow,
column: wrapIndent + this.$getStringScreenWidth(textLine)[0]
};
};
this.documentToScreenColumn = function(row, docColumn) {
return this.documentToScreenPosition(row, docColumn).column;
};
this.documentToScreenRow = function(docRow, docColumn) {
return this.documentToScreenPosition(docRow, docColumn).row;
};
this.getScreenLength = function() {
var screenRows = 0;
var fold = null;
if (!this.$useWrapMode) {
screenRows = this.getLength();
var foldData = this.$foldData;
for (var i = 0; i < foldData.length; i++) {
fold = foldData[i];
screenRows -= fold.end.row - fold.start.row;
}
} else {
var lastRow = this.$wrapData.length;
var row = 0, i = 0;
var fold = this.$foldData[i++];
var foldStart = fold ? fold.start.row :Infinity;
while (row < lastRow) {
var splits = this.$wrapData[row];
screenRows += splits ? splits.length + 1 : 1;
row ++;
if (row > foldStart) {
row = fold.end.row+1;
fold = this.$foldData[i++];
foldStart = fold ?fold.start.row :Infinity;
}
}
}
if (this.lineWidgets)
screenRows += this.$getWidgetScreenLength();
return screenRows;
};
this.$setFontMetrics = function(fm) {
if (!this.$enableVarChar) return;
this.$getStringScreenWidth = function(str, maxScreenColumn, screenColumn) {
if (maxScreenColumn === 0)
return [0, 0];
if (!maxScreenColumn)
maxScreenColumn = Infinity;
screenColumn = screenColumn || 0;
var c, column;
for (column = 0; column < str.length; column++) {
c = str.charAt(column);
if (c === "\t") {
screenColumn += this.getScreenTabSize(screenColumn);
} else {
screenColumn += fm.getCharacterWidth(c);
}
if (screenColumn > maxScreenColumn) {
break;
}
}
return [screenColumn, column];
};
};
this.destroy = function() {
if (this.bgTokenizer) {
this.bgTokenizer.setDocument(null);
this.bgTokenizer = null;
}
this.$stopWorker();
};
function isFullWidth(c) {
if (c < 0x1100)
return false;
return c >= 0x1100 && c <= 0x115F ||
c >= 0x11A3 && c <= 0x11A7 ||
c >= 0x11FA && c <= 0x11FF ||
c >= 0x2329 && c <= 0x232A ||
c >= 0x2E80 && c <= 0x2E99 ||
c >= 0x2E9B && c <= 0x2EF3 ||
c >= 0x2F00 && c <= 0x2FD5 ||
c >= 0x2FF0 && c <= 0x2FFB ||
c >= 0x3000 && c <= 0x303E ||
c >= 0x3041 && c <= 0x3096 ||
c >= 0x3099 && c <= 0x30FF ||
c >= 0x3105 && c <= 0x312D ||
c >= 0x3131 && c <= 0x318E ||
c >= 0x3190 && c <= 0x31BA ||
c >= 0x31C0 && c <= 0x31E3 ||
c >= 0x31F0 && c <= 0x321E ||
c >= 0x3220 && c <= 0x3247 ||
c >= 0x3250 && c <= 0x32FE ||
c >= 0x3300 && c <= 0x4DBF ||
c >= 0x4E00 && c <= 0xA48C ||
c >= 0xA490 && c <= 0xA4C6 ||
c >= 0xA960 && c <= 0xA97C ||
c >= 0xAC00 && c <= 0xD7A3 ||
c >= 0xD7B0 && c <= 0xD7C6 ||
c >= 0xD7CB && c <= 0xD7FB ||
c >= 0xF900 && c <= 0xFAFF ||
c >= 0xFE10 && c <= 0xFE19 ||
c >= 0xFE30 && c <= 0xFE52 ||
c >= 0xFE54 && c <= 0xFE66 ||
c >= 0xFE68 && c <= 0xFE6B ||
c >= 0xFF01 && c <= 0xFF60 ||
c >= 0xFFE0 && c <= 0xFFE6;
}
}).call(EditSession.prototype);
acequire("./edit_session/folding").Folding.call(EditSession.prototype);
acequire("./edit_session/bracket_match").BracketMatch.call(EditSession.prototype);
config.defineOptions(EditSession.prototype, "session", {
wrap: {
set: function(value) {
if (!value || value == "off")
value = false;
else if (value == "free")
value = true;
else if (value == "printMargin")
value = -1;
else if (typeof value == "string")
value = parseInt(value, 10) || false;
if (this.$wrap == value)
return;
this.$wrap = value;
if (!value) {
this.setUseWrapMode(false);
} else {
var col = typeof value == "number" ? value : null;
this.setWrapLimitRange(col, col);
this.setUseWrapMode(true);
}
},
get: function() {
if (this.getUseWrapMode()) {
if (this.$wrap == -1)
return "printMargin";
if (!this.getWrapLimitRange().min)
return "free";
return this.$wrap;
}
return "off";
},
handlesSet: true
},
wrapMethod: {
set: function(val) {
val = val == "auto"
? this.$mode.type != "text"
: val != "text";
if (val != this.$wrapAsCode) {
this.$wrapAsCode = val;
if (this.$useWrapMode) {
this.$modified = true;
this.$resetRowCache(0);
this.$updateWrapData(0, this.getLength() - 1);
}
}
},
initialValue: "auto"
},
indentedSoftWrap: { initialValue: true },
firstLineNumber: {
set: function() {this._signal("changeBreakpoint");},
initialValue: 1
},
useWorker: {
set: function(useWorker) {
this.$useWorker = useWorker;
this.$stopWorker();
if (useWorker)
this.$startWorker();
},
initialValue: true
},
useSoftTabs: {initialValue: true},
tabSize: {
set: function(tabSize) {
if (isNaN(tabSize) || this.$tabSize === tabSize) return;
this.$modified = true;
this.$rowLengthCache = [];
this.$tabSize = tabSize;
this._signal("changeTabSize");
},
initialValue: 4,
handlesSet: true
},
overwrite: {
set: function(val) {this._signal("changeOverwrite");},
initialValue: false
},
newLineMode: {
set: function(val) {this.doc.setNewLineMode(val)},
get: function() {return this.doc.getNewLineMode()},
handlesSet: true
},
mode: {
set: function(val) { this.setMode(val) },
get: function() { return this.$modeId }
}
});
exports.EditSession = EditSession;
});
ace.define("ace/search",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"], function(acequire, exports, module) {
"use strict";
var lang = acequire("./lib/lang");
var oop = acequire("./lib/oop");
var Range = acequire("./range").Range;
var Search = function() {
this.$options = {};
};
(function() {
this.set = function(options) {
oop.mixin(this.$options, options);
return this;
};
this.getOptions = function() {
return lang.copyObject(this.$options);
};
this.setOptions = function(options) {
this.$options = options;
};
this.find = function(session) {
var options = this.$options;
var iterator = this.$matchIterator(session, options);
if (!iterator)
return false;
var firstRange = null;
iterator.forEach(function(range, row, offset) {
if (!range.start) {
var column = range.offset + (offset || 0);
firstRange = new Range(row, column, row, column + range.length);
if (!range.length && options.start && options.start.start
&& options.skipCurrent != false && firstRange.isEqual(options.start)
) {
firstRange = null;
return false;
}
} else
firstRange = range;
return true;
});
return firstRange;
};
this.findAll = function(session) {
var options = this.$options;
if (!options.needle)
return [];
this.$assembleRegExp(options);
var range = options.range;
var lines = range
? session.getLines(range.start.row, range.end.row)
: session.doc.getAllLines();
var ranges = [];
var re = options.re;
if (options.$isMultiLine) {
var len = re.length;
var maxRow = lines.length - len;
var prevRange;
outer: for (var row = re.offset || 0; row <= maxRow; row++) {
for (var j = 0; j < len; j++)
if (lines[row + j].search(re[j]) == -1)
continue outer;
var startLine = lines[row];
var line = lines[row + len - 1];
var startIndex = startLine.length - startLine.match(re[0])[0].length;
var endIndex = line.match(re[len - 1])[0].length;
if (prevRange && prevRange.end.row === row &&
prevRange.end.column > startIndex
) {
continue;
}
ranges.push(prevRange = new Range(
row, startIndex, row + len - 1, endIndex
));
if (len > 2)
row = row + len - 2;
}
} else {
for (var i = 0; i < lines.length; i++) {
var matches = lang.getMatchOffsets(lines[i], re);
for (var j = 0; j < matches.length; j++) {
var match = matches[j];
ranges.push(new Range(i, match.offset, i, match.offset + match.length));
}
}
}
if (range) {
var startColumn = range.start.column;
var endColumn = range.start.column;
var i = 0, j = ranges.length - 1;
while (i < j && ranges[i].start.column < startColumn && ranges[i].start.row == range.start.row)
i++;
while (i < j && ranges[j].end.column > endColumn && ranges[j].end.row == range.end.row)
j--;
ranges = ranges.slice(i, j + 1);
for (i = 0, j = ranges.length; i < j; i++) {
ranges[i].start.row += range.start.row;
ranges[i].end.row += range.start.row;
}
}
return ranges;
};
this.replace = function(input, replacement) {
var options = this.$options;
var re = this.$assembleRegExp(options);
if (options.$isMultiLine)
return replacement;
if (!re)
return;
var match = re.exec(input);
if (!match || match[0].length != input.length)
return null;
replacement = input.replace(re, replacement);
if (options.preserveCase) {
replacement = replacement.split("");
for (var i = Math.min(input.length, input.length); i--; ) {
var ch = input[i];
if (ch && ch.toLowerCase() != ch)
replacement[i] = replacement[i].toUpperCase();
else
replacement[i] = replacement[i].toLowerCase();
}
replacement = replacement.join("");
}
return replacement;
};
this.$matchIterator = function(session, options) {
var re = this.$assembleRegExp(options);
if (!re)
return false;
var callback;
if (options.$isMultiLine) {
var len = re.length;
var matchIterator = function(line, row, offset) {
var startIndex = line.search(re[0]);
if (startIndex == -1)
return;
for (var i = 1; i < len; i++) {
line = session.getLine(row + i);
if (line.search(re[i]) == -1)
return;
}
var endIndex = line.match(re[len - 1])[0].length;
var range = new Range(row, startIndex, row + len - 1, endIndex);
if (re.offset == 1) {
range.start.row--;
range.start.column = Number.MAX_VALUE;
} else if (offset)
range.start.column += offset;
if (callback(range))
return true;
};
} else if (options.backwards) {
var matchIterator = function(line, row, startIndex) {
var matches = lang.getMatchOffsets(line, re);
for (var i = matches.length-1; i >= 0; i--)
if (callback(matches[i], row, startIndex))
return true;
};
} else {
var matchIterator = function(line, row, startIndex) {
var matches = lang.getMatchOffsets(line, re);
for (var i = 0; i < matches.length; i++)
if (callback(matches[i], row, startIndex))
return true;
};
}
var lineIterator = this.$lineIterator(session, options);
return {
forEach: function(_callback) {
callback = _callback;
lineIterator.forEach(matchIterator);
}
};
};
this.$assembleRegExp = function(options, $disableFakeMultiline) {
if (options.needle instanceof RegExp)
return options.re = options.needle;
var needle = options.needle;
if (!options.needle)
return options.re = false;
if (!options.regExp)
needle = lang.escapeRegExp(needle);
if (options.wholeWord)
needle = addWordBoundary(needle, options);
var modifier = options.caseSensitive ? "gm" : "gmi";
options.$isMultiLine = !$disableFakeMultiline && /[\n\r]/.test(needle);
if (options.$isMultiLine)
return options.re = this.$assembleMultilineRegExp(needle, modifier);
try {
var re = new RegExp(needle, modifier);
} catch(e) {
re = false;
}
return options.re = re;
};
this.$assembleMultilineRegExp = function(needle, modifier) {
var parts = needle.replace(/\r\n|\r|\n/g, "$\n^").split("\n");
var re = [];
for (var i = 0; i < parts.length; i++) try {
re.push(new RegExp(parts[i], modifier));
} catch(e) {
return false;
}
if (parts[0] == "") {
re.shift();
re.offset = 1;
} else {
re.offset = 0;
}
return re;
};
this.$lineIterator = function(session, options) {
var backwards = options.backwards == true;
var skipCurrent = options.skipCurrent != false;
var range = options.range;
var start = options.start;
if (!start)
start = range ? range[backwards ? "end" : "start"] : session.selection.getRange();
if (start.start)
start = start[skipCurrent != backwards ? "end" : "start"];
var firstRow = range ? range.start.row : 0;
var lastRow = range ? range.end.row : session.getLength() - 1;
var forEach = backwards ? function(callback) {
var row = start.row;
var line = session.getLine(row).substring(0, start.column);
if (callback(line, row))
return;
for (row--; row >= firstRow; row--)
if (callback(session.getLine(row), row))
return;
if (options.wrap == false)
return;
for (row = lastRow, firstRow = start.row; row >= firstRow; row--)
if (callback(session.getLine(row), row))
return;
} : function(callback) {
var row = start.row;
var line = session.getLine(row).substr(start.column);
if (callback(line, row, start.column))
return;
for (row = row+1; row <= lastRow; row++)
if (callback(session.getLine(row), row))
return;
if (options.wrap == false)
return;
for (row = firstRow, lastRow = start.row; row <= lastRow; row++)
if (callback(session.getLine(row), row))
return;
};
return {forEach: forEach};
};
}).call(Search.prototype);
function addWordBoundary(needle, options) {
function wordBoundary(c) {
if (/\w/.test(c) || options.regExp) return "\\b";
return "";
}
return wordBoundary(needle[0]) + needle
+ wordBoundary(needle[needle.length - 1]);
}
exports.Search = Search;
});
ace.define("ace/keyboard/hash_handler",["require","exports","module","ace/lib/keys","ace/lib/useragent"], function(acequire, exports, module) {
"use strict";
var keyUtil = acequire("../lib/keys");
var useragent = acequire("../lib/useragent");
var KEY_MODS = keyUtil.KEY_MODS;
function HashHandler(config, platform) {
this.platform = platform || (useragent.isMac ? "mac" : "win");
this.commands = {};
this.commandKeyBinding = {};
this.addCommands(config);
this.$singleCommand = true;
}
function MultiHashHandler(config, platform) {
HashHandler.call(this, config, platform);
this.$singleCommand = false;
}
MultiHashHandler.prototype = HashHandler.prototype;
(function() {
this.addCommand = function(command) {
if (this.commands[command.name])
this.removeCommand(command);
this.commands[command.name] = command;
if (command.bindKey)
this._buildKeyHash(command);
};
this.removeCommand = function(command, keepCommand) {
var name = command && (typeof command === 'string' ? command : command.name);
command = this.commands[name];
if (!keepCommand)
delete this.commands[name];
var ckb = this.commandKeyBinding;
for (var keyId in ckb) {
var cmdGroup = ckb[keyId];
if (cmdGroup == command) {
delete ckb[keyId];
} else if (Array.isArray(cmdGroup)) {
var i = cmdGroup.indexOf(command);
if (i != -1) {
cmdGroup.splice(i, 1);
if (cmdGroup.length == 1)
ckb[keyId] = cmdGroup[0];
}
}
}
};
this.bindKey = function(key, command, position) {
if (typeof key == "object" && key) {
if (position == undefined)
position = key.position;
key = key[this.platform];
}
if (!key)
return;
if (typeof command == "function")
return this.addCommand({exec: command, bindKey: key, name: command.name || key});
key.split("|").forEach(function(keyPart) {
var chain = "";
if (keyPart.indexOf(" ") != -1) {
var parts = keyPart.split(/\s+/);
keyPart = parts.pop();
parts.forEach(function(keyPart) {
var binding = this.parseKeys(keyPart);
var id = KEY_MODS[binding.hashId] + binding.key;
chain += (chain ? " " : "") + id;
this._addCommandToBinding(chain, "chainKeys");
}, this);
chain += " ";
}
var binding = this.parseKeys(keyPart);
var id = KEY_MODS[binding.hashId] + binding.key;
this._addCommandToBinding(chain + id, command, position);
}, this);
};
function getPosition(command) {
return typeof command == "object" && command.bindKey
&& command.bindKey.position || 0;
}
this._addCommandToBinding = function(keyId, command, position) {
var ckb = this.commandKeyBinding, i;
if (!command) {
delete ckb[keyId];
} else if (!ckb[keyId] || this.$singleCommand) {
ckb[keyId] = command;
} else {
if (!Array.isArray(ckb[keyId])) {
ckb[keyId] = [ckb[keyId]];
} else if ((i = ckb[keyId].indexOf(command)) != -1) {
ckb[keyId].splice(i, 1);
}
if (typeof position != "number") {
if (position || command.isDefault)
position = -100;
else
position = getPosition(command);
}
var commands = ckb[keyId];
for (i = 0; i < commands.length; i++) {
var other = commands[i];
var otherPos = getPosition(other);
if (otherPos > position)
break;
}
commands.splice(i, 0, command);
}
};
this.addCommands = function(commands) {
commands && Object.keys(commands).forEach(function(name) {
var command = commands[name];
if (!command)
return;
if (typeof command === "string")
return this.bindKey(command, name);
if (typeof command === "function")
command = { exec: command };
if (typeof command !== "object")
return;
if (!command.name)
command.name = name;
this.addCommand(command);
}, this);
};
this.removeCommands = function(commands) {
Object.keys(commands).forEach(function(name) {
this.removeCommand(commands[name]);
}, this);
};
this.bindKeys = function(keyList) {
Object.keys(keyList).forEach(function(key) {
this.bindKey(key, keyList[key]);
}, this);
};
this._buildKeyHash = function(command) {
this.bindKey(command.bindKey, command);
};
this.parseKeys = function(keys) {
var parts = keys.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(x){return x});
var key = parts.pop();
var keyCode = keyUtil[key];
if (keyUtil.FUNCTION_KEYS[keyCode])
key = keyUtil.FUNCTION_KEYS[keyCode].toLowerCase();
else if (!parts.length)
return {key: key, hashId: -1};
else if (parts.length == 1 && parts[0] == "shift")
return {key: key.toUpperCase(), hashId: -1};
var hashId = 0;
for (var i = parts.length; i--;) {
var modifier = keyUtil.KEY_MODS[parts[i]];
if (modifier == null) {
if (typeof console != "undefined")
console.error("invalid modifier " + parts[i] + " in " + keys);
return false;
}
hashId |= modifier;
}
return {key: key, hashId: hashId};
};
this.findKeyCommand = function findKeyCommand(hashId, keyString) {
var key = KEY_MODS[hashId] + keyString;
return this.commandKeyBinding[key];
};
this.handleKeyboard = function(data, hashId, keyString, keyCode) {
if (keyCode < 0) return;
var key = KEY_MODS[hashId] + keyString;
var command = this.commandKeyBinding[key];
if (data.$keyChain) {
data.$keyChain += " " + key;
command = this.commandKeyBinding[data.$keyChain] || command;
}
if (command) {
if (command == "chainKeys" || command[command.length - 1] == "chainKeys") {
data.$keyChain = data.$keyChain || key;
return {command: "null"};
}
}
if (data.$keyChain) {
if ((!hashId || hashId == 4) && keyString.length == 1)
data.$keyChain = data.$keyChain.slice(0, -key.length - 1); // wait for input
else if (hashId == -1 || keyCode > 0)
data.$keyChain = ""; // reset keyChain
}
return {command: command};
};
this.getStatusText = function(editor, data) {
return data.$keyChain || "";
};
}).call(HashHandler.prototype);
exports.HashHandler = HashHandler;
exports.MultiHashHandler = MultiHashHandler;
});
ace.define("ace/commands/command_manager",["require","exports","module","ace/lib/oop","ace/keyboard/hash_handler","ace/lib/event_emitter"], function(acequire, exports, module) {
"use strict";
var oop = acequire("../lib/oop");
var MultiHashHandler = acequire("../keyboard/hash_handler").MultiHashHandler;
var EventEmitter = acequire("../lib/event_emitter").EventEmitter;
var CommandManager = function(platform, commands) {
MultiHashHandler.call(this, commands, platform);
this.byName = this.commands;
this.setDefaultHandler("exec", function(e) {
return e.command.exec(e.editor, e.args || {});
});
};
oop.inherits(CommandManager, MultiHashHandler);
(function() {
oop.implement(this, EventEmitter);
this.exec = function(command, editor, args) {
if (Array.isArray(command)) {
for (var i = command.length; i--; ) {
if (this.exec(command[i], editor, args)) return true;
}
return false;
}
if (typeof command === "string")
command = this.commands[command];
if (!command)
return false;
if (editor && editor.$readOnly && !command.readOnly)
return false;
var e = {editor: editor, command: command, args: args};
e.returnValue = this._emit("exec", e);
this._signal("afterExec", e);
return e.returnValue === false ? false : true;
};
this.toggleRecording = function(editor) {
if (this.$inReplay)
return;
editor && editor._emit("changeStatus");
if (this.recording) {
this.macro.pop();
this.removeEventListener("exec", this.$addCommandToMacro);
if (!this.macro.length)
this.macro = this.oldMacro;
return this.recording = false;
}
if (!this.$addCommandToMacro) {
this.$addCommandToMacro = function(e) {
this.macro.push([e.command, e.args]);
}.bind(this);
}
this.oldMacro = this.macro;
this.macro = [];
this.on("exec", this.$addCommandToMacro);
return this.recording = true;
};
this.replay = function(editor) {
if (this.$inReplay || !this.macro)
return;
if (this.recording)
return this.toggleRecording(editor);
try {
this.$inReplay = true;
this.macro.forEach(function(x) {
if (typeof x == "string")
this.exec(x, editor);
else
this.exec(x[0], editor, x[1]);
}, this);
} finally {
this.$inReplay = false;
}
};
this.trimMacro = function(m) {
return m.map(function(x){
if (typeof x[0] != "string")
x[0] = x[0].name;
if (!x[1])
x = x[0];
return x;
});
};
}).call(CommandManager.prototype);
exports.CommandManager = CommandManager;
});
ace.define("ace/commands/default_commands",["require","exports","module","ace/lib/lang","ace/config","ace/range"], function(acequire, exports, module) {
"use strict";
var lang = acequire("../lib/lang");
var config = acequire("../config");
var Range = acequire("../range").Range;
function bindKey(win, mac) {
return {win: win, mac: mac};
}
exports.commands = [{
name: "showSettingsMenu",
bindKey: bindKey("Ctrl-,", "Command-,"),
exec: function(editor) {
config.loadModule("ace/ext/settings_menu", function(module) {
module.init(editor);
editor.showSettingsMenu();
});
},
readOnly: true
}, {
name: "goToNextError",
bindKey: bindKey("Alt-E", "F4"),
exec: function(editor) {
config.loadModule("ace/ext/error_marker", function(module) {
module.showErrorMarker(editor, 1);
});
},
scrollIntoView: "animate",
readOnly: true
}, {
name: "goToPreviousError",
bindKey: bindKey("Alt-Shift-E", "Shift-F4"),
exec: function(editor) {
config.loadModule("ace/ext/error_marker", function(module) {
module.showErrorMarker(editor, -1);
});
},
scrollIntoView: "animate",
readOnly: true
}, {
name: "selectall",
bindKey: bindKey("Ctrl-A", "Command-A"),
exec: function(editor) { editor.selectAll(); },
readOnly: true
}, {
name: "centerselection",
bindKey: bindKey(null, "Ctrl-L"),
exec: function(editor) { editor.centerSelection(); },
readOnly: true
}, {
name: "gotoline",
bindKey: bindKey("Ctrl-L", "Command-L"),
exec: function(editor) {
var line = parseInt(prompt("Enter line number:"), 10);
if (!isNaN(line)) {
editor.gotoLine(line);
}
},
readOnly: true
}, {
name: "fold",
bindKey: bindKey("Alt-L|Ctrl-F1", "Command-Alt-L|Command-F1"),
exec: function(editor) { editor.session.toggleFold(false); },
multiSelectAction: "forEach",
scrollIntoView: "center",
readOnly: true
}, {
name: "unfold",
bindKey: bindKey("Alt-Shift-L|Ctrl-Shift-F1", "Command-Alt-Shift-L|Command-Shift-F1"),
exec: function(editor) { editor.session.toggleFold(true); },
multiSelectAction: "forEach",
scrollIntoView: "center",
readOnly: true
}, {
name: "toggleFoldWidget",
bindKey: bindKey("F2", "F2"),
exec: function(editor) { editor.session.toggleFoldWidget(); },
multiSelectAction: "forEach",
scrollIntoView: "center",
readOnly: true
}, {
name: "toggleParentFoldWidget",
bindKey: bindKey("Alt-F2", "Alt-F2"),
exec: function(editor) { editor.session.toggleFoldWidget(true); },
multiSelectAction: "forEach",
scrollIntoView: "center",
readOnly: true
}, {
name: "foldall",
bindKey: bindKey(null, "Ctrl-Command-Option-0"),
exec: function(editor) { editor.session.foldAll(); },
scrollIntoView: "center",
readOnly: true
}, {
name: "foldOther",
bindKey: bindKey("Alt-0", "Command-Option-0"),
exec: function(editor) {
editor.session.foldAll();
editor.session.unfold(editor.selection.getAllRanges());
},
scrollIntoView: "center",
readOnly: true
}, {
name: "unfoldall",
bindKey: bindKey("Alt-Shift-0", "Command-Option-Shift-0"),
exec: function(editor) { editor.session.unfold(); },
scrollIntoView: "center",
readOnly: true
}, {
name: "findnext",
bindKey: bindKey("Ctrl-K", "Command-G"),
exec: function(editor) { editor.findNext(); },
multiSelectAction: "forEach",
scrollIntoView: "center",
readOnly: true
}, {
name: "findprevious",
bindKey: bindKey("Ctrl-Shift-K", "Command-Shift-G"),
exec: function(editor) { editor.findPrevious(); },
multiSelectAction: "forEach",
scrollIntoView: "center",
readOnly: true
}, {
name: "selectOrFindNext",
bindKey: bindKey("Alt-K", "Ctrl-G"),
exec: function(editor) {
if (editor.selection.isEmpty())
editor.selection.selectWord();
else
editor.findNext();
},
readOnly: true
}, {
name: "selectOrFindPrevious",
bindKey: bindKey("Alt-Shift-K", "Ctrl-Shift-G"),
exec: function(editor) {
if (editor.selection.isEmpty())
editor.selection.selectWord();
else
editor.findPrevious();
},
readOnly: true
}, {
name: "find",
bindKey: bindKey("Ctrl-F", "Command-F"),
exec: function(editor) {
config.loadModule("ace/ext/searchbox", function(e) {e.Search(editor)});
},
readOnly: true
}, {
name: "overwrite",
bindKey: "Insert",
exec: function(editor) { editor.toggleOverwrite(); },
readOnly: true
}, {
name: "selecttostart",
bindKey: bindKey("Ctrl-Shift-Home", "Command-Shift-Home|Command-Shift-Up"),
exec: function(editor) { editor.getSelection().selectFileStart(); },
multiSelectAction: "forEach",
readOnly: true,
scrollIntoView: "animate",
aceCommandGroup: "fileJump"
}, {
name: "gotostart",
bindKey: bindKey("Ctrl-Home", "Command-Home|Command-Up"),
exec: function(editor) { editor.navigateFileStart(); },
multiSelectAction: "forEach",
readOnly: true,
scrollIntoView: "animate",
aceCommandGroup: "fileJump"
}, {
name: "selectup",
bindKey: bindKey("Shift-Up", "Shift-Up|Ctrl-Shift-P"),
exec: function(editor) { editor.getSelection().selectUp(); },
multiSelectAction: "forEach",
scrollIntoView: "cursor",
readOnly: true
}, {
name: "golineup",
bindKey: bindKey("Up", "Up|Ctrl-P"),
exec: function(editor, args) { editor.navigateUp(args.times); },
multiSelectAction: "forEach",
scrollIntoView: "cursor",
readOnly: true
}, {
name: "selecttoend",
bindKey: bindKey("Ctrl-Shift-End", "Command-Shift-End|Command-Shift-Down"),
exec: function(editor) { editor.getSelection().selectFileEnd(); },
multiSelectAction: "forEach",
readOnly: true,
scrollIntoView: "animate",
aceCommandGroup: "fileJump"
}, {
name: "gotoend",
bindKey: bindKey("Ctrl-End", "Command-End|Command-Down"),
exec: function(editor) { editor.navigateFileEnd(); },
multiSelectAction: "forEach",
readOnly: true,
scrollIntoView: "animate",
aceCommandGroup: "fileJump"
}, {
name: "selectdown",
bindKey: bindKey("Shift-Down", "Shift-Down|Ctrl-Shift-N"),
exec: function(editor) { editor.getSelection().selectDown(); },
multiSelectAction: "forEach",
scrollIntoView: "cursor",
readOnly: true
}, {
name: "golinedown",
bindKey: bindKey("Down", "Down|Ctrl-N"),
exec: function(editor, args) { editor.navigateDown(args.times); },
multiSelectAction: "forEach",
scrollIntoView: "cursor",
readOnly: true
}, {
name: "selectwordleft",
bindKey: bindKey("Ctrl-Shift-Left", "Option-Shift-Left"),
exec: function(editor) { editor.getSelection().selectWordLeft(); },
multiSelectAction: "forEach",
scrollIntoView: "cursor",
readOnly: true
}, {
name: "gotowordleft",
bindKey: bindKey("Ctrl-Left", "Option-Left"),
exec: function(editor) { editor.navigateWordLeft(); },
multiSelectAction: "forEach",
scrollIntoView: "cursor",
readOnly: true
}, {
name: "selecttolinestart",
bindKey: bindKey("Alt-Shift-Left", "Command-Shift-Left|Ctrl-Shift-A"),
exec: function(editor) { editor.getSelection().selectLineStart(); },
multiSelectAction: "forEach",
scrollIntoView: "cursor",
readOnly: true
}, {
name: "gotolinestart",
bindKey: bindKey("Alt-Left|Home", "Command-Left|Home|Ctrl-A"),
exec: function(editor) { editor.navigateLineStart(); },
multiSelectAction: "forEach",
scrollIntoView: "cursor",
readOnly: true
}, {
name: "selectleft",
bindKey: bindKey("Shift-Left", "Shift-Left|Ctrl-Shift-B"),
exec: function(editor) { editor.getSelection().selectLeft(); },
multiSelectAction: "forEach",
scrollIntoView: "cursor",
readOnly: true
}, {
name: "gotoleft",
bindKey: bindKey("Left", "Left|Ctrl-B"),
exec: function(editor, args) { editor.navigateLeft(args.times); },
multiSelectAction: "forEach",
scrollIntoView: "cursor",
readOnly: true
}, {
name: "selectwordright",
bindKey: bindKey("Ctrl-Shift-Right", "Option-Shift-Right"),
exec: function(editor) { editor.getSelection().selectWordRight(); },
multiSelectAction: "forEach",
scrollIntoView: "cursor",
readOnly: true
}, {
name: "gotowordright",
bindKey: bindKey("Ctrl-Right", "Option-Right"),
exec: function(editor) { editor.navigateWordRight(); },
multiSelectAction: "forEach",
scrollIntoView: "cursor",
readOnly: true
}, {
name: "selecttolineend",
bindKey: bindKey("Alt-Shift-Right", "Command-Shift-Right|Shift-End|Ctrl-Shift-E"),
exec: function(editor) { editor.getSelection().selectLineEnd(); },
multiSelectAction: "forEach",
scrollIntoView: "cursor",
readOnly: true
}, {
name: "gotolineend",
bindKey: bindKey("Alt-Right|End", "Command-Right|End|Ctrl-E"),
exec: function(editor) { editor.navigateLineEnd(); },
multiSelectAction: "forEach",
scrollIntoView: "cursor",
readOnly: true
}, {
name: "selectright",
bindKey: bindKey("Shift-Right", "Shift-Right"),
exec: function(editor) { editor.getSelection().selectRight(); },
multiSelectAction: "forEach",
scrollIntoView: "cursor",
readOnly: true
}, {
name: "gotoright",
bindKey: bindKey("Right", "Right|Ctrl-F"),
exec: function(editor, args) { editor.navigateRight(args.times); },
multiSelectAction: "forEach",
scrollIntoView: "cursor",
readOnly: true
}, {
name: "selectpagedown",
bindKey: "Shift-PageDown",
exec: function(editor) { editor.selectPageDown(); },
readOnly: true
}, {
name: "pagedown",
bindKey: bindKey(null, "Option-PageDown"),
exec: function(editor) { editor.scrollPageDown(); },
readOnly: true
}, {
name: "gotopagedown",
bindKey: bindKey("PageDown", "PageDown|Ctrl-V"),
exec: function(editor) { editor.gotoPageDown(); },
readOnly: true
}, {
name: "selectpageup",
bindKey: "Shift-PageUp",
exec: function(editor) { editor.selectPageUp(); },
readOnly: true
}, {
name: "pageup",
bindKey: bindKey(null, "Option-PageUp"),
exec: function(editor) { editor.scrollPageUp(); },
readOnly: true
}, {
name: "gotopageup",
bindKey: "PageUp",
exec: function(editor) { editor.gotoPageUp(); },
readOnly: true
}, {
name: "scrollup",
bindKey: bindKey("Ctrl-Up", null),
exec: function(e) { e.renderer.scrollBy(0, -2 * e.renderer.layerConfig.lineHeight); },
readOnly: true
}, {
name: "scrolldown",
bindKey: bindKey("Ctrl-Down", null),
exec: function(e) { e.renderer.scrollBy(0, 2 * e.renderer.layerConfig.lineHeight); },
readOnly: true
}, {
name: "selectlinestart",
bindKey: "Shift-Home",
exec: function(editor) { editor.getSelection().selectLineStart(); },
multiSelectAction: "forEach",
scrollIntoView: "cursor",
readOnly: true
}, {
name: "selectlineend",
bindKey: "Shift-End",
exec: function(editor) { editor.getSelection().selectLineEnd(); },
multiSelectAction: "forEach",
scrollIntoView: "cursor",
readOnly: true
}, {
name: "togglerecording",
bindKey: bindKey("Ctrl-Alt-E", "Command-Option-E"),
exec: function(editor) { editor.commands.toggleRecording(editor); },
readOnly: true
}, {
name: "replaymacro",
bindKey: bindKey("Ctrl-Shift-E", "Command-Shift-E"),
exec: function(editor) { editor.commands.replay(editor); },
readOnly: true
}, {
name: "jumptomatching",
bindKey: bindKey("Ctrl-P", "Ctrl-P"),
exec: function(editor) { editor.jumpToMatching(); },
multiSelectAction: "forEach",
scrollIntoView: "animate",
readOnly: true
}, {
name: "selecttomatching",
bindKey: bindKey("Ctrl-Shift-P", "Ctrl-Shift-P"),
exec: function(editor) { editor.jumpToMatching(true); },
multiSelectAction: "forEach",
scrollIntoView: "animate",
readOnly: true
}, {
name: "expandToMatching",
bindKey: bindKey("Ctrl-Shift-M", "Ctrl-Shift-M"),
exec: function(editor) { editor.jumpToMatching(true, true); },
multiSelectAction: "forEach",
scrollIntoView: "animate",
readOnly: true
}, {
name: "passKeysToBrowser",
bindKey: bindKey(null, null),
exec: function() {},
passEvent: true,
readOnly: true
}, {
name: "copy",
exec: function(editor) {
},
readOnly: true
},
{
name: "cut",
exec: function(editor) {
var range = editor.getSelectionRange();
editor._emit("cut", range);
if (!editor.selection.isEmpty()) {
editor.session.remove(range);
editor.clearSelection();
}
},
scrollIntoView: "cursor",
multiSelectAction: "forEach"
}, {
name: "paste",
exec: function(editor, args) {
editor.$handlePaste(args);
},
scrollIntoView: "cursor"
}, {
name: "removeline",
bindKey: bindKey("Ctrl-D", "Command-D"),
exec: function(editor) { editor.removeLines(); },
scrollIntoView: "cursor",
multiSelectAction: "forEachLine"
}, {
name: "duplicateSelection",
bindKey: bindKey("Ctrl-Shift-D", "Command-Shift-D"),
exec: function(editor) { editor.duplicateSelection(); },
scrollIntoView: "cursor",
multiSelectAction: "forEach"
}, {
name: "sortlines",
bindKey: bindKey("Ctrl-Alt-S", "Command-Alt-S"),
exec: function(editor) { editor.sortLines(); },
scrollIntoView: "selection",
multiSelectAction: "forEachLine"
}, {
name: "togglecomment",
bindKey: bindKey("Ctrl-/", "Command-/"),
exec: function(editor) { editor.toggleCommentLines(); },
multiSelectAction: "forEachLine",
scrollIntoView: "selectionPart"
}, {
name: "toggleBlockComment",
bindKey: bindKey("Ctrl-Shift-/", "Command-Shift-/"),
exec: function(editor) { editor.toggleBlockComment(); },
multiSelectAction: "forEach",
scrollIntoView: "selectionPart"
}, {
name: "modifyNumberUp",
bindKey: bindKey("Ctrl-Shift-Up", "Alt-Shift-Up"),
exec: function(editor) { editor.modifyNumber(1); },
scrollIntoView: "cursor",
multiSelectAction: "forEach"
}, {
name: "modifyNumberDown",
bindKey: bindKey("Ctrl-Shift-Down", "Alt-Shift-Down"),
exec: function(editor) { editor.modifyNumber(-1); },
scrollIntoView: "cursor",
multiSelectAction: "forEach"
}, {
name: "replace",
bindKey: bindKey("Ctrl-H", "Command-Option-F"),
exec: function(editor) {
config.loadModule("ace/ext/searchbox", function(e) {e.Search(editor, true)});
}
}, {
name: "undo",
bindKey: bindKey("Ctrl-Z", "Command-Z"),
exec: function(editor) { editor.undo(); }
}, {
name: "redo",
bindKey: bindKey("Ctrl-Shift-Z|Ctrl-Y", "Command-Shift-Z|Command-Y"),
exec: function(editor) { editor.redo(); }
}, {
name: "copylinesup",
bindKey: bindKey("Alt-Shift-Up", "Command-Option-Up"),
exec: function(editor) { editor.copyLinesUp(); },
scrollIntoView: "cursor"
}, {
name: "movelinesup",
bindKey: bindKey("Alt-Up", "Option-Up"),
exec: function(editor) { editor.moveLinesUp(); },
scrollIntoView: "cursor"
}, {
name: "copylinesdown",
bindKey: bindKey("Alt-Shift-Down", "Command-Option-Down"),
exec: function(editor) { editor.copyLinesDown(); },
scrollIntoView: "cursor"
}, {
name: "movelinesdown",
bindKey: bindKey("Alt-Down", "Option-Down"),
exec: function(editor) { editor.moveLinesDown(); },
scrollIntoView: "cursor"
}, {
name: "del",
bindKey: bindKey("Delete", "Delete|Ctrl-D|Shift-Delete"),
exec: function(editor) { editor.remove("right"); },
multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, {
name: "backspace",
bindKey: bindKey(
"Shift-Backspace|Backspace",
"Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H"
),
exec: function(editor) { editor.remove("left"); },
multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, {
name: "cut_or_delete",
bindKey: bindKey("Shift-Delete", null),
exec: function(editor) {
if (editor.selection.isEmpty()) {
editor.remove("left");
} else {
return false;
}
},
multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, {
name: "removetolinestart",
bindKey: bindKey("Alt-Backspace", "Command-Backspace"),
exec: function(editor) { editor.removeToLineStart(); },
multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, {
name: "removetolineend",
bindKey: bindKey("Alt-Delete", "Ctrl-K"),
exec: function(editor) { editor.removeToLineEnd(); },
multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, {
name: "removewordleft",
bindKey: bindKey("Ctrl-Backspace", "Alt-Backspace|Ctrl-Alt-Backspace"),
exec: function(editor) { editor.removeWordLeft(); },
multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, {
name: "removewordright",
bindKey: bindKey("Ctrl-Delete", "Alt-Delete"),
exec: function(editor) { editor.removeWordRight(); },
multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, {
name: "outdent",
bindKey: bindKey("Shift-Tab", "Shift-Tab"),
exec: function(editor) { editor.blockOutdent(); },
multiSelectAction: "forEach",
scrollIntoView: "selectionPart"
}, {
name: "indent",
bindKey: bindKey("Tab", "Tab"),
exec: function(editor) { editor.indent(); },
multiSelectAction: "forEach",
scrollIntoView: "selectionPart"
}, {
name: "blockoutdent",
bindKey: bindKey("Ctrl-[", "Ctrl-["),
exec: function(editor) { editor.blockOutdent(); },
multiSelectAction: "forEachLine",
scrollIntoView: "selectionPart"
}, {
name: "blockindent",
bindKey: bindKey("Ctrl-]", "Ctrl-]"),
exec: function(editor) { editor.blockIndent(); },
multiSelectAction: "forEachLine",
scrollIntoView: "selectionPart"
}, {
name: "insertstring",
exec: function(editor, str) { editor.insert(str); },
multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, {
name: "inserttext",
exec: function(editor, args) {
editor.insert(lang.stringRepeat(args.text || "", args.times || 1));
},
multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, {
name: "splitline",
bindKey: bindKey(null, "Ctrl-O"),
exec: function(editor) { editor.splitLine(); },
multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, {
name: "transposeletters",
bindKey: bindKey("Ctrl-T", "Ctrl-T"),
exec: function(editor) { editor.transposeLetters(); },
multiSelectAction: function(editor) {editor.transposeSelections(1); },
scrollIntoView: "cursor"
}, {
name: "touppercase",
bindKey: bindKey("Ctrl-U", "Ctrl-U"),
exec: function(editor) { editor.toUpperCase(); },
multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, {
name: "tolowercase",
bindKey: bindKey("Ctrl-Shift-U", "Ctrl-Shift-U"),
exec: function(editor) { editor.toLowerCase(); },
multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, {
name: "expandtoline",
bindKey: bindKey("Ctrl-Shift-L", "Command-Shift-L"),
exec: function(editor) {
var range = editor.selection.getRange();
range.start.column = range.end.column = 0;
range.end.row++;
editor.selection.setRange(range, false);
},
multiSelectAction: "forEach",
scrollIntoView: "cursor",
readOnly: true
}, {
name: "joinlines",
bindKey: bindKey(null, null),
exec: function(editor) {
var isBackwards = editor.selection.isBackwards();
var selectionStart = isBackwards ? editor.selection.getSelectionLead() : editor.selection.getSelectionAnchor();
var selectionEnd = isBackwards ? editor.selection.getSelectionAnchor() : editor.selection.getSelectionLead();
var firstLineEndCol = editor.session.doc.getLine(selectionStart.row).length;
var selectedText = editor.session.doc.getTextRange(editor.selection.getRange());
var selectedCount = selectedText.replace(/\n\s*/, " ").length;
var insertLine = editor.session.doc.getLine(selectionStart.row);
for (var i = selectionStart.row + 1; i <= selectionEnd.row + 1; i++) {
var curLine = lang.stringTrimLeft(lang.stringTrimRight(editor.session.doc.getLine(i)));
if (curLine.length !== 0) {
curLine = " " + curLine;
}
insertLine += curLine;
}
if (selectionEnd.row + 1 < (editor.session.doc.getLength() - 1)) {
insertLine += editor.session.doc.getNewLineCharacter();
}
editor.clearSelection();
editor.session.doc.replace(new Range(selectionStart.row, 0, selectionEnd.row + 2, 0), insertLine);
if (selectedCount > 0) {
editor.selection.moveCursorTo(selectionStart.row, selectionStart.column);
editor.selection.selectTo(selectionStart.row, selectionStart.column + selectedCount);
} else {
firstLineEndCol = editor.session.doc.getLine(selectionStart.row).length > firstLineEndCol ? (firstLineEndCol + 1) : firstLineEndCol;
editor.selection.moveCursorTo(selectionStart.row, firstLineEndCol);
}
},
multiSelectAction: "forEach",
readOnly: true
}, {
name: "invertSelection",
bindKey: bindKey(null, null),
exec: function(editor) {
var endRow = editor.session.doc.getLength() - 1;
var endCol = editor.session.doc.getLine(endRow).length;
var ranges = editor.selection.rangeList.ranges;
var newRanges = [];
if (ranges.length < 1) {
ranges = [editor.selection.getRange()];
}
for (var i = 0; i < ranges.length; i++) {
if (i == (ranges.length - 1)) {
if (!(ranges[i].end.row === endRow && ranges[i].end.column === endCol)) {
newRanges.push(new Range(ranges[i].end.row, ranges[i].end.column, endRow, endCol));
}
}
if (i === 0) {
if (!(ranges[i].start.row === 0 && ranges[i].start.column === 0)) {
newRanges.push(new Range(0, 0, ranges[i].start.row, ranges[i].start.column));
}
} else {
newRanges.push(new Range(ranges[i-1].end.row, ranges[i-1].end.column, ranges[i].start.row, ranges[i].start.column));
}
}
editor.exitMultiSelectMode();
editor.clearSelection();
for(var i = 0; i < newRanges.length; i++) {
editor.selection.addRange(newRanges[i], false);
}
},
readOnly: true,
scrollIntoView: "none"
}];
});
ace.define("ace/editor",["require","exports","module","ace/lib/fixoldbrowsers","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/useragent","ace/keyboard/textinput","ace/mouse/mouse_handler","ace/mouse/fold_handler","ace/keyboard/keybinding","ace/edit_session","ace/search","ace/range","ace/lib/event_emitter","ace/commands/command_manager","ace/commands/default_commands","ace/config","ace/token_iterator"], function(acequire, exports, module) {
"use strict";
acequire("./lib/fixoldbrowsers");
var oop = acequire("./lib/oop");
var dom = acequire("./lib/dom");
var lang = acequire("./lib/lang");
var useragent = acequire("./lib/useragent");
var TextInput = acequire("./keyboard/textinput").TextInput;
var MouseHandler = acequire("./mouse/mouse_handler").MouseHandler;
var FoldHandler = acequire("./mouse/fold_handler").FoldHandler;
var KeyBinding = acequire("./keyboard/keybinding").KeyBinding;
var EditSession = acequire("./edit_session").EditSession;
var Search = acequire("./search").Search;
var Range = acequire("./range").Range;
var EventEmitter = acequire("./lib/event_emitter").EventEmitter;
var CommandManager = acequire("./commands/command_manager").CommandManager;
var defaultCommands = acequire("./commands/default_commands").commands;
var config = acequire("./config");
var TokenIterator = acequire("./token_iterator").TokenIterator;
var Editor = function(renderer, session) {
var container = renderer.getContainerElement();
this.container = container;
this.renderer = renderer;
this.commands = new CommandManager(useragent.isMac ? "mac" : "win", defaultCommands);
this.textInput = new TextInput(renderer.getTextAreaContainer(), this);
this.renderer.textarea = this.textInput.getElement();
this.keyBinding = new KeyBinding(this);
this.$mouseHandler = new MouseHandler(this);
new FoldHandler(this);
this.$blockScrolling = 0;
this.$search = new Search().set({
wrap: true
});
this.$historyTracker = this.$historyTracker.bind(this);
this.commands.on("exec", this.$historyTracker);
this.$initOperationListeners();
this._$emitInputEvent = lang.delayedCall(function() {
this._signal("input", {});
if (this.session && this.session.bgTokenizer)
this.session.bgTokenizer.scheduleStart();
}.bind(this));
this.on("change", function(_, _self) {
_self._$emitInputEvent.schedule(31);
});
this.setSession(session || new EditSession(""));
config.resetOptions(this);
config._signal("editor", this);
};
(function(){
oop.implement(this, EventEmitter);
this.$initOperationListeners = function() {
function last(a) {return a[a.length - 1]}
this.selections = [];
this.commands.on("exec", this.startOperation.bind(this), true);
this.commands.on("afterExec", this.endOperation.bind(this), true);
this.$opResetTimer = lang.delayedCall(this.endOperation.bind(this));
this.on("change", function() {
this.curOp || this.startOperation();
this.curOp.docChanged = true;
}.bind(this), true);
this.on("changeSelection", function() {
this.curOp || this.startOperation();
this.curOp.selectionChanged = true;
}.bind(this), true);
};
this.curOp = null;
this.prevOp = {};
this.startOperation = function(commadEvent) {
if (this.curOp) {
if (!commadEvent || this.curOp.command)
return;
this.prevOp = this.curOp;
}
if (!commadEvent) {
this.previousCommand = null;
commadEvent = {};
}
this.$opResetTimer.schedule();
this.curOp = {
command: commadEvent.command || {},
args: commadEvent.args,
scrollTop: this.renderer.scrollTop
};
if (this.curOp.command.name && this.curOp.command.scrollIntoView !== undefined)
this.$blockScrolling++;
};
this.endOperation = function(e) {
if (this.curOp) {
if (e && e.returnValue === false)
return this.curOp = null;
this._signal("beforeEndOperation");
var command = this.curOp.command;
if (command.name && this.$blockScrolling > 0)
this.$blockScrolling--;
var scrollIntoView = command && command.scrollIntoView;
if (scrollIntoView) {
switch (scrollIntoView) {
case "center-animate":
scrollIntoView = "animate";
case "center":
this.renderer.scrollCursorIntoView(null, 0.5);
break;
case "animate":
case "cursor":
this.renderer.scrollCursorIntoView();
break;
case "selectionPart":
var range = this.selection.getRange();
var config = this.renderer.layerConfig;
if (range.start.row >= config.lastRow || range.end.row <= config.firstRow) {
this.renderer.scrollSelectionIntoView(this.selection.anchor, this.selection.lead);
}
break;
default:
break;
}
if (scrollIntoView == "animate")
this.renderer.animateScrolling(this.curOp.scrollTop);
}
this.prevOp = this.curOp;
this.curOp = null;
}
};
this.$mergeableCommands = ["backspace", "del", "insertstring"];
this.$historyTracker = function(e) {
if (!this.$mergeUndoDeltas)
return;
var prev = this.prevOp;
var mergeableCommands = this.$mergeableCommands;
var shouldMerge = prev.command && (e.command.name == prev.command.name);
if (e.command.name == "insertstring") {
var text = e.args;
if (this.mergeNextCommand === undefined)
this.mergeNextCommand = true;
shouldMerge = shouldMerge
&& this.mergeNextCommand // previous command allows to coalesce with
&& (!/\s/.test(text) || /\s/.test(prev.args)); // previous insertion was of same type
this.mergeNextCommand = true;
} else {
shouldMerge = shouldMerge
&& mergeableCommands.indexOf(e.command.name) !== -1; // the command is mergeable
}
if (
this.$mergeUndoDeltas != "always"
&& Date.now() - this.sequenceStartTime > 2000
) {
shouldMerge = false; // the sequence is too long
}
if (shouldMerge)
this.session.mergeUndoDeltas = true;
else if (mergeableCommands.indexOf(e.command.name) !== -1)
this.sequenceStartTime = Date.now();
};
this.setKeyboardHandler = function(keyboardHandler, cb) {
if (keyboardHandler && typeof keyboardHandler === "string") {
this.$keybindingId = keyboardHandler;
var _self = this;
config.loadModule(["keybinding", keyboardHandler], function(module) {
if (_self.$keybindingId == keyboardHandler)
_self.keyBinding.setKeyboardHandler(module && module.handler);
cb && cb();
});
} else {
this.$keybindingId = null;
this.keyBinding.setKeyboardHandler(keyboardHandler);
cb && cb();
}
};
this.getKeyboardHandler = function() {
return this.keyBinding.getKeyboardHandler();
};
this.setSession = function(session) {
if (this.session == session)
return;
if (this.curOp) this.endOperation();
this.curOp = {};
var oldSession = this.session;
if (oldSession) {
this.session.off("change", this.$onDocumentChange);
this.session.off("changeMode", this.$onChangeMode);
this.session.off("tokenizerUpdate", this.$onTokenizerUpdate);
this.session.off("changeTabSize", this.$onChangeTabSize);
this.session.off("changeWrapLimit", this.$onChangeWrapLimit);
this.session.off("changeWrapMode", this.$onChangeWrapMode);
this.session.off("changeFold", this.$onChangeFold);
this.session.off("changeFrontMarker", this.$onChangeFrontMarker);
this.session.off("changeBackMarker", this.$onChangeBackMarker);
this.session.off("changeBreakpoint", this.$onChangeBreakpoint);
this.session.off("changeAnnotation", this.$onChangeAnnotation);
this.session.off("changeOverwrite", this.$onCursorChange);
this.session.off("changeScrollTop", this.$onScrollTopChange);
this.session.off("changeScrollLeft", this.$onScrollLeftChange);
var selection = this.session.getSelection();
selection.off("changeCursor", this.$onCursorChange);
selection.off("changeSelection", this.$onSelectionChange);
}
this.session = session;
if (session) {
this.$onDocumentChange = this.onDocumentChange.bind(this);
session.on("change", this.$onDocumentChange);
this.renderer.setSession(session);
this.$onChangeMode = this.onChangeMode.bind(this);
session.on("changeMode", this.$onChangeMode);
this.$onTokenizerUpdate = this.onTokenizerUpdate.bind(this);
session.on("tokenizerUpdate", this.$onTokenizerUpdate);
this.$onChangeTabSize = this.renderer.onChangeTabSize.bind(this.renderer);
session.on("changeTabSize", this.$onChangeTabSize);
this.$onChangeWrapLimit = this.onChangeWrapLimit.bind(this);
session.on("changeWrapLimit", this.$onChangeWrapLimit);
this.$onChangeWrapMode = this.onChangeWrapMode.bind(this);
session.on("changeWrapMode", this.$onChangeWrapMode);
this.$onChangeFold = this.onChangeFold.bind(this);
session.on("changeFold", this.$onChangeFold);
this.$onChangeFrontMarker = this.onChangeFrontMarker.bind(this);
this.session.on("changeFrontMarker", this.$onChangeFrontMarker);
this.$onChangeBackMarker = this.onChangeBackMarker.bind(this);
this.session.on("changeBackMarker", this.$onChangeBackMarker);
this.$onChangeBreakpoint = this.onChangeBreakpoint.bind(this);
this.session.on("changeBreakpoint", this.$onChangeBreakpoint);
this.$onChangeAnnotation = this.onChangeAnnotation.bind(this);
this.session.on("changeAnnotation", this.$onChangeAnnotation);
this.$onCursorChange = this.onCursorChange.bind(this);
this.session.on("changeOverwrite", this.$onCursorChange);
this.$onScrollTopChange = this.onScrollTopChange.bind(this);
this.session.on("changeScrollTop", this.$onScrollTopChange);
this.$onScrollLeftChange = this.onScrollLeftChange.bind(this);
this.session.on("changeScrollLeft", this.$onScrollLeftChange);
this.selection = session.getSelection();
this.selection.on("changeCursor", this.$onCursorChange);
this.$onSelectionChange = this.onSelectionChange.bind(this);
this.selection.on("changeSelection", this.$onSelectionChange);
this.onChangeMode();
this.$blockScrolling += 1;
this.onCursorChange();
this.$blockScrolling -= 1;
this.onScrollTopChange();
this.onScrollLeftChange();
this.onSelectionChange();
this.onChangeFrontMarker();
this.onChangeBackMarker();
this.onChangeBreakpoint();
this.onChangeAnnotation();
this.session.getUseWrapMode() && this.renderer.adjustWrapLimit();
this.renderer.updateFull();
} else {
this.selection = null;
this.renderer.setSession(session);
}
this._signal("changeSession", {
session: session,
oldSession: oldSession
});
this.curOp = null;
oldSession && oldSession._signal("changeEditor", {oldEditor: this});
session && session._signal("changeEditor", {editor: this});
};
this.getSession = function() {
return this.session;
};
this.setValue = function(val, cursorPos) {
this.session.doc.setValue(val);
if (!cursorPos)
this.selectAll();
else if (cursorPos == 1)
this.navigateFileEnd();
else if (cursorPos == -1)
this.navigateFileStart();
return val;
};
this.getValue = function() {
return this.session.getValue();
};
this.getSelection = function() {
return this.selection;
};
this.resize = function(force) {
this.renderer.onResize(force);
};
this.setTheme = function(theme, cb) {
this.renderer.setTheme(theme, cb);
};
this.getTheme = function() {
return this.renderer.getTheme();
};
this.setStyle = function(style) {
this.renderer.setStyle(style);
};
this.unsetStyle = function(style) {
this.renderer.unsetStyle(style);
};
this.getFontSize = function () {
return this.getOption("fontSize") ||
dom.computedStyle(this.container, "fontSize");
};
this.setFontSize = function(size) {
this.setOption("fontSize", size);
};
this.$highlightBrackets = function() {
if (this.session.$bracketHighlight) {
this.session.removeMarker(this.session.$bracketHighlight);
this.session.$bracketHighlight = null;
}
if (this.$highlightPending) {
return;
}
var self = this;
this.$highlightPending = true;
setTimeout(function() {
self.$highlightPending = false;
var session = self.session;
if (!session || !session.bgTokenizer) return;
var pos = session.findMatchingBracket(self.getCursorPosition());
if (pos) {
var range = new Range(pos.row, pos.column, pos.row, pos.column + 1);
} else if (session.$mode.getMatching) {
var range = session.$mode.getMatching(self.session);
}
if (range)
session.$bracketHighlight = session.addMarker(range, "ace_bracket", "text");
}, 50);
};
this.$highlightTags = function() {
if (this.$highlightTagPending)
return;
var self = this;
this.$highlightTagPending = true;
setTimeout(function() {
self.$highlightTagPending = false;
var session = self.session;
if (!session || !session.bgTokenizer) return;
var pos = self.getCursorPosition();
var iterator = new TokenIterator(self.session, pos.row, pos.column);
var token = iterator.getCurrentToken();
if (!token || !/\b(?:tag-open|tag-name)/.test(token.type)) {
session.removeMarker(session.$tagHighlight);
session.$tagHighlight = null;
return;
}
if (token.type.indexOf("tag-open") != -1) {
token = iterator.stepForward();
if (!token)
return;
}
var tag = token.value;
var depth = 0;
var prevToken = iterator.stepBackward();
if (prevToken.value == '<'){
do {
prevToken = token;
token = iterator.stepForward();
if (token && token.value === tag && token.type.indexOf('tag-name') !== -1) {
if (prevToken.value === '<'){
depth++;
} else if (prevToken.value === '</'){
depth--;
}
}
} while (token && depth >= 0);
} else {
do {
token = prevToken;
prevToken = iterator.stepBackward();
if (token && token.value === tag && token.type.indexOf('tag-name') !== -1) {
if (prevToken.value === '<') {
depth++;
} else if (prevToken.value === '</') {
depth--;
}
}
} while (prevToken && depth <= 0);
iterator.stepForward();
}
if (!token) {
session.removeMarker(session.$tagHighlight);
session.$tagHighlight = null;
return;
}
var row = iterator.getCurrentTokenRow();
var column = iterator.getCurrentTokenColumn();
var range = new Range(row, column, row, column+token.value.length);
var sbm = session.$backMarkers[session.$tagHighlight];
if (session.$tagHighlight && sbm != undefined && range.compareRange(sbm.range) !== 0) {
session.removeMarker(session.$tagHighlight);
session.$tagHighlight = null;
}
if (range && !session.$tagHighlight)
session.$tagHighlight = session.addMarker(range, "ace_bracket", "text");
}, 50);
};
this.focus = function() {
var _self = this;
setTimeout(function() {
_self.textInput.focus();
});
this.textInput.focus();
};
this.isFocused = function() {
return this.textInput.isFocused();
};
this.blur = function() {
this.textInput.blur();
};
this.onFocus = function(e) {
if (this.$isFocused)
return;
this.$isFocused = true;
this.renderer.showCursor();
this.renderer.visualizeFocus();
this._emit("focus", e);
};
this.onBlur = function(e) {
if (!this.$isFocused)
return;
this.$isFocused = false;
this.renderer.hideCursor();
this.renderer.visualizeBlur();
this._emit("blur", e);
};
this.$cursorChange = function() {
this.renderer.updateCursor();
};
this.onDocumentChange = function(delta) {
var wrap = this.session.$useWrapMode;
var lastRow = (delta.start.row == delta.end.row ? delta.end.row : Infinity);
this.renderer.updateLines(delta.start.row, lastRow, wrap);
this._signal("change", delta);
this.$cursorChange();
this.$updateHighlightActiveLine();
};
this.onTokenizerUpdate = function(e) {
var rows = e.data;
this.renderer.updateLines(rows.first, rows.last);
};
this.onScrollTopChange = function() {
this.renderer.scrollToY(this.session.getScrollTop());
};
this.onScrollLeftChange = function() {
this.renderer.scrollToX(this.session.getScrollLeft());
};
this.onCursorChange = function() {
this.$cursorChange();
if (!this.$blockScrolling) {
config.warn("Automatically scrolling cursor into view after selection change",
"this will be disabled in the next version",
"set editor.$blockScrolling = Infinity to disable this message"
);
this.renderer.scrollCursorIntoView();
}
this.$highlightBrackets();
this.$highlightTags();
this.$updateHighlightActiveLine();
this._signal("changeSelection");
};
this.$updateHighlightActiveLine = function() {
var session = this.getSession();
var highlight;
if (this.$highlightActiveLine) {
if ((this.$selectionStyle != "line" || !this.selection.isMultiLine()))
highlight = this.getCursorPosition();
if (this.renderer.$maxLines && this.session.getLength() === 1 && !(this.renderer.$minLines > 1))
highlight = false;
}
if (session.$highlightLineMarker && !highlight) {
session.removeMarker(session.$highlightLineMarker.id);
session.$highlightLineMarker = null;
} else if (!session.$highlightLineMarker && highlight) {
var range = new Range(highlight.row, highlight.column, highlight.row, Infinity);
range.id = session.addMarker(range, "ace_active-line", "screenLine");
session.$highlightLineMarker = range;
} else if (highlight) {
session.$highlightLineMarker.start.row = highlight.row;
session.$highlightLineMarker.end.row = highlight.row;
session.$highlightLineMarker.start.column = highlight.column;
session._signal("changeBackMarker");
}
};
this.onSelectionChange = function(e) {
var session = this.session;
if (session.$selectionMarker) {
session.removeMarker(session.$selectionMarker);
}
session.$selectionMarker = null;
if (!this.selection.isEmpty()) {
var range = this.selection.getRange();
var style = this.getSelectionStyle();
session.$selectionMarker = session.addMarker(range, "ace_selection", style);
} else {
this.$updateHighlightActiveLine();
}
var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp();
this.session.highlight(re);
this._signal("changeSelection");
};
this.$getSelectionHighLightRegexp = function() {
var session = this.session;
var selection = this.getSelectionRange();
if (selection.isEmpty() || selection.isMultiLine())
return;
var startOuter = selection.start.column - 1;
var endOuter = selection.end.column + 1;
var line = session.getLine(selection.start.row);
var lineCols = line.length;
var needle = line.substring(Math.max(startOuter, 0),
Math.min(endOuter, lineCols));
if ((startOuter >= 0 && /^[\w\d]/.test(needle)) ||
(endOuter <= lineCols && /[\w\d]$/.test(needle)))
return;
needle = line.substring(selection.start.column, selection.end.column);
if (!/^[\w\d]+$/.test(needle))
return;
var re = this.$search.$assembleRegExp({
wholeWord: true,
caseSensitive: true,
needle: needle
});
return re;
};
this.onChangeFrontMarker = function() {
this.renderer.updateFrontMarkers();
};
this.onChangeBackMarker = function() {
this.renderer.updateBackMarkers();
};
this.onChangeBreakpoint = function() {
this.renderer.updateBreakpoints();
};
this.onChangeAnnotation = function() {
this.renderer.setAnnotations(this.session.getAnnotations());
};
this.onChangeMode = function(e) {
this.renderer.updateText();
this._emit("changeMode", e);
};
this.onChangeWrapLimit = function() {
this.renderer.updateFull();
};
this.onChangeWrapMode = function() {
this.renderer.onResize(true);
};
this.onChangeFold = function() {
this.$updateHighlightActiveLine();
this.renderer.updateFull();
};
this.getSelectedText = function() {
return this.session.getTextRange(this.getSelectionRange());
};
this.getCopyText = function() {
var text = this.getSelectedText();
this._signal("copy", text);
return text;
};
this.onCopy = function() {
this.commands.exec("copy", this);
};
this.onCut = function() {
this.commands.exec("cut", this);
};
this.onPaste = function(text, event) {
var e = {text: text, event: event};
this.commands.exec("paste", this, e);
};
this.$handlePaste = function(e) {
if (typeof e == "string")
e = {text: e};
this._signal("paste", e);
var text = e.text;
if (!this.inMultiSelectMode || this.inVirtualSelectionMode) {
this.insert(text);
} else {
var lines = text.split(/\r\n|\r|\n/);
var ranges = this.selection.rangeList.ranges;
if (lines.length > ranges.length || lines.length < 2 || !lines[1])
return this.commands.exec("insertstring", this, text);
for (var i = ranges.length; i--;) {
var range = ranges[i];
if (!range.isEmpty())
this.session.remove(range);
this.session.insert(range.start, lines[i]);
}
}
};
this.execCommand = function(command, args) {
return this.commands.exec(command, this, args);
};
this.insert = function(text, pasted) {
var session = this.session;
var mode = session.getMode();
var cursor = this.getCursorPosition();
if (this.getBehavioursEnabled() && !pasted) {
var transform = mode.transformAction(session.getState(cursor.row), 'insertion', this, session, text);
if (transform) {
if (text !== transform.text) {
this.session.mergeUndoDeltas = false;
this.$mergeNextCommand = false;
}
text = transform.text;
}
}
if (text == "\t")
text = this.session.getTabString();
if (!this.selection.isEmpty()) {
var range = this.getSelectionRange();
cursor = this.session.remove(range);
this.clearSelection();
}
else if (this.session.getOverwrite()) {
var range = new Range.fromPoints(cursor, cursor);
range.end.column += text.length;
this.session.remove(range);
}
if (text == "\n" || text == "\r\n") {
var line = session.getLine(cursor.row);
if (cursor.column > line.search(/\S|$/)) {
var d = line.substr(cursor.column).search(/\S|$/);
session.doc.removeInLine(cursor.row, cursor.column, cursor.column + d);
}
}
this.clearSelection();
var start = cursor.column;
var lineState = session.getState(cursor.row);
var line = session.getLine(cursor.row);
var shouldOutdent = mode.checkOutdent(lineState, line, text);
var end = session.insert(cursor, text);
if (transform && transform.selection) {
if (transform.selection.length == 2) { // Transform relative to the current column
this.selection.setSelectionRange(
new Range(cursor.row, start + transform.selection[0],
cursor.row, start + transform.selection[1]));
} else { // Transform relative to the current row.
this.selection.setSelectionRange(
new Range(cursor.row + transform.selection[0],
transform.selection[1],
cursor.row + transform.selection[2],
transform.selection[3]));
}
}
if (session.getDocument().isNewLine(text)) {
var lineIndent = mode.getNextLineIndent(lineState, line.slice(0, cursor.column), session.getTabString());
session.insert({row: cursor.row+1, column: 0}, lineIndent);
}
if (shouldOutdent)
mode.autoOutdent(lineState, session, cursor.row);
};
this.onTextInput = function(text) {
this.keyBinding.onTextInput(text);
};
this.onCommandKey = function(e, hashId, keyCode) {
this.keyBinding.onCommandKey(e, hashId, keyCode);
};
this.setOverwrite = function(overwrite) {
this.session.setOverwrite(overwrite);
};
this.getOverwrite = function() {
return this.session.getOverwrite();
};
this.toggleOverwrite = function() {
this.session.toggleOverwrite();
};
this.setScrollSpeed = function(speed) {
this.setOption("scrollSpeed", speed);
};
this.getScrollSpeed = function() {
return this.getOption("scrollSpeed");
};
this.setDragDelay = function(dragDelay) {
this.setOption("dragDelay", dragDelay);
};
this.getDragDelay = function() {
return this.getOption("dragDelay");
};
this.setSelectionStyle = function(val) {
this.setOption("selectionStyle", val);
};
this.getSelectionStyle = function() {
return this.getOption("selectionStyle");
};
this.setHighlightActiveLine = function(shouldHighlight) {
this.setOption("highlightActiveLine", shouldHighlight);
};
this.getHighlightActiveLine = function() {
return this.getOption("highlightActiveLine");
};
this.setHighlightGutterLine = function(shouldHighlight) {
this.setOption("highlightGutterLine", shouldHighlight);
};
this.getHighlightGutterLine = function() {
return this.getOption("highlightGutterLine");
};
this.setHighlightSelectedWord = function(shouldHighlight) {
this.setOption("highlightSelectedWord", shouldHighlight);
};
this.getHighlightSelectedWord = function() {
return this.$highlightSelectedWord;
};
this.setAnimatedScroll = function(shouldAnimate){
this.renderer.setAnimatedScroll(shouldAnimate);
};
this.getAnimatedScroll = function(){
return this.renderer.getAnimatedScroll();
};
this.setShowInvisibles = function(showInvisibles) {
this.renderer.setShowInvisibles(showInvisibles);
};
this.getShowInvisibles = function() {
return this.renderer.getShowInvisibles();
};
this.setDisplayIndentGuides = function(display) {
this.renderer.setDisplayIndentGuides(display);
};
this.getDisplayIndentGuides = function() {
return this.renderer.getDisplayIndentGuides();
};
this.setShowPrintMargin = function(showPrintMargin) {
this.renderer.setShowPrintMargin(showPrintMargin);
};
this.getShowPrintMargin = function() {
return this.renderer.getShowPrintMargin();
};
this.setPrintMarginColumn = function(showPrintMargin) {
this.renderer.setPrintMarginColumn(showPrintMargin);
};
this.getPrintMarginColumn = function() {
return this.renderer.getPrintMarginColumn();
};
this.setReadOnly = function(readOnly) {
this.setOption("readOnly", readOnly);
};
this.getReadOnly = function() {
return this.getOption("readOnly");
};
this.setBehavioursEnabled = function (enabled) {
this.setOption("behavioursEnabled", enabled);
};
this.getBehavioursEnabled = function () {
return this.getOption("behavioursEnabled");
};
this.setWrapBehavioursEnabled = function (enabled) {
this.setOption("wrapBehavioursEnabled", enabled);
};
this.getWrapBehavioursEnabled = function () {
return this.getOption("wrapBehavioursEnabled");
};
this.setShowFoldWidgets = function(show) {
this.setOption("showFoldWidgets", show);
};
this.getShowFoldWidgets = function() {
return this.getOption("showFoldWidgets");
};
this.setFadeFoldWidgets = function(fade) {
this.setOption("fadeFoldWidgets", fade);
};
this.getFadeFoldWidgets = function() {
return this.getOption("fadeFoldWidgets");
};
this.remove = function(dir) {
if (this.selection.isEmpty()){
if (dir == "left")
this.selection.selectLeft();
else
this.selection.selectRight();
}
var range = this.getSelectionRange();
if (this.getBehavioursEnabled()) {
var session = this.session;
var state = session.getState(range.start.row);
var new_range = session.getMode().transformAction(state, 'deletion', this, session, range);
if (range.end.column === 0) {
var text = session.getTextRange(range);
if (text[text.length - 1] == "\n") {
var line = session.getLine(range.end.row);
if (/^\s+$/.test(line)) {
range.end.column = line.length;
}
}
}
if (new_range)
range = new_range;
}
this.session.remove(range);
this.clearSelection();
};
this.removeWordRight = function() {
if (this.selection.isEmpty())
this.selection.selectWordRight();
this.session.remove(this.getSelectionRange());
this.clearSelection();
};
this.removeWordLeft = function() {
if (this.selection.isEmpty())
this.selection.selectWordLeft();
this.session.remove(this.getSelectionRange());
this.clearSelection();
};
this.removeToLineStart = function() {
if (this.selection.isEmpty())
this.selection.selectLineStart();
this.session.remove(this.getSelectionRange());
this.clearSelection();
};
this.removeToLineEnd = function() {
if (this.selection.isEmpty())
this.selection.selectLineEnd();
var range = this.getSelectionRange();
if (range.start.column == range.end.column && range.start.row == range.end.row) {
range.end.column = 0;
range.end.row++;
}
this.session.remove(range);
this.clearSelection();
};
this.splitLine = function() {
if (!this.selection.isEmpty()) {
this.session.remove(this.getSelectionRange());
this.clearSelection();
}
var cursor = this.getCursorPosition();
this.insert("\n");
this.moveCursorToPosition(cursor);
};
this.transposeLetters = function() {
if (!this.selection.isEmpty()) {
return;
}
var cursor = this.getCursorPosition();
var column = cursor.column;
if (column === 0)
return;
var line = this.session.getLine(cursor.row);
var swap, range;
if (column < line.length) {
swap = line.charAt(column) + line.charAt(column-1);
range = new Range(cursor.row, column-1, cursor.row, column+1);
}
else {
swap = line.charAt(column-1) + line.charAt(column-2);
range = new Range(cursor.row, column-2, cursor.row, column);
}
this.session.replace(range, swap);
};
this.toLowerCase = function() {
var originalRange = this.getSelectionRange();
if (this.selection.isEmpty()) {
this.selection.selectWord();
}
var range = this.getSelectionRange();
var text = this.session.getTextRange(range);
this.session.replace(range, text.toLowerCase());
this.selection.setSelectionRange(originalRange);
};
this.toUpperCase = function() {
var originalRange = this.getSelectionRange();
if (this.selection.isEmpty()) {
this.selection.selectWord();
}
var range = this.getSelectionRange();
var text = this.session.getTextRange(range);
this.session.replace(range, text.toUpperCase());
this.selection.setSelectionRange(originalRange);
};
this.indent = function() {
var session = this.session;
var range = this.getSelectionRange();
if (range.start.row < range.end.row) {
var rows = this.$getSelectedRows();
session.indentRows(rows.first, rows.last, "\t");
return;
} else if (range.start.column < range.end.column) {
var text = session.getTextRange(range);
if (!/^\s+$/.test(text)) {
var rows = this.$getSelectedRows();
session.indentRows(rows.first, rows.last, "\t");
return;
}
}
var line = session.getLine(range.start.row);
var position = range.start;
var size = session.getTabSize();
var column = session.documentToScreenColumn(position.row, position.column);
if (this.session.getUseSoftTabs()) {
var count = (size - column % size);
var indentString = lang.stringRepeat(" ", count);
} else {
var count = column % size;
while (line[range.start.column - 1] == " " && count) {
range.start.column--;
count--;
}
this.selection.setSelectionRange(range);
indentString = "\t";
}
return this.insert(indentString);
};
this.blockIndent = function() {
var rows = this.$getSelectedRows();
this.session.indentRows(rows.first, rows.last, "\t");
};
this.blockOutdent = function() {
var selection = this.session.getSelection();
this.session.outdentRows(selection.getRange());
};
this.sortLines = function() {
var rows = this.$getSelectedRows();
var session = this.session;
var lines = [];
for (i = rows.first; i <= rows.last; i++)
lines.push(session.getLine(i));
lines.sort(function(a, b) {
if (a.toLowerCase() < b.toLowerCase()) return -1;
if (a.toLowerCase() > b.toLowerCase()) return 1;
return 0;
});
var deleteRange = new Range(0, 0, 0, 0);
for (var i = rows.first; i <= rows.last; i++) {
var line = session.getLine(i);
deleteRange.start.row = i;
deleteRange.end.row = i;
deleteRange.end.column = line.length;
session.replace(deleteRange, lines[i-rows.first]);
}
};
this.toggleCommentLines = function() {
var state = this.session.getState(this.getCursorPosition().row);
var rows = this.$getSelectedRows();
this.session.getMode().toggleCommentLines(state, this.session, rows.first, rows.last);
};
this.toggleBlockComment = function() {
var cursor = this.getCursorPosition();
var state = this.session.getState(cursor.row);
var range = this.getSelectionRange();
this.session.getMode().toggleBlockComment(state, this.session, range, cursor);
};
this.getNumberAt = function(row, column) {
var _numberRx = /[\-]?[0-9]+(?:\.[0-9]+)?/g;
_numberRx.lastIndex = 0;
var s = this.session.getLine(row);
while (_numberRx.lastIndex < column) {
var m = _numberRx.exec(s);
if(m.index <= column && m.index+m[0].length >= column){
var number = {
value: m[0],
start: m.index,
end: m.index+m[0].length
};
return number;
}
}
return null;
};
this.modifyNumber = function(amount) {
var row = this.selection.getCursor().row;
var column = this.selection.getCursor().column;
var charRange = new Range(row, column-1, row, column);
var c = this.session.getTextRange(charRange);
if (!isNaN(parseFloat(c)) && isFinite(c)) {
var nr = this.getNumberAt(row, column);
if (nr) {
var fp = nr.value.indexOf(".") >= 0 ? nr.start + nr.value.indexOf(".") + 1 : nr.end;
var decimals = nr.start + nr.value.length - fp;
var t = parseFloat(nr.value);
t *= Math.pow(10, decimals);
if(fp !== nr.end && column < fp){
amount *= Math.pow(10, nr.end - column - 1);
} else {
amount *= Math.pow(10, nr.end - column);
}
t += amount;
t /= Math.pow(10, decimals);
var nnr = t.toFixed(decimals);
var replaceRange = new Range(row, nr.start, row, nr.end);
this.session.replace(replaceRange, nnr);
this.moveCursorTo(row, Math.max(nr.start +1, column + nnr.length - nr.value.length));
}
}
};
this.removeLines = function() {
var rows = this.$getSelectedRows();
this.session.removeFullLines(rows.first, rows.last);
this.clearSelection();
};
this.duplicateSelection = function() {
var sel = this.selection;
var doc = this.session;
var range = sel.getRange();
var reverse = sel.isBackwards();
if (range.isEmpty()) {
var row = range.start.row;
doc.duplicateLines(row, row);
} else {
var point = reverse ? range.start : range.end;
var endPoint = doc.insert(point, doc.getTextRange(range), false);
range.start = point;
range.end = endPoint;
sel.setSelectionRange(range, reverse);
}
};
this.moveLinesDown = function() {
this.$moveLines(1, false);
};
this.moveLinesUp = function() {
this.$moveLines(-1, false);
};
this.moveText = function(range, toPosition, copy) {
return this.session.moveText(range, toPosition, copy);
};
this.copyLinesUp = function() {
this.$moveLines(-1, true);
};
this.copyLinesDown = function() {
this.$moveLines(1, true);
};
this.$moveLines = function(dir, copy) {
var rows, moved;
var selection = this.selection;
if (!selection.inMultiSelectMode || this.inVirtualSelectionMode) {
var range = selection.toOrientedRange();
rows = this.$getSelectedRows(range);
moved = this.session.$moveLines(rows.first, rows.last, copy ? 0 : dir);
if (copy && dir == -1) moved = 0;
range.moveBy(moved, 0);
selection.fromOrientedRange(range);
} else {
var ranges = selection.rangeList.ranges;
selection.rangeList.detach(this.session);
this.inVirtualSelectionMode = true;
var diff = 0;
var totalDiff = 0;
var l = ranges.length;
for (var i = 0; i < l; i++) {
var rangeIndex = i;
ranges[i].moveBy(diff, 0);
rows = this.$getSelectedRows(ranges[i]);
var first = rows.first;
var last = rows.last;
while (++i < l) {
if (totalDiff) ranges[i].moveBy(totalDiff, 0);
var subRows = this.$getSelectedRows(ranges[i]);
if (copy && subRows.first != last)
break;
else if (!copy && subRows.first > last + 1)
break;
last = subRows.last;
}
i--;
diff = this.session.$moveLines(first, last, copy ? 0 : dir);
if (copy && dir == -1) rangeIndex = i + 1;
while (rangeIndex <= i) {
ranges[rangeIndex].moveBy(diff, 0);
rangeIndex++;
}
if (!copy) diff = 0;
totalDiff += diff;
}
selection.fromOrientedRange(selection.ranges[0]);
selection.rangeList.attach(this.session);
this.inVirtualSelectionMode = false;
}
};
this.$getSelectedRows = function(range) {
range = (range || this.getSelectionRange()).collapseRows();
return {
first: this.session.getRowFoldStart(range.start.row),
last: this.session.getRowFoldEnd(range.end.row)
};
};
this.onCompositionStart = function(text) {
this.renderer.showComposition(this.getCursorPosition());
};
this.onCompositionUpdate = function(text) {
this.renderer.setCompositionText(text);
};
this.onCompositionEnd = function() {
this.renderer.hideComposition();
};
this.getFirstVisibleRow = function() {
return this.renderer.getFirstVisibleRow();
};
this.getLastVisibleRow = function() {
return this.renderer.getLastVisibleRow();
};
this.isRowVisible = function(row) {
return (row >= this.getFirstVisibleRow() && row <= this.getLastVisibleRow());
};
this.isRowFullyVisible = function(row) {
return (row >= this.renderer.getFirstFullyVisibleRow() && row <= this.renderer.getLastFullyVisibleRow());
};
this.$getVisibleRowCount = function() {
return this.renderer.getScrollBottomRow() - this.renderer.getScrollTopRow() + 1;
};
this.$moveByPage = function(dir, select) {
var renderer = this.renderer;
var config = this.renderer.layerConfig;
var rows = dir * Math.floor(config.height / config.lineHeight);
this.$blockScrolling++;
if (select === true) {
this.selection.$moveSelection(function(){
this.moveCursorBy(rows, 0);
});
} else if (select === false) {
this.selection.moveCursorBy(rows, 0);
this.selection.clearSelection();
}
this.$blockScrolling--;
var scrollTop = renderer.scrollTop;
renderer.scrollBy(0, rows * config.lineHeight);
if (select != null)
renderer.scrollCursorIntoView(null, 0.5);
renderer.animateScrolling(scrollTop);
};
this.selectPageDown = function() {
this.$moveByPage(1, true);
};
this.selectPageUp = function() {
this.$moveByPage(-1, true);
};
this.gotoPageDown = function() {
this.$moveByPage(1, false);
};
this.gotoPageUp = function() {
this.$moveByPage(-1, false);
};
this.scrollPageDown = function() {
this.$moveByPage(1);
};
this.scrollPageUp = function() {
this.$moveByPage(-1);
};
this.scrollToRow = function(row) {
this.renderer.scrollToRow(row);
};
this.scrollToLine = function(line, center, animate, callback) {
this.renderer.scrollToLine(line, center, animate, callback);
};
this.centerSelection = function() {
var range = this.getSelectionRange();
var pos = {
row: Math.floor(range.start.row + (range.end.row - range.start.row) / 2),
column: Math.floor(range.start.column + (range.end.column - range.start.column) / 2)
};
this.renderer.alignCursor(pos, 0.5);
};
this.getCursorPosition = function() {
return this.selection.getCursor();
};
this.getCursorPositionScreen = function() {
return this.session.documentToScreenPosition(this.getCursorPosition());
};
this.getSelectionRange = function() {
return this.selection.getRange();
};
this.selectAll = function() {
this.$blockScrolling += 1;
this.selection.selectAll();
this.$blockScrolling -= 1;
};
this.clearSelection = function() {
this.selection.clearSelection();
};
this.moveCursorTo = function(row, column) {
this.selection.moveCursorTo(row, column);
};
this.moveCursorToPosition = function(pos) {
this.selection.moveCursorToPosition(pos);
};
this.jumpToMatching = function(select, expand) {
var cursor = this.getCursorPosition();
var iterator = new TokenIterator(this.session, cursor.row, cursor.column);
var prevToken = iterator.getCurrentToken();
var token = prevToken || iterator.stepForward();
if (!token) return;
var matchType;
var found = false;
var depth = {};
var i = cursor.column - token.start;
var bracketType;
var brackets = {
")": "(",
"(": "(",
"]": "[",
"[": "[",
"{": "{",
"}": "{"
};
do {
if (token.value.match(/[{}()\[\]]/g)) {
for (; i < token.value.length && !found; i++) {
if (!brackets[token.value[i]]) {
continue;
}
bracketType = brackets[token.value[i]] + '.' + token.type.replace("rparen", "lparen");
if (isNaN(depth[bracketType])) {
depth[bracketType] = 0;
}
switch (token.value[i]) {
case '(':
case '[':
case '{':
depth[bracketType]++;
break;
case ')':
case ']':
case '}':
depth[bracketType]--;
if (depth[bracketType] === -1) {
matchType = 'bracket';
found = true;
}
break;
}
}
}
else if (token && token.type.indexOf('tag-name') !== -1) {
if (isNaN(depth[token.value])) {
depth[token.value] = 0;
}
if (prevToken.value === '<') {
depth[token.value]++;
}
else if (prevToken.value === '</') {
depth[token.value]--;
}
if (depth[token.value] === -1) {
matchType = 'tag';
found = true;
}
}
if (!found) {
prevToken = token;
token = iterator.stepForward();
i = 0;
}
} while (token && !found);
if (!matchType)
return;
var range, pos;
if (matchType === 'bracket') {
range = this.session.getBracketRange(cursor);
if (!range) {
range = new Range(
iterator.getCurrentTokenRow(),
iterator.getCurrentTokenColumn() + i - 1,
iterator.getCurrentTokenRow(),
iterator.getCurrentTokenColumn() + i - 1
);
pos = range.start;
if (expand || pos.row === cursor.row && Math.abs(pos.column - cursor.column) < 2)
range = this.session.getBracketRange(pos);
}
}
else if (matchType === 'tag') {
if (token && token.type.indexOf('tag-name') !== -1)
var tag = token.value;
else
return;
range = new Range(
iterator.getCurrentTokenRow(),
iterator.getCurrentTokenColumn() - 2,
iterator.getCurrentTokenRow(),
iterator.getCurrentTokenColumn() - 2
);
if (range.compare(cursor.row, cursor.column) === 0) {
found = false;
do {
token = prevToken;
prevToken = iterator.stepBackward();
if (prevToken) {
if (prevToken.type.indexOf('tag-close') !== -1) {
range.setEnd(iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn() + 1);
}
if (token.value === tag && token.type.indexOf('tag-name') !== -1) {
if (prevToken.value === '<') {
depth[tag]++;
}
else if (prevToken.value === '</') {
depth[tag]--;
}
if (depth[tag] === 0)
found = true;
}
}
} while (prevToken && !found);
}
if (token && token.type.indexOf('tag-name')) {
pos = range.start;
if (pos.row == cursor.row && Math.abs(pos.column - cursor.column) < 2)
pos = range.end;
}
}
pos = range && range.cursor || pos;
if (pos) {
if (select) {
if (range && expand) {
this.selection.setRange(range);
} else if (range && range.isEqual(this.getSelectionRange())) {
this.clearSelection();
} else {
this.selection.selectTo(pos.row, pos.column);
}
} else {
this.selection.moveTo(pos.row, pos.column);
}
}
};
this.gotoLine = function(lineNumber, column, animate) {
this.selection.clearSelection();
this.session.unfold({row: lineNumber - 1, column: column || 0});
this.$blockScrolling += 1;
this.exitMultiSelectMode && this.exitMultiSelectMode();
this.moveCursorTo(lineNumber - 1, column || 0);
this.$blockScrolling -= 1;
if (!this.isRowFullyVisible(lineNumber - 1))
this.scrollToLine(lineNumber - 1, true, animate);
};
this.navigateTo = function(row, column) {
this.selection.moveTo(row, column);
};
this.navigateUp = function(times) {
if (this.selection.isMultiLine() && !this.selection.isBackwards()) {
var selectionStart = this.selection.anchor.getPosition();
return this.moveCursorToPosition(selectionStart);
}
this.selection.clearSelection();
this.selection.moveCursorBy(-times || -1, 0);
};
this.navigateDown = function(times) {
if (this.selection.isMultiLine() && this.selection.isBackwards()) {
var selectionEnd = this.selection.anchor.getPosition();
return this.moveCursorToPosition(selectionEnd);
}
this.selection.clearSelection();
this.selection.moveCursorBy(times || 1, 0);
};
this.navigateLeft = function(times) {
if (!this.selection.isEmpty()) {
var selectionStart = this.getSelectionRange().start;
this.moveCursorToPosition(selectionStart);
}
else {
times = times || 1;
while (times--) {
this.selection.moveCursorLeft();
}
}
this.clearSelection();
};
this.navigateRight = function(times) {
if (!this.selection.isEmpty()) {
var selectionEnd = this.getSelectionRange().end;
this.moveCursorToPosition(selectionEnd);
}
else {
times = times || 1;
while (times--) {
this.selection.moveCursorRight();
}
}
this.clearSelection();
};
this.navigateLineStart = function() {
this.selection.moveCursorLineStart();
this.clearSelection();
};
this.navigateLineEnd = function() {
this.selection.moveCursorLineEnd();
this.clearSelection();
};
this.navigateFileEnd = function() {
this.selection.moveCursorFileEnd();
this.clearSelection();
};
this.navigateFileStart = function() {
this.selection.moveCursorFileStart();
this.clearSelection();
};
this.navigateWordRight = function() {
this.selection.moveCursorWordRight();
this.clearSelection();
};
this.navigateWordLeft = function() {
this.selection.moveCursorWordLeft();
this.clearSelection();
};
this.replace = function(replacement, options) {
if (options)
this.$search.set(options);
var range = this.$search.find(this.session);
var replaced = 0;
if (!range)
return replaced;
if (this.$tryReplace(range, replacement)) {
replaced = 1;
}
if (range !== null) {
this.selection.setSelectionRange(range);
this.renderer.scrollSelectionIntoView(range.start, range.end);
}
return replaced;
};
this.replaceAll = function(replacement, options) {
if (options) {
this.$search.set(options);
}
var ranges = this.$search.findAll(this.session);
var replaced = 0;
if (!ranges.length)
return replaced;
this.$blockScrolling += 1;
var selection = this.getSelectionRange();
this.selection.moveTo(0, 0);
for (var i = ranges.length - 1; i >= 0; --i) {
if(this.$tryReplace(ranges[i], replacement)) {
replaced++;
}
}
this.selection.setSelectionRange(selection);
this.$blockScrolling -= 1;
return replaced;
};
this.$tryReplace = function(range, replacement) {
var input = this.session.getTextRange(range);
replacement = this.$search.replace(input, replacement);
if (replacement !== null) {
range.end = this.session.replace(range, replacement);
return range;
} else {
return null;
}
};
this.getLastSearchOptions = function() {
return this.$search.getOptions();
};
this.find = function(needle, options, animate) {
if (!options)
options = {};
if (typeof needle == "string" || needle instanceof RegExp)
options.needle = needle;
else if (typeof needle == "object")
oop.mixin(options, needle);
var range = this.selection.getRange();
if (options.needle == null) {
needle = this.session.getTextRange(range)
|| this.$search.$options.needle;
if (!needle) {
range = this.session.getWordRange(range.start.row, range.start.column);
needle = this.session.getTextRange(range);
}
this.$search.set({needle: needle});
}
this.$search.set(options);
if (!options.start)
this.$search.set({start: range});
var newRange = this.$search.find(this.session);
if (options.preventScroll)
return newRange;
if (newRange) {
this.revealRange(newRange, animate);
return newRange;
}
if (options.backwards)
range.start = range.end;
else
range.end = range.start;
this.selection.setRange(range);
};
this.findNext = function(options, animate) {
this.find({skipCurrent: true, backwards: false}, options, animate);
};
this.findPrevious = function(options, animate) {
this.find(options, {skipCurrent: true, backwards: true}, animate);
};
this.revealRange = function(range, animate) {
this.$blockScrolling += 1;
this.session.unfold(range);
this.selection.setSelectionRange(range);
this.$blockScrolling -= 1;
var scrollTop = this.renderer.scrollTop;
this.renderer.scrollSelectionIntoView(range.start, range.end, 0.5);
if (animate !== false)
this.renderer.animateScrolling(scrollTop);
};
this.undo = function() {
this.$blockScrolling++;
this.session.getUndoManager().undo();
this.$blockScrolling--;
this.renderer.scrollCursorIntoView(null, 0.5);
};
this.redo = function() {
this.$blockScrolling++;
this.session.getUndoManager().redo();
this.$blockScrolling--;
this.renderer.scrollCursorIntoView(null, 0.5);
};
this.destroy = function() {
this.renderer.destroy();
this._signal("destroy", this);
if (this.session) {
this.session.destroy();
}
};
this.setAutoScrollEditorIntoView = function(enable) {
if (!enable)
return;
var rect;
var self = this;
var shouldScroll = false;
if (!this.$scrollAnchor)
this.$scrollAnchor = document.createElement("div");
var scrollAnchor = this.$scrollAnchor;
scrollAnchor.style.cssText = "position:absolute";
this.container.insertBefore(scrollAnchor, this.container.firstChild);
var onChangeSelection = this.on("changeSelection", function() {
shouldScroll = true;
});
var onBeforeRender = this.renderer.on("beforeRender", function() {
if (shouldScroll)
rect = self.renderer.container.getBoundingClientRect();
});
var onAfterRender = this.renderer.on("afterRender", function() {
if (shouldScroll && rect && (self.isFocused()
|| self.searchBox && self.searchBox.isFocused())
) {
var renderer = self.renderer;
var pos = renderer.$cursorLayer.$pixelPos;
var config = renderer.layerConfig;
var top = pos.top - config.offset;
if (pos.top >= 0 && top + rect.top < 0) {
shouldScroll = true;
} else if (pos.top < config.height &&
pos.top + rect.top + config.lineHeight > window.innerHeight) {
shouldScroll = false;
} else {
shouldScroll = null;
}
if (shouldScroll != null) {
scrollAnchor.style.top = top + "px";
scrollAnchor.style.left = pos.left + "px";
scrollAnchor.style.height = config.lineHeight + "px";
scrollAnchor.scrollIntoView(shouldScroll);
}
shouldScroll = rect = null;
}
});
this.setAutoScrollEditorIntoView = function(enable) {
if (enable)
return;
delete this.setAutoScrollEditorIntoView;
this.off("changeSelection", onChangeSelection);
this.renderer.off("afterRender", onAfterRender);
this.renderer.off("beforeRender", onBeforeRender);
};
};
this.$resetCursorStyle = function() {
var style = this.$cursorStyle || "ace";
var cursorLayer = this.renderer.$cursorLayer;
if (!cursorLayer)
return;
cursorLayer.setSmoothBlinking(/smooth/.test(style));
cursorLayer.isBlinking = !this.$readOnly && style != "wide";
dom.setCssClass(cursorLayer.element, "ace_slim-cursors", /slim/.test(style));
};
}).call(Editor.prototype);
config.defineOptions(Editor.prototype, "editor", {
selectionStyle: {
set: function(style) {
this.onSelectionChange();
this._signal("changeSelectionStyle", {data: style});
},
initialValue: "line"
},
highlightActiveLine: {
set: function() {this.$updateHighlightActiveLine();},
initialValue: true
},
highlightSelectedWord: {
set: function(shouldHighlight) {this.$onSelectionChange();},
initialValue: true
},
readOnly: {
set: function(readOnly) {
this.$resetCursorStyle();
},
initialValue: false
},
cursorStyle: {
set: function(val) { this.$resetCursorStyle(); },
values: ["ace", "slim", "smooth", "wide"],
initialValue: "ace"
},
mergeUndoDeltas: {
values: [false, true, "always"],
initialValue: true
},
behavioursEnabled: {initialValue: true},
wrapBehavioursEnabled: {initialValue: true},
autoScrollEditorIntoView: {
set: function(val) {this.setAutoScrollEditorIntoView(val)}
},
keyboardHandler: {
set: function(val) { this.setKeyboardHandler(val); },
get: function() { return this.keybindingId; },
handlesSet: true
},
hScrollBarAlwaysVisible: "renderer",
vScrollBarAlwaysVisible: "renderer",
highlightGutterLine: "renderer",
animatedScroll: "renderer",
showInvisibles: "renderer",
showPrintMargin: "renderer",
printMarginColumn: "renderer",
printMargin: "renderer",
fadeFoldWidgets: "renderer",
showFoldWidgets: "renderer",
showLineNumbers: "renderer",
showGutter: "renderer",
displayIndentGuides: "renderer",
fontSize: "renderer",
fontFamily: "renderer",
maxLines: "renderer",
minLines: "renderer",
scrollPastEnd: "renderer",
fixedWidthGutter: "renderer",
theme: "renderer",
scrollSpeed: "$mouseHandler",
dragDelay: "$mouseHandler",
dragEnabled: "$mouseHandler",
focusTimout: "$mouseHandler",
tooltipFollowsMouse: "$mouseHandler",
firstLineNumber: "session",
overwrite: "session",
newLineMode: "session",
useWorker: "session",
useSoftTabs: "session",
tabSize: "session",
wrap: "session",
indentedSoftWrap: "session",
foldStyle: "session",
mode: "session"
});
exports.Editor = Editor;
});
ace.define("ace/undomanager",["require","exports","module"], function(acequire, exports, module) {
"use strict";
var UndoManager = function() {
this.reset();
};
(function() {
this.execute = function(options) {
var deltaSets = options.args[0];
this.$doc = options.args[1];
if (options.merge && this.hasUndo()){
this.dirtyCounter--;
deltaSets = this.$undoStack.pop().concat(deltaSets);
}
this.$undoStack.push(deltaSets);
this.$redoStack = [];
if (this.dirtyCounter < 0) {
this.dirtyCounter = NaN;
}
this.dirtyCounter++;
};
this.undo = function(dontSelect) {
var deltaSets = this.$undoStack.pop();
var undoSelectionRange = null;
if (deltaSets) {
undoSelectionRange = this.$doc.undoChanges(deltaSets, dontSelect);
this.$redoStack.push(deltaSets);
this.dirtyCounter--;
}
return undoSelectionRange;
};
this.redo = function(dontSelect) {
var deltaSets = this.$redoStack.pop();
var redoSelectionRange = null;
if (deltaSets) {
redoSelectionRange =
this.$doc.redoChanges(this.$deserializeDeltas(deltaSets), dontSelect);
this.$undoStack.push(deltaSets);
this.dirtyCounter++;
}
return redoSelectionRange;
};
this.reset = function() {
this.$undoStack = [];
this.$redoStack = [];
this.dirtyCounter = 0;
};
this.hasUndo = function() {
return this.$undoStack.length > 0;
};
this.hasRedo = function() {
return this.$redoStack.length > 0;
};
this.markClean = function() {
this.dirtyCounter = 0;
};
this.isClean = function() {
return this.dirtyCounter === 0;
};
this.$serializeDeltas = function(deltaSets) {
return cloneDeltaSetsObj(deltaSets, $serializeDelta);
};
this.$deserializeDeltas = function(deltaSets) {
return cloneDeltaSetsObj(deltaSets, $deserializeDelta);
};
function $serializeDelta(delta){
return {
action: delta.action,
start: delta.start,
end: delta.end,
lines: delta.lines.length == 1 ? null : delta.lines,
text: delta.lines.length == 1 ? delta.lines[0] : null
};
}
function $deserializeDelta(delta) {
return {
action: delta.action,
start: delta.start,
end: delta.end,
lines: delta.lines || [delta.text]
};
}
function cloneDeltaSetsObj(deltaSets_old, fnGetModifiedDelta) {
var deltaSets_new = new Array(deltaSets_old.length);
for (var i = 0; i < deltaSets_old.length; i++) {
var deltaSet_old = deltaSets_old[i];
var deltaSet_new = { group: deltaSet_old.group, deltas: new Array(deltaSet_old.length)};
for (var j = 0; j < deltaSet_old.deltas.length; j++) {
var delta_old = deltaSet_old.deltas[j];
deltaSet_new.deltas[j] = fnGetModifiedDelta(delta_old);
}
deltaSets_new[i] = deltaSet_new;
}
return deltaSets_new;
}
}).call(UndoManager.prototype);
exports.UndoManager = UndoManager;
});
ace.define("ace/layer/gutter",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter"], function(acequire, exports, module) {
"use strict";
var dom = acequire("../lib/dom");
var oop = acequire("../lib/oop");
var lang = acequire("../lib/lang");
var EventEmitter = acequire("../lib/event_emitter").EventEmitter;
var Gutter = function(parentEl) {
this.element = dom.createElement("div");
this.element.className = "ace_layer ace_gutter-layer";
parentEl.appendChild(this.element);
this.setShowFoldWidgets(this.$showFoldWidgets);
this.gutterWidth = 0;
this.$annotations = [];
this.$updateAnnotations = this.$updateAnnotations.bind(this);
this.$cells = [];
};
(function() {
oop.implement(this, EventEmitter);
this.setSession = function(session) {
if (this.session)
this.session.removeEventListener("change", this.$updateAnnotations);
this.session = session;
if (session)
session.on("change", this.$updateAnnotations);
};
this.addGutterDecoration = function(row, className){
if (window.console)
console.warn && console.warn("deprecated use session.addGutterDecoration");
this.session.addGutterDecoration(row, className);
};
this.removeGutterDecoration = function(row, className){
if (window.console)
console.warn && console.warn("deprecated use session.removeGutterDecoration");
this.session.removeGutterDecoration(row, className);
};
this.setAnnotations = function(annotations) {
this.$annotations = [];
for (var i = 0; i < annotations.length; i++) {
var annotation = annotations[i];
var row = annotation.row;
var rowInfo = this.$annotations[row];
if (!rowInfo)
rowInfo = this.$annotations[row] = {text: []};
var annoText = annotation.text;
annoText = annoText ? lang.escapeHTML(annoText) : annotation.html || "";
if (rowInfo.text.indexOf(annoText) === -1)
rowInfo.text.push(annoText);
var type = annotation.type;
if (type == "error")
rowInfo.className = " ace_error";
else if (type == "warning" && rowInfo.className != " ace_error")
rowInfo.className = " ace_warning";
else if (type == "info" && (!rowInfo.className))
rowInfo.className = " ace_info";
}
};
this.$updateAnnotations = function (delta) {
if (!this.$annotations.length)
return;
var firstRow = delta.start.row;
var len = delta.end.row - firstRow;
if (len === 0) {
} else if (delta.action == 'remove') {
this.$annotations.splice(firstRow, len + 1, null);
} else {
var args = new Array(len + 1);
args.unshift(firstRow, 1);
this.$annotations.splice.apply(this.$annotations, args);
}
};
this.update = function(config) {
var session = this.session;
var firstRow = config.firstRow;
var lastRow = Math.min(config.lastRow + config.gutterOffset, // needed to compensate for hor scollbar
session.getLength() - 1);
var fold = session.getNextFoldLine(firstRow);
var foldStart = fold ? fold.start.row : Infinity;
var foldWidgets = this.$showFoldWidgets && session.foldWidgets;
var breakpoints = session.$breakpoints;
var decorations = session.$decorations;
var firstLineNumber = session.$firstLineNumber;
var lastLineNumber = 0;
var gutterRenderer = session.gutterRenderer || this.$renderer;
var cell = null;
var index = -1;
var row = firstRow;
while (true) {
if (row > foldStart) {
row = fold.end.row + 1;
fold = session.getNextFoldLine(row, fold);
foldStart = fold ? fold.start.row : Infinity;
}
if (row > lastRow) {
while (this.$cells.length > index + 1) {
cell = this.$cells.pop();
this.element.removeChild(cell.element);
}
break;
}
cell = this.$cells[++index];
if (!cell) {
cell = {element: null, textNode: null, foldWidget: null};
cell.element = dom.createElement("div");
cell.textNode = document.createTextNode('');
cell.element.appendChild(cell.textNode);
this.element.appendChild(cell.element);
this.$cells[index] = cell;
}
var className = "ace_gutter-cell ";
if (breakpoints[row])
className += breakpoints[row];
if (decorations[row])
className += decorations[row];
if (this.$annotations[row])
className += this.$annotations[row].className;
if (cell.element.className != className)
cell.element.className = className;
var height = session.getRowLength(row) * config.lineHeight + "px";
if (height != cell.element.style.height)
cell.element.style.height = height;
if (foldWidgets) {
var c = foldWidgets[row];
if (c == null)
c = foldWidgets[row] = session.getFoldWidget(row);
}
if (c) {
if (!cell.foldWidget) {
cell.foldWidget = dom.createElement("span");
cell.element.appendChild(cell.foldWidget);
}
var className = "ace_fold-widget ace_" + c;
if (c == "start" && row == foldStart && row < fold.end.row)
className += " ace_closed";
else
className += " ace_open";
if (cell.foldWidget.className != className)
cell.foldWidget.className = className;
var height = config.lineHeight + "px";
if (cell.foldWidget.style.height != height)
cell.foldWidget.style.height = height;
} else {
if (cell.foldWidget) {
cell.element.removeChild(cell.foldWidget);
cell.foldWidget = null;
}
}
var text = lastLineNumber = gutterRenderer
? gutterRenderer.getText(session, row)
: row + firstLineNumber;
if (text != cell.textNode.data)
cell.textNode.data = text;
row++;
}
this.element.style.height = config.minHeight + "px";
if (this.$fixedWidth || session.$useWrapMode)
lastLineNumber = session.getLength() + firstLineNumber;
var gutterWidth = gutterRenderer
? gutterRenderer.getWidth(session, lastLineNumber, config)
: lastLineNumber.toString().length * config.characterWidth;
var padding = this.$padding || this.$computePadding();
gutterWidth += padding.left + padding.right;
if (gutterWidth !== this.gutterWidth && !isNaN(gutterWidth)) {
this.gutterWidth = gutterWidth;
this.element.style.width = Math.ceil(this.gutterWidth) + "px";
this._emit("changeGutterWidth", gutterWidth);
}
};
this.$fixedWidth = false;
this.$showLineNumbers = true;
this.$renderer = "";
this.setShowLineNumbers = function(show) {
this.$renderer = !show && {
getWidth: function() {return ""},
getText: function() {return ""}
};
};
this.getShowLineNumbers = function() {
return this.$showLineNumbers;
};
this.$showFoldWidgets = true;
this.setShowFoldWidgets = function(show) {
if (show)
dom.addCssClass(this.element, "ace_folding-enabled");
else
dom.removeCssClass(this.element, "ace_folding-enabled");
this.$showFoldWidgets = show;
this.$padding = null;
};
this.getShowFoldWidgets = function() {
return this.$showFoldWidgets;
};
this.$computePadding = function() {
if (!this.element.firstChild)
return {left: 0, right: 0};
var style = dom.computedStyle(this.element.firstChild);
this.$padding = {};
this.$padding.left = parseInt(style.paddingLeft) + 1 || 0;
this.$padding.right = parseInt(style.paddingRight) || 0;
return this.$padding;
};
this.getRegion = function(point) {
var padding = this.$padding || this.$computePadding();
var rect = this.element.getBoundingClientRect();
if (point.x < padding.left + rect.left)
return "markers";
if (this.$showFoldWidgets && point.x > rect.right - padding.right)
return "foldWidgets";
};
}).call(Gutter.prototype);
exports.Gutter = Gutter;
});
ace.define("ace/layer/marker",["require","exports","module","ace/range","ace/lib/dom"], function(acequire, exports, module) {
"use strict";
var Range = acequire("../range").Range;
var dom = acequire("../lib/dom");
var Marker = function(parentEl) {
this.element = dom.createElement("div");
this.element.className = "ace_layer ace_marker-layer";
parentEl.appendChild(this.element);
};
(function() {
this.$padding = 0;
this.setPadding = function(padding) {
this.$padding = padding;
};
this.setSession = function(session) {
this.session = session;
};
this.setMarkers = function(markers) {
this.markers = markers;
};
this.update = function(config) {
var config = config || this.config;
if (!config)
return;
this.config = config;
var html = [];
for (var key in this.markers) {
var marker = this.markers[key];
if (!marker.range) {
marker.update(html, this, this.session, config);
continue;
}
var range = marker.range.clipRows(config.firstRow, config.lastRow);
if (range.isEmpty()) continue;
range = range.toScreenRange(this.session);
if (marker.renderer) {
var top = this.$getTop(range.start.row, config);
var left = this.$padding + range.start.column * config.characterWidth;
marker.renderer(html, range, left, top, config);
} else if (marker.type == "fullLine") {
this.drawFullLineMarker(html, range, marker.clazz, config);
} else if (marker.type == "screenLine") {
this.drawScreenLineMarker(html, range, marker.clazz, config);
} else if (range.isMultiLine()) {
if (marker.type == "text")
this.drawTextMarker(html, range, marker.clazz, config);
else
this.drawMultiLineMarker(html, range, marker.clazz, config);
} else {
this.drawSingleLineMarker(html, range, marker.clazz + " ace_start" + " ace_br15", config);
}
}
this.element.innerHTML = html.join("");
};
this.$getTop = function(row, layerConfig) {
return (row - layerConfig.firstRowScreen) * layerConfig.lineHeight;
};
function getBorderClass(tl, tr, br, bl) {
return (tl ? 1 : 0) | (tr ? 2 : 0) | (br ? 4 : 0) | (bl ? 8 : 0);
}
this.drawTextMarker = function(stringBuilder, range, clazz, layerConfig, extraStyle) {
var session = this.session;
var start = range.start.row;
var end = range.end.row;
var row = start;
var prev = 0;
var curr = 0;
var next = session.getScreenLastRowColumn(row);
var lineRange = new Range(row, range.start.column, row, curr);
for (; row <= end; row++) {
lineRange.start.row = lineRange.end.row = row;
lineRange.start.column = row == start ? range.start.column : session.getRowWrapIndent(row);
lineRange.end.column = next;
prev = curr;
curr = next;
next = row + 1 < end ? session.getScreenLastRowColumn(row + 1) : row == end ? 0 : range.end.column;
this.drawSingleLineMarker(stringBuilder, lineRange,
clazz + (row == start ? " ace_start" : "") + " ace_br"
+ getBorderClass(row == start || row == start + 1 && range.start.column, prev < curr, curr > next, row == end),
layerConfig, row == end ? 0 : 1, extraStyle);
}
};
this.drawMultiLineMarker = function(stringBuilder, range, clazz, config, extraStyle) {
var padding = this.$padding;
var height = config.lineHeight;
var top = this.$getTop(range.start.row, config);
var left = padding + range.start.column * config.characterWidth;
extraStyle = extraStyle || "";
stringBuilder.push(
"<div class='", clazz, " ace_br1 ace_start' style='",
"height:", height, "px;",
"right:0;",
"top:", top, "px;",
"left:", left, "px;", extraStyle, "'></div>"
);
top = this.$getTop(range.end.row, config);
var width = range.end.column * config.characterWidth;
stringBuilder.push(
"<div class='", clazz, " ace_br12' style='",
"height:", height, "px;",
"width:", width, "px;",
"top:", top, "px;",
"left:", padding, "px;", extraStyle, "'></div>"
);
height = (range.end.row - range.start.row - 1) * config.lineHeight;
if (height <= 0)
return;
top = this.$getTop(range.start.row + 1, config);
var radiusClass = (range.start.column ? 1 : 0) | (range.end.column ? 0 : 8);
stringBuilder.push(
"<div class='", clazz, (radiusClass ? " ace_br" + radiusClass : ""), "' style='",
"height:", height, "px;",
"right:0;",
"top:", top, "px;",
"left:", padding, "px;", extraStyle, "'></div>"
);
};
this.drawSingleLineMarker = function(stringBuilder, range, clazz, config, extraLength, extraStyle) {
var height = config.lineHeight;
var width = (range.end.column + (extraLength || 0) - range.start.column) * config.characterWidth;
var top = this.$getTop(range.start.row, config);
var left = this.$padding + range.start.column * config.characterWidth;
stringBuilder.push(
"<div class='", clazz, "' style='",
"height:", height, "px;",
"width:", width, "px;",
"top:", top, "px;",
"left:", left, "px;", extraStyle || "", "'></div>"
);
};
this.drawFullLineMarker = function(stringBuilder, range, clazz, config, extraStyle) {
var top = this.$getTop(range.start.row, config);
var height = config.lineHeight;
if (range.start.row != range.end.row)
height += this.$getTop(range.end.row, config) - top;
stringBuilder.push(
"<div class='", clazz, "' style='",
"height:", height, "px;",
"top:", top, "px;",
"left:0;right:0;", extraStyle || "", "'></div>"
);
};
this.drawScreenLineMarker = function(stringBuilder, range, clazz, config, extraStyle) {
var top = this.$getTop(range.start.row, config);
var height = config.lineHeight;
stringBuilder.push(
"<div class='", clazz, "' style='",
"height:", height, "px;",
"top:", top, "px;",
"left:0;right:0;", extraStyle || "", "'></div>"
);
};
}).call(Marker.prototype);
exports.Marker = Marker;
});
ace.define("ace/layer/text",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/useragent","ace/lib/event_emitter"], function(acequire, exports, module) {
"use strict";
var oop = acequire("../lib/oop");
var dom = acequire("../lib/dom");
var lang = acequire("../lib/lang");
var useragent = acequire("../lib/useragent");
var EventEmitter = acequire("../lib/event_emitter").EventEmitter;
var Text = function(parentEl) {
this.element = dom.createElement("div");
this.element.className = "ace_layer ace_text-layer";
parentEl.appendChild(this.element);
this.$updateEolChar = this.$updateEolChar.bind(this);
};
(function() {
oop.implement(this, EventEmitter);
this.EOF_CHAR = "\xB6";
this.EOL_CHAR_LF = "\xAC";
this.EOL_CHAR_CRLF = "\xa4";
this.EOL_CHAR = this.EOL_CHAR_LF;
this.TAB_CHAR = "\u2014"; //"\u21E5";
this.SPACE_CHAR = "\xB7";
this.$padding = 0;
this.$updateEolChar = function() {
var EOL_CHAR = this.session.doc.getNewLineCharacter() == "\n"
? this.EOL_CHAR_LF
: this.EOL_CHAR_CRLF;
if (this.EOL_CHAR != EOL_CHAR) {
this.EOL_CHAR = EOL_CHAR;
return true;
}
}
this.setPadding = function(padding) {
this.$padding = padding;
this.element.style.padding = "0 " + padding + "px";
};
this.getLineHeight = function() {
return this.$fontMetrics.$characterSize.height || 0;
};
this.getCharacterWidth = function() {
return this.$fontMetrics.$characterSize.width || 0;
};
this.$setFontMetrics = function(measure) {
this.$fontMetrics = measure;
this.$fontMetrics.on("changeCharacterSize", function(e) {
this._signal("changeCharacterSize", e);
}.bind(this));
this.$pollSizeChanges();
}
this.checkForSizeChanges = function() {
this.$fontMetrics.checkForSizeChanges();
};
this.$pollSizeChanges = function() {
return this.$pollSizeChangesTimer = this.$fontMetrics.$pollSizeChanges();
};
this.setSession = function(session) {
this.session = session;
if (session)
this.$computeTabString();
};
this.showInvisibles = false;
this.setShowInvisibles = function(showInvisibles) {
if (this.showInvisibles == showInvisibles)
return false;
this.showInvisibles = showInvisibles;
this.$computeTabString();
return true;
};
this.displayIndentGuides = true;
this.setDisplayIndentGuides = function(display) {
if (this.displayIndentGuides == display)
return false;
this.displayIndentGuides = display;
this.$computeTabString();
return true;
};
this.$tabStrings = [];
this.onChangeTabSize =
this.$computeTabString = function() {
var tabSize = this.session.getTabSize();
this.tabSize = tabSize;
var tabStr = this.$tabStrings = [0];
for (var i = 1; i < tabSize + 1; i++) {
if (this.showInvisibles) {
tabStr.push("<span class='ace_invisible ace_invisible_tab'>"
+ lang.stringRepeat(this.TAB_CHAR, i)
+ "</span>");
} else {
tabStr.push(lang.stringRepeat(" ", i));
}
}
if (this.displayIndentGuides) {
this.$indentGuideRe = /\s\S| \t|\t |\s$/;
var className = "ace_indent-guide";
var spaceClass = "";
var tabClass = "";
if (this.showInvisibles) {
className += " ace_invisible";
spaceClass = " ace_invisible_space";
tabClass = " ace_invisible_tab";
var spaceContent = lang.stringRepeat(this.SPACE_CHAR, this.tabSize);
var tabContent = lang.stringRepeat(this.TAB_CHAR, this.tabSize);
} else{
var spaceContent = lang.stringRepeat(" ", this.tabSize);
var tabContent = spaceContent;
}
this.$tabStrings[" "] = "<span class='" + className + spaceClass + "'>" + spaceContent + "</span>";
this.$tabStrings["\t"] = "<span class='" + className + tabClass + "'>" + tabContent + "</span>";
}
};
this.updateLines = function(config, firstRow, lastRow) {
if (this.config.lastRow != config.lastRow ||
this.config.firstRow != config.firstRow) {
this.scrollLines(config);
}
this.config = config;
var first = Math.max(firstRow, config.firstRow);
var last = Math.min(lastRow, config.lastRow);
var lineElements = this.element.childNodes;
var lineElementsIdx = 0;
for (var row = config.firstRow; row < first; row++) {
var foldLine = this.session.getFoldLine(row);
if (foldLine) {
if (foldLine.containsRow(first)) {
first = foldLine.start.row;
break;
} else {
row = foldLine.end.row;
}
}
lineElementsIdx ++;
}
var row = first;
var foldLine = this.session.getNextFoldLine(row);
var foldStart = foldLine ? foldLine.start.row : Infinity;
while (true) {
if (row > foldStart) {
row = foldLine.end.row+1;
foldLine = this.session.getNextFoldLine(row, foldLine);
foldStart = foldLine ? foldLine.start.row :Infinity;
}
if (row > last)
break;
var lineElement = lineElements[lineElementsIdx++];
if (lineElement) {
var html = [];
this.$renderLine(
html, row, !this.$useLineGroups(), row == foldStart ? foldLine : false
);
lineElement.style.height = config.lineHeight * this.session.getRowLength(row) + "px";
lineElement.innerHTML = html.join("");
}
row++;
}
};
this.scrollLines = function(config) {
var oldConfig = this.config;
this.config = config;
if (!oldConfig || oldConfig.lastRow < config.firstRow)
return this.update(config);
if (config.lastRow < oldConfig.firstRow)
return this.update(config);
var el = this.element;
if (oldConfig.firstRow < config.firstRow)
for (var row=this.session.getFoldedRowCount(oldConfig.firstRow, config.firstRow - 1); row>0; row--)
el.removeChild(el.firstChild);
if (oldConfig.lastRow > config.lastRow)
for (var row=this.session.getFoldedRowCount(config.lastRow + 1, oldConfig.lastRow); row>0; row--)
el.removeChild(el.lastChild);
if (config.firstRow < oldConfig.firstRow) {
var fragment = this.$renderLinesFragment(config, config.firstRow, oldConfig.firstRow - 1);
if (el.firstChild)
el.insertBefore(fragment, el.firstChild);
else
el.appendChild(fragment);
}
if (config.lastRow > oldConfig.lastRow) {
var fragment = this.$renderLinesFragment(config, oldConfig.lastRow + 1, config.lastRow);
el.appendChild(fragment);
}
};
this.$renderLinesFragment = function(config, firstRow, lastRow) {
var fragment = this.element.ownerDocument.createDocumentFragment();
var row = firstRow;
var foldLine = this.session.getNextFoldLine(row);
var foldStart = foldLine ? foldLine.start.row : Infinity;
while (true) {
if (row > foldStart) {
row = foldLine.end.row+1;
foldLine = this.session.getNextFoldLine(row, foldLine);
foldStart = foldLine ? foldLine.start.row : Infinity;
}
if (row > lastRow)
break;
var container = dom.createElement("div");
var html = [];
this.$renderLine(html, row, false, row == foldStart ? foldLine : false);
container.innerHTML = html.join("");
if (this.$useLineGroups()) {
container.className = 'ace_line_group';
fragment.appendChild(container);
container.style.height = config.lineHeight * this.session.getRowLength(row) + "px";
} else {
while(container.firstChild)
fragment.appendChild(container.firstChild);
}
row++;
}
return fragment;
};
this.update = function(config) {
this.config = config;
var html = [];
var firstRow = config.firstRow, lastRow = config.lastRow;
var row = firstRow;
var foldLine = this.session.getNextFoldLine(row);
var foldStart = foldLine ? foldLine.start.row : Infinity;
while (true) {
if (row > foldStart) {
row = foldLine.end.row+1;
foldLine = this.session.getNextFoldLine(row, foldLine);
foldStart = foldLine ? foldLine.start.row :Infinity;
}
if (row > lastRow)
break;
if (this.$useLineGroups())
html.push("<div class='ace_line_group' style='height:", config.lineHeight*this.session.getRowLength(row), "px'>")
this.$renderLine(html, row, false, row == foldStart ? foldLine : false);
if (this.$useLineGroups())
html.push("</div>"); // end the line group
row++;
}
this.element.innerHTML = html.join("");
};
this.$textToken = {
"text": true,
"rparen": true,
"lparen": true
};
this.$renderToken = function(stringBuilder, screenColumn, token, value) {
var self = this;
var replaceReg = /\t|&|<|>|( +)|([\x00-\x1f\x80-\xa0\xad\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\u3000\uFEFF\uFFF9-\uFFFC])|[\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3000-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]/g;
var replaceFunc = function(c, a, b, tabIdx, idx4) {
if (a) {
return self.showInvisibles
? "<span class='ace_invisible ace_invisible_space'>" + lang.stringRepeat(self.SPACE_CHAR, c.length) + "</span>"
: c;
} else if (c == "&") {
return "&";
} else if (c == "<") {
return "<";
} else if (c == ">") {
return ">";
} else if (c == "\t") {
var tabSize = self.session.getScreenTabSize(screenColumn + tabIdx);
screenColumn += tabSize - 1;
return self.$tabStrings[tabSize];
} else if (c == "\u3000") {
var classToUse = self.showInvisibles ? "ace_cjk ace_invisible ace_invisible_space" : "ace_cjk";
var space = self.showInvisibles ? self.SPACE_CHAR : "";
screenColumn += 1;
return "<span class='" + classToUse + "' style='width:" +
(self.config.characterWidth * 2) +
"px'>" + space + "</span>";
} else if (b) {
return "<span class='ace_invisible ace_invisible_space ace_invalid'>" + self.SPACE_CHAR + "</span>";
} else {
screenColumn += 1;
return "<span class='ace_cjk' style='width:" +
(self.config.characterWidth * 2) +
"px'>" + c + "</span>";
}
};
var output = value.replace(replaceReg, replaceFunc);
if (!this.$textToken[token.type]) {
var classes = "ace_" + token.type.replace(/\./g, " ace_");
var style = "";
if (token.type == "fold")
style = " style='width:" + (token.value.length * this.config.characterWidth) + "px;' ";
stringBuilder.push("<span class='", classes, "'", style, ">", output, "</span>");
}
else {
stringBuilder.push(output);
}
return screenColumn + value.length;
};
this.renderIndentGuide = function(stringBuilder, value, max) {
var cols = value.search(this.$indentGuideRe);
if (cols <= 0 || cols >= max)
return value;
if (value[0] == " ") {
cols -= cols % this.tabSize;
stringBuilder.push(lang.stringRepeat(this.$tabStrings[" "], cols/this.tabSize));
return value.substr(cols);
} else if (value[0] == "\t") {
stringBuilder.push(lang.stringRepeat(this.$tabStrings["\t"], cols));
return value.substr(cols);
}
return value;
};
this.$renderWrappedLine = function(stringBuilder, tokens, splits, onlyContents) {
var chars = 0;
var split = 0;
var splitChars = splits[0];
var screenColumn = 0;
for (var i = 0; i < tokens.length; i++) {
var token = tokens[i];
var value = token.value;
if (i == 0 && this.displayIndentGuides) {
chars = value.length;
value = this.renderIndentGuide(stringBuilder, value, splitChars);
if (!value)
continue;
chars -= value.length;
}
if (chars + value.length < splitChars) {
screenColumn = this.$renderToken(stringBuilder, screenColumn, token, value);
chars += value.length;
} else {
while (chars + value.length >= splitChars) {
screenColumn = this.$renderToken(
stringBuilder, screenColumn,
token, value.substring(0, splitChars - chars)
);
value = value.substring(splitChars - chars);
chars = splitChars;
if (!onlyContents) {
stringBuilder.push("</div>",
"<div class='ace_line' style='height:",
this.config.lineHeight, "px'>"
);
}
stringBuilder.push(lang.stringRepeat("\xa0", splits.indent));
split ++;
screenColumn = 0;
splitChars = splits[split] || Number.MAX_VALUE;
}
if (value.length != 0) {
chars += value.length;
screenColumn = this.$renderToken(
stringBuilder, screenColumn, token, value
);
}
}
}
};
this.$renderSimpleLine = function(stringBuilder, tokens) {
var screenColumn = 0;
var token = tokens[0];
var value = token.value;
if (this.displayIndentGuides)
value = this.renderIndentGuide(stringBuilder, value);
if (value)
screenColumn = this.$renderToken(stringBuilder, screenColumn, token, value);
for (var i = 1; i < tokens.length; i++) {
token = tokens[i];
value = token.value;
screenColumn = this.$renderToken(stringBuilder, screenColumn, token, value);
}
};
this.$renderLine = function(stringBuilder, row, onlyContents, foldLine) {
if (!foldLine && foldLine != false)
foldLine = this.session.getFoldLine(row);
if (foldLine)
var tokens = this.$getFoldLineTokens(row, foldLine);
else
var tokens = this.session.getTokens(row);
if (!onlyContents) {
stringBuilder.push(
"<div class='ace_line' style='height:",
this.config.lineHeight * (
this.$useLineGroups() ? 1 :this.session.getRowLength(row)
), "px'>"
);
}
if (tokens.length) {
var splits = this.session.getRowSplitData(row);
if (splits && splits.length)
this.$renderWrappedLine(stringBuilder, tokens, splits, onlyContents);
else
this.$renderSimpleLine(stringBuilder, tokens);
}
if (this.showInvisibles) {
if (foldLine)
row = foldLine.end.row
stringBuilder.push(
"<span class='ace_invisible ace_invisible_eol'>",
row == this.session.getLength() - 1 ? this.EOF_CHAR : this.EOL_CHAR,
"</span>"
);
}
if (!onlyContents)
stringBuilder.push("</div>");
};
this.$getFoldLineTokens = function(row, foldLine) {
var session = this.session;
var renderTokens = [];
function addTokens(tokens, from, to) {
var idx = 0, col = 0;
while ((col + tokens[idx].value.length) < from) {
col += tokens[idx].value.length;
idx++;
if (idx == tokens.length)
return;
}
if (col != from) {
var value = tokens[idx].value.substring(from - col);
if (value.length > (to - from))
value = value.substring(0, to - from);
renderTokens.push({
type: tokens[idx].type,
value: value
});
col = from + value.length;
idx += 1;
}
while (col < to && idx < tokens.length) {
var value = tokens[idx].value;
if (value.length + col > to) {
renderTokens.push({
type: tokens[idx].type,
value: value.substring(0, to - col)
});
} else
renderTokens.push(tokens[idx]);
col += value.length;
idx += 1;
}
}
var tokens = session.getTokens(row);
foldLine.walk(function(placeholder, row, column, lastColumn, isNewRow) {
if (placeholder != null) {
renderTokens.push({
type: "fold",
value: placeholder
});
} else {
if (isNewRow)
tokens = session.getTokens(row);
if (tokens.length)
addTokens(tokens, lastColumn, column);
}
}, foldLine.end.row, this.session.getLine(foldLine.end.row).length);
return renderTokens;
};
this.$useLineGroups = function() {
return this.session.getUseWrapMode();
};
this.destroy = function() {
clearInterval(this.$pollSizeChangesTimer);
if (this.$measureNode)
this.$measureNode.parentNode.removeChild(this.$measureNode);
delete this.$measureNode;
};
}).call(Text.prototype);
exports.Text = Text;
});
ace.define("ace/layer/cursor",["require","exports","module","ace/lib/dom"], function(acequire, exports, module) {
"use strict";
var dom = acequire("../lib/dom");
var isIE8;
var Cursor = function(parentEl) {
this.element = dom.createElement("div");
this.element.className = "ace_layer ace_cursor-layer";
parentEl.appendChild(this.element);
if (isIE8 === undefined)
isIE8 = !("opacity" in this.element.style);
this.isVisible = false;
this.isBlinking = true;
this.blinkInterval = 1000;
this.smoothBlinking = false;
this.cursors = [];
this.cursor = this.addCursor();
dom.addCssClass(this.element, "ace_hidden-cursors");
this.$updateCursors = (isIE8
? this.$updateVisibility
: this.$updateOpacity).bind(this);
};
(function() {
this.$updateVisibility = function(val) {
var cursors = this.cursors;
for (var i = cursors.length; i--; )
cursors[i].style.visibility = val ? "" : "hidden";
};
this.$updateOpacity = function(val) {
var cursors = this.cursors;
for (var i = cursors.length; i--; )
cursors[i].style.opacity = val ? "" : "0";
};
this.$padding = 0;
this.setPadding = function(padding) {
this.$padding = padding;
};
this.setSession = function(session) {
this.session = session;
};
this.setBlinking = function(blinking) {
if (blinking != this.isBlinking){
this.isBlinking = blinking;
this.restartTimer();
}
};
this.setBlinkInterval = function(blinkInterval) {
if (blinkInterval != this.blinkInterval){
this.blinkInterval = blinkInterval;
this.restartTimer();
}
};
this.setSmoothBlinking = function(smoothBlinking) {
if (smoothBlinking != this.smoothBlinking && !isIE8) {
this.smoothBlinking = smoothBlinking;
dom.setCssClass(this.element, "ace_smooth-blinking", smoothBlinking);
this.$updateCursors(true);
this.$updateCursors = (this.$updateOpacity).bind(this);
this.restartTimer();
}
};
this.addCursor = function() {
var el = dom.createElement("div");
el.className = "ace_cursor";
this.element.appendChild(el);
this.cursors.push(el);
return el;
};
this.removeCursor = function() {
if (this.cursors.length > 1) {
var el = this.cursors.pop();
el.parentNode.removeChild(el);
return el;
}
};
this.hideCursor = function() {
this.isVisible = false;
dom.addCssClass(this.element, "ace_hidden-cursors");
this.restartTimer();
};
this.showCursor = function() {
this.isVisible = true;
dom.removeCssClass(this.element, "ace_hidden-cursors");
this.restartTimer();
};
this.restartTimer = function() {
var update = this.$updateCursors;
clearInterval(this.intervalId);
clearTimeout(this.timeoutId);
if (this.smoothBlinking) {
dom.removeCssClass(this.element, "ace_smooth-blinking");
}
update(true);
if (!this.isBlinking || !this.blinkInterval || !this.isVisible)
return;
if (this.smoothBlinking) {
setTimeout(function(){
dom.addCssClass(this.element, "ace_smooth-blinking");
}.bind(this));
}
var blink = function(){
this.timeoutId = setTimeout(function() {
update(false);
}, 0.6 * this.blinkInterval);
}.bind(this);
this.intervalId = setInterval(function() {
update(true);
blink();
}, this.blinkInterval);
blink();
};
this.getPixelPosition = function(position, onScreen) {
if (!this.config || !this.session)
return {left : 0, top : 0};
if (!position)
position = this.session.selection.getCursor();
var pos = this.session.documentToScreenPosition(position);
var cursorLeft = this.$padding + pos.column * this.config.characterWidth;
var cursorTop = (pos.row - (onScreen ? this.config.firstRowScreen : 0)) *
this.config.lineHeight;
return {left : cursorLeft, top : cursorTop};
};
this.update = function(config) {
this.config = config;
var selections = this.session.$selectionMarkers;
var i = 0, cursorIndex = 0;
if (selections === undefined || selections.length === 0){
selections = [{cursor: null}];
}
for (var i = 0, n = selections.length; i < n; i++) {
var pixelPos = this.getPixelPosition(selections[i].cursor, true);
if ((pixelPos.top > config.height + config.offset ||
pixelPos.top < 0) && i > 1) {
continue;
}
var style = (this.cursors[cursorIndex++] || this.addCursor()).style;
if (!this.drawCursor) {
style.left = pixelPos.left + "px";
style.top = pixelPos.top + "px";
style.width = config.characterWidth + "px";
style.height = config.lineHeight + "px";
} else {
this.drawCursor(style, pixelPos, config, selections[i], this.session);
}
}
while (this.cursors.length > cursorIndex)
this.removeCursor();
var overwrite = this.session.getOverwrite();
this.$setOverwrite(overwrite);
this.$pixelPos = pixelPos;
this.restartTimer();
};
this.drawCursor = null;
this.$setOverwrite = function(overwrite) {
if (overwrite != this.overwrite) {
this.overwrite = overwrite;
if (overwrite)
dom.addCssClass(this.element, "ace_overwrite-cursors");
else
dom.removeCssClass(this.element, "ace_overwrite-cursors");
}
};
this.destroy = function() {
clearInterval(this.intervalId);
clearTimeout(this.timeoutId);
};
}).call(Cursor.prototype);
exports.Cursor = Cursor;
});
ace.define("ace/scrollbar",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"], function(acequire, exports, module) {
"use strict";
var oop = acequire("./lib/oop");
var dom = acequire("./lib/dom");
var event = acequire("./lib/event");
var EventEmitter = acequire("./lib/event_emitter").EventEmitter;
var MAX_SCROLL_H = 0x8000;
var ScrollBar = function(parent) {
this.element = dom.createElement("div");
this.element.className = "ace_scrollbar ace_scrollbar" + this.classSuffix;
this.inner = dom.createElement("div");
this.inner.className = "ace_scrollbar-inner";
this.element.appendChild(this.inner);
parent.appendChild(this.element);
this.setVisible(false);
this.skipEvent = false;
event.addListener(this.element, "scroll", this.onScroll.bind(this));
event.addListener(this.element, "mousedown", event.preventDefault);
};
(function() {
oop.implement(this, EventEmitter);
this.setVisible = function(isVisible) {
this.element.style.display = isVisible ? "" : "none";
this.isVisible = isVisible;
this.coeff = 1;
};
}).call(ScrollBar.prototype);
var VScrollBar = function(parent, renderer) {
ScrollBar.call(this, parent);
this.scrollTop = 0;
this.scrollHeight = 0;
renderer.$scrollbarWidth =
this.width = dom.scrollbarWidth(parent.ownerDocument);
this.inner.style.width =
this.element.style.width = (this.width || 15) + 5 + "px";
};
oop.inherits(VScrollBar, ScrollBar);
(function() {
this.classSuffix = '-v';
this.onScroll = function() {
if (!this.skipEvent) {
this.scrollTop = this.element.scrollTop;
if (this.coeff != 1) {
var h = this.element.clientHeight / this.scrollHeight;
this.scrollTop = this.scrollTop * (1 - h) / (this.coeff - h);
}
this._emit("scroll", {data: this.scrollTop});
}
this.skipEvent = false;
};
this.getWidth = function() {
return this.isVisible ? this.width : 0;
};
this.setHeight = function(height) {
this.element.style.height = height + "px";
};
this.setInnerHeight =
this.setScrollHeight = function(height) {
this.scrollHeight = height;
if (height > MAX_SCROLL_H) {
this.coeff = MAX_SCROLL_H / height;
height = MAX_SCROLL_H;
} else if (this.coeff != 1) {
this.coeff = 1
}
this.inner.style.height = height + "px";
};
this.setScrollTop = function(scrollTop) {
if (this.scrollTop != scrollTop) {
this.skipEvent = true;
this.scrollTop = scrollTop;
this.element.scrollTop = scrollTop * this.coeff;
}
};
}).call(VScrollBar.prototype);
var HScrollBar = function(parent, renderer) {
ScrollBar.call(this, parent);
this.scrollLeft = 0;
this.height = renderer.$scrollbarWidth;
this.inner.style.height =
this.element.style.height = (this.height || 15) + 5 + "px";
};
oop.inherits(HScrollBar, ScrollBar);
(function() {
this.classSuffix = '-h';
this.onScroll = function() {
if (!this.skipEvent) {
this.scrollLeft = this.element.scrollLeft;
this._emit("scroll", {data: this.scrollLeft});
}
this.skipEvent = false;
};
this.getHeight = function() {
return this.isVisible ? this.height : 0;
};
this.setWidth = function(width) {
this.element.style.width = width + "px";
};
this.setInnerWidth = function(width) {
this.inner.style.width = width + "px";
};
this.setScrollWidth = function(width) {
this.inner.style.width = width + "px";
};
this.setScrollLeft = function(scrollLeft) {
if (this.scrollLeft != scrollLeft) {
this.skipEvent = true;
this.scrollLeft = this.element.scrollLeft = scrollLeft;
}
};
}).call(HScrollBar.prototype);
exports.ScrollBar = VScrollBar; // backward compatibility
exports.ScrollBarV = VScrollBar; // backward compatibility
exports.ScrollBarH = HScrollBar; // backward compatibility
exports.VScrollBar = VScrollBar;
exports.HScrollBar = HScrollBar;
});
ace.define("ace/renderloop",["require","exports","module","ace/lib/event"], function(acequire, exports, module) {
"use strict";
var event = acequire("./lib/event");
var RenderLoop = function(onRender, win) {
this.onRender = onRender;
this.pending = false;
this.changes = 0;
this.window = win || window;
};
(function() {
this.schedule = function(change) {
this.changes = this.changes | change;
if (!this.pending && this.changes) {
this.pending = true;
var _self = this;
event.nextFrame(function() {
_self.pending = false;
var changes;
while (changes = _self.changes) {
_self.changes = 0;
_self.onRender(changes);
}
}, this.window);
}
};
}).call(RenderLoop.prototype);
exports.RenderLoop = RenderLoop;
});
ace.define("ace/layer/font_metrics",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/useragent","ace/lib/event_emitter"], function(acequire, exports, module) {
var oop = acequire("../lib/oop");
var dom = acequire("../lib/dom");
var lang = acequire("../lib/lang");
var useragent = acequire("../lib/useragent");
var EventEmitter = acequire("../lib/event_emitter").EventEmitter;
var CHAR_COUNT = 0;
var FontMetrics = exports.FontMetrics = function(parentEl) {
this.el = dom.createElement("div");
this.$setMeasureNodeStyles(this.el.style, true);
this.$main = dom.createElement("div");
this.$setMeasureNodeStyles(this.$main.style);
this.$measureNode = dom.createElement("div");
this.$setMeasureNodeStyles(this.$measureNode.style);
this.el.appendChild(this.$main);
this.el.appendChild(this.$measureNode);
parentEl.appendChild(this.el);
if (!CHAR_COUNT)
this.$testFractionalRect();
this.$measureNode.innerHTML = lang.stringRepeat("X", CHAR_COUNT);
this.$characterSize = {width: 0, height: 0};
this.checkForSizeChanges();
};
(function() {
oop.implement(this, EventEmitter);
this.$characterSize = {width: 0, height: 0};
this.$testFractionalRect = function() {
var el = dom.createElement("div");
this.$setMeasureNodeStyles(el.style);
el.style.width = "0.2px";
document.documentElement.appendChild(el);
var w = el.getBoundingClientRect().width;
if (w > 0 && w < 1)
CHAR_COUNT = 50;
else
CHAR_COUNT = 100;
el.parentNode.removeChild(el);
};
this.$setMeasureNodeStyles = function(style, isRoot) {
style.width = style.height = "auto";
style.left = style.top = "0px";
style.visibility = "hidden";
style.position = "absolute";
style.whiteSpace = "pre";
if (useragent.isIE < 8) {
style["font-family"] = "inherit";
} else {
style.font = "inherit";
}
style.overflow = isRoot ? "hidden" : "visible";
};
this.checkForSizeChanges = function() {
var size = this.$measureSizes();
if (size && (this.$characterSize.width !== size.width || this.$characterSize.height !== size.height)) {
this.$measureNode.style.fontWeight = "bold";
var boldSize = this.$measureSizes();
this.$measureNode.style.fontWeight = "";
this.$characterSize = size;
this.charSizes = Object.create(null);
this.allowBoldFonts = boldSize && boldSize.width === size.width && boldSize.height === size.height;
this._emit("changeCharacterSize", {data: size});
}
};
this.$pollSizeChanges = function() {
if (this.$pollSizeChangesTimer)
return this.$pollSizeChangesTimer;
var self = this;
return this.$pollSizeChangesTimer = setInterval(function() {
self.checkForSizeChanges();
}, 500);
};
this.setPolling = function(val) {
if (val) {
this.$pollSizeChanges();
} else if (this.$pollSizeChangesTimer) {
clearInterval(this.$pollSizeChangesTimer);
this.$pollSizeChangesTimer = 0;
}
};
this.$measureSizes = function() {
if (CHAR_COUNT === 50) {
var rect = null;
try {
rect = this.$measureNode.getBoundingClientRect();
} catch(e) {
rect = {width: 0, height:0 };
}
var size = {
height: rect.height,
width: rect.width / CHAR_COUNT
};
} else {
var size = {
height: this.$measureNode.clientHeight,
width: this.$measureNode.clientWidth / CHAR_COUNT
};
}
if (size.width === 0 || size.height === 0)
return null;
return size;
};
this.$measureCharWidth = function(ch) {
this.$main.innerHTML = lang.stringRepeat(ch, CHAR_COUNT);
var rect = this.$main.getBoundingClientRect();
return rect.width / CHAR_COUNT;
};
this.getCharacterWidth = function(ch) {
var w = this.charSizes[ch];
if (w === undefined) {
w = this.charSizes[ch] = this.$measureCharWidth(ch) / this.$characterSize.width;
}
return w;
};
this.destroy = function() {
clearInterval(this.$pollSizeChangesTimer);
if (this.el && this.el.parentNode)
this.el.parentNode.removeChild(this.el);
};
}).call(FontMetrics.prototype);
});
ace.define("ace/virtual_renderer",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/config","ace/lib/useragent","ace/layer/gutter","ace/layer/marker","ace/layer/text","ace/layer/cursor","ace/scrollbar","ace/scrollbar","ace/renderloop","ace/layer/font_metrics","ace/lib/event_emitter"], function(acequire, exports, module) {
"use strict";
var oop = acequire("./lib/oop");
var dom = acequire("./lib/dom");
var config = acequire("./config");
var useragent = acequire("./lib/useragent");
var GutterLayer = acequire("./layer/gutter").Gutter;
var MarkerLayer = acequire("./layer/marker").Marker;
var TextLayer = acequire("./layer/text").Text;
var CursorLayer = acequire("./layer/cursor").Cursor;
var HScrollBar = acequire("./scrollbar").HScrollBar;
var VScrollBar = acequire("./scrollbar").VScrollBar;
var RenderLoop = acequire("./renderloop").RenderLoop;
var FontMetrics = acequire("./layer/font_metrics").FontMetrics;
var EventEmitter = acequire("./lib/event_emitter").EventEmitter;
var editorCss = ".ace_editor {\
position: relative;\
overflow: hidden;\
font: 12px/normal 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;\
direction: ltr;\
text-align: left;\
}\
.ace_scroller {\
position: absolute;\
overflow: hidden;\
top: 0;\
bottom: 0;\
background-color: inherit;\
-ms-user-select: none;\
-moz-user-select: none;\
-webkit-user-select: none;\
user-select: none;\
cursor: text;\
}\
.ace_content {\
position: absolute;\
-moz-box-sizing: border-box;\
-webkit-box-sizing: border-box;\
box-sizing: border-box;\
min-width: 100%;\
}\
.ace_dragging .ace_scroller:before{\
position: absolute;\
top: 0;\
left: 0;\
right: 0;\
bottom: 0;\
content: '';\
background: rgba(250, 250, 250, 0.01);\
z-index: 1000;\
}\
.ace_dragging.ace_dark .ace_scroller:before{\
background: rgba(0, 0, 0, 0.01);\
}\
.ace_selecting, .ace_selecting * {\
cursor: text !important;\
}\
.ace_gutter {\
position: absolute;\
overflow : hidden;\
width: auto;\
top: 0;\
bottom: 0;\
left: 0;\
cursor: default;\
z-index: 4;\
-ms-user-select: none;\
-moz-user-select: none;\
-webkit-user-select: none;\
user-select: none;\
}\
.ace_gutter-active-line {\
position: absolute;\
left: 0;\
right: 0;\
}\
.ace_scroller.ace_scroll-left {\
box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;\
}\
.ace_gutter-cell {\
padding-left: 19px;\
padding-right: 6px;\
background-repeat: no-repeat;\
}\
.ace_gutter-cell.ace_error {\
background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAABOFBMVEX/////////QRswFAb/Ui4wFAYwFAYwFAaWGAfDRymzOSH/PxswFAb/SiUwFAYwFAbUPRvjQiDllog5HhHdRybsTi3/Tyv9Tir+Syj/UC3////XurebMBIwFAb/RSHbPx/gUzfdwL3kzMivKBAwFAbbvbnhPx66NhowFAYwFAaZJg8wFAaxKBDZurf/RB6mMxb/SCMwFAYwFAbxQB3+RB4wFAb/Qhy4Oh+4QifbNRcwFAYwFAYwFAb/QRzdNhgwFAYwFAbav7v/Uy7oaE68MBK5LxLewr/r2NXewLswFAaxJw4wFAbkPRy2PyYwFAaxKhLm1tMwFAazPiQwFAaUGAb/QBrfOx3bvrv/VC/maE4wFAbRPBq6MRO8Qynew8Dp2tjfwb0wFAbx6eju5+by6uns4uH9/f36+vr/GkHjAAAAYnRSTlMAGt+64rnWu/bo8eAA4InH3+DwoN7j4eLi4xP99Nfg4+b+/u9B/eDs1MD1mO7+4PHg2MXa347g7vDizMLN4eG+Pv7i5evs/v79yu7S3/DV7/498Yv24eH+4ufQ3Ozu/v7+y13sRqwAAADLSURBVHjaZc/XDsFgGIBhtDrshlitmk2IrbHFqL2pvXf/+78DPokj7+Fz9qpU/9UXJIlhmPaTaQ6QPaz0mm+5gwkgovcV6GZzd5JtCQwgsxoHOvJO15kleRLAnMgHFIESUEPmawB9ngmelTtipwwfASilxOLyiV5UVUyVAfbG0cCPHig+GBkzAENHS0AstVF6bacZIOzgLmxsHbt2OecNgJC83JERmePUYq8ARGkJx6XtFsdddBQgZE2nPR6CICZhawjA4Fb/chv+399kfR+MMMDGOQAAAABJRU5ErkJggg==\");\
background-repeat: no-repeat;\
background-position: 2px center;\
}\
.ace_gutter-cell.ace_warning {\
background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEX///8AAAD///8AAAAAAABPSzb/5sAAAAB/blH/73z/ulkAAAAAAAD85pkAAAAAAAACAgP/vGz/rkDerGbGrV7/pkQICAf////e0IsAAAD/oED/qTvhrnUAAAD/yHD/njcAAADuv2r/nz//oTj/p064oGf/zHAAAAA9Nir/tFIAAAD/tlTiuWf/tkIAAACynXEAAAAAAAAtIRW7zBpBAAAAM3RSTlMAABR1m7RXO8Ln31Z36zT+neXe5OzooRDfn+TZ4p3h2hTf4t3k3ucyrN1K5+Xaks52Sfs9CXgrAAAAjklEQVR42o3PbQ+CIBQFYEwboPhSYgoYunIqqLn6/z8uYdH8Vmdnu9vz4WwXgN/xTPRD2+sgOcZjsge/whXZgUaYYvT8QnuJaUrjrHUQreGczuEafQCO/SJTufTbroWsPgsllVhq3wJEk2jUSzX3CUEDJC84707djRc5MTAQxoLgupWRwW6UB5fS++NV8AbOZgnsC7BpEAAAAABJRU5ErkJggg==\");\
background-position: 2px center;\
}\
.ace_gutter-cell.ace_info {\
background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAJ0Uk5TAAB2k804AAAAPklEQVQY02NgIB68QuO3tiLznjAwpKTgNyDbMegwisCHZUETUZV0ZqOquBpXj2rtnpSJT1AEnnRmL2OgGgAAIKkRQap2htgAAAAASUVORK5CYII=\");\
background-position: 2px center;\
}\
.ace_dark .ace_gutter-cell.ace_info {\
background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAChoaGAgIAqKiq+vr6tra1ZWVmUlJSbm5s8PDxubm56enrdgzg3AAAAAXRSTlMAQObYZgAAAClJREFUeNpjYMAPdsMYHegyJZFQBlsUlMFVCWUYKkAZMxZAGdxlDMQBAG+TBP4B6RyJAAAAAElFTkSuQmCC\");\
}\
.ace_scrollbar {\
position: absolute;\
right: 0;\
bottom: 0;\
z-index: 6;\
}\
.ace_scrollbar-inner {\
position: absolute;\
cursor: text;\
left: 0;\
top: 0;\
}\
.ace_scrollbar-v{\
overflow-x: hidden;\
overflow-y: scroll;\
top: 0;\
}\
.ace_scrollbar-h {\
overflow-x: scroll;\
overflow-y: hidden;\
left: 0;\
}\
.ace_print-margin {\
position: absolute;\
height: 100%;\
}\
.ace_text-input {\
position: absolute;\
z-index: 0;\
width: 0.5em;\
height: 1em;\
opacity: 0;\
background: transparent;\
-moz-appearance: none;\
appearance: none;\
border: none;\
resize: none;\
outline: none;\
overflow: hidden;\
font: inherit;\
padding: 0 1px;\
margin: 0 -1px;\
text-indent: -1em;\
-ms-user-select: text;\
-moz-user-select: text;\
-webkit-user-select: text;\
user-select: text;\
white-space: pre!important;\
}\
.ace_text-input.ace_composition {\
background: inherit;\
color: inherit;\
z-index: 1000;\
opacity: 1;\
text-indent: 0;\
}\
.ace_layer {\
z-index: 1;\
position: absolute;\
overflow: hidden;\
word-wrap: normal;\
white-space: pre;\
height: 100%;\
width: 100%;\
-moz-box-sizing: border-box;\
-webkit-box-sizing: border-box;\
box-sizing: border-box;\
pointer-events: none;\
}\
.ace_gutter-layer {\
position: relative;\
width: auto;\
text-align: right;\
pointer-events: auto;\
}\
.ace_text-layer {\
font: inherit !important;\
}\
.ace_cjk {\
display: inline-block;\
text-align: center;\
}\
.ace_cursor-layer {\
z-index: 4;\
}\
.ace_cursor {\
z-index: 4;\
position: absolute;\
-moz-box-sizing: border-box;\
-webkit-box-sizing: border-box;\
box-sizing: border-box;\
border-left: 2px solid;\
transform: translatez(0);\
}\
.ace_slim-cursors .ace_cursor {\
border-left-width: 1px;\
}\
.ace_overwrite-cursors .ace_cursor {\
border-left-width: 0;\
border-bottom: 1px solid;\
}\
.ace_hidden-cursors .ace_cursor {\
opacity: 0.2;\
}\
.ace_smooth-blinking .ace_cursor {\
-webkit-transition: opacity 0.18s;\
transition: opacity 0.18s;\
}\
.ace_editor.ace_multiselect .ace_cursor {\
border-left-width: 1px;\
}\
.ace_marker-layer .ace_step, .ace_marker-layer .ace_stack {\
position: absolute;\
z-index: 3;\
}\
.ace_marker-layer .ace_selection {\
position: absolute;\
z-index: 5;\
}\
.ace_marker-layer .ace_bracket {\
position: absolute;\
z-index: 6;\
}\
.ace_marker-layer .ace_active-line {\
position: absolute;\
z-index: 2;\
}\
.ace_marker-layer .ace_selected-word {\
position: absolute;\
z-index: 4;\
-moz-box-sizing: border-box;\
-webkit-box-sizing: border-box;\
box-sizing: border-box;\
}\
.ace_line .ace_fold {\
-moz-box-sizing: border-box;\
-webkit-box-sizing: border-box;\
box-sizing: border-box;\
display: inline-block;\
height: 11px;\
margin-top: -2px;\
vertical-align: middle;\
background-image:\
url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII=\"),\
url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACJJREFUeNpi+P//fxgTAwPDBxDxD078RSX+YeEyDFMCIMAAI3INmXiwf2YAAAAASUVORK5CYII=\");\
background-repeat: no-repeat, repeat-x;\
background-position: center center, top left;\
color: transparent;\
border: 1px solid black;\
border-radius: 2px;\
cursor: pointer;\
pointer-events: auto;\
}\
.ace_dark .ace_fold {\
}\
.ace_fold:hover{\
background-image:\
url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII=\"),\
url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACBJREFUeNpi+P//fz4TAwPDZxDxD5X4i5fLMEwJgAADAEPVDbjNw87ZAAAAAElFTkSuQmCC\");\
}\
.ace_tooltip {\
background-color: #FFF;\
background-image: -webkit-linear-gradient(top, transparent, rgba(0, 0, 0, 0.1));\
background-image: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.1));\
border: 1px solid gray;\
border-radius: 1px;\
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);\
color: black;\
max-width: 100%;\
padding: 3px 4px;\
position: fixed;\
z-index: 999999;\
-moz-box-sizing: border-box;\
-webkit-box-sizing: border-box;\
box-sizing: border-box;\
cursor: default;\
white-space: pre;\
word-wrap: break-word;\
line-height: normal;\
font-style: normal;\
font-weight: normal;\
letter-spacing: normal;\
pointer-events: none;\
}\
.ace_folding-enabled > .ace_gutter-cell {\
padding-right: 13px;\
}\
.ace_fold-widget {\
-moz-box-sizing: border-box;\
-webkit-box-sizing: border-box;\
box-sizing: border-box;\
margin: 0 -12px 0 1px;\
display: none;\
width: 11px;\
vertical-align: top;\
background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42mWKsQ0AMAzC8ixLlrzQjzmBiEjp0A6WwBCSPgKAXoLkqSot7nN3yMwR7pZ32NzpKkVoDBUxKAAAAABJRU5ErkJggg==\");\
background-repeat: no-repeat;\
background-position: center;\
border-radius: 3px;\
border: 1px solid transparent;\
cursor: pointer;\
}\
.ace_folding-enabled .ace_fold-widget {\
display: inline-block; \
}\
.ace_fold-widget.ace_end {\
background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42m3HwQkAMAhD0YzsRchFKI7sAikeWkrxwScEB0nh5e7KTPWimZki4tYfVbX+MNl4pyZXejUO1QAAAABJRU5ErkJggg==\");\
}\
.ace_fold-widget.ace_closed {\
background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAGCAYAAAAG5SQMAAAAOUlEQVR42jXKwQkAMAgDwKwqKD4EwQ26sSOkVWjgIIHAzPiCgaqiqnJHZnKICBERHN194O5b9vbLuAVRL+l0YWnZAAAAAElFTkSuQmCCXA==\");\
}\
.ace_fold-widget:hover {\
border: 1px solid rgba(0, 0, 0, 0.3);\
background-color: rgba(255, 255, 255, 0.2);\
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);\
}\
.ace_fold-widget:active {\
border: 1px solid rgba(0, 0, 0, 0.4);\
background-color: rgba(0, 0, 0, 0.05);\
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);\
}\
.ace_dark .ace_fold-widget {\
background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC\");\
}\
.ace_dark .ace_fold-widget.ace_end {\
background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==\");\
}\
.ace_dark .ace_fold-widget.ace_closed {\
background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==\");\
}\
.ace_dark .ace_fold-widget:hover {\
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\
background-color: rgba(255, 255, 255, 0.1);\
}\
.ace_dark .ace_fold-widget:active {\
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\
}\
.ace_fold-widget.ace_invalid {\
background-color: #FFB4B4;\
border-color: #DE5555;\
}\
.ace_fade-fold-widgets .ace_fold-widget {\
-webkit-transition: opacity 0.4s ease 0.05s;\
transition: opacity 0.4s ease 0.05s;\
opacity: 0;\
}\
.ace_fade-fold-widgets:hover .ace_fold-widget {\
-webkit-transition: opacity 0.05s ease 0.05s;\
transition: opacity 0.05s ease 0.05s;\
opacity:1;\
}\
.ace_underline {\
text-decoration: underline;\
}\
.ace_bold {\
font-weight: bold;\
}\
.ace_nobold .ace_bold {\
font-weight: normal;\
}\
.ace_italic {\
font-style: italic;\
}\
.ace_error-marker {\
background-color: rgba(255, 0, 0,0.2);\
position: absolute;\
z-index: 9;\
}\
.ace_highlight-marker {\
background-color: rgba(255, 255, 0,0.2);\
position: absolute;\
z-index: 8;\
}\
.ace_br1 {border-top-left-radius : 3px;}\
.ace_br2 {border-top-right-radius : 3px;}\
.ace_br3 {border-top-left-radius : 3px; border-top-right-radius: 3px;}\
.ace_br4 {border-bottom-right-radius: 3px;}\
.ace_br5 {border-top-left-radius : 3px; border-bottom-right-radius: 3px;}\
.ace_br6 {border-top-right-radius : 3px; border-bottom-right-radius: 3px;}\
.ace_br7 {border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px;}\
.ace_br8 {border-bottom-left-radius : 3px;}\
.ace_br9 {border-top-left-radius : 3px; border-bottom-left-radius: 3px;}\
.ace_br10{border-top-right-radius : 3px; border-bottom-left-radius: 3px;}\
.ace_br11{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-left-radius: 3px;}\
.ace_br12{border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\
.ace_br13{border-top-left-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\
.ace_br14{border-top-right-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\
.ace_br15{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}\
";
dom.importCssString(editorCss, "ace_editor.css");
var VirtualRenderer = function(container, theme) {
var _self = this;
this.container = container || dom.createElement("div");
this.$keepTextAreaAtCursor = !useragent.isOldIE;
dom.addCssClass(this.container, "ace_editor");
this.setTheme(theme);
this.$gutter = dom.createElement("div");
this.$gutter.className = "ace_gutter";
this.container.appendChild(this.$gutter);
this.scroller = dom.createElement("div");
this.scroller.className = "ace_scroller";
this.container.appendChild(this.scroller);
this.content = dom.createElement("div");
this.content.className = "ace_content";
this.scroller.appendChild(this.content);
this.$gutterLayer = new GutterLayer(this.$gutter);
this.$gutterLayer.on("changeGutterWidth", this.onGutterResize.bind(this));
this.$markerBack = new MarkerLayer(this.content);
var textLayer = this.$textLayer = new TextLayer(this.content);
this.canvas = textLayer.element;
this.$markerFront = new MarkerLayer(this.content);
this.$cursorLayer = new CursorLayer(this.content);
this.$horizScroll = false;
this.$vScroll = false;
this.scrollBar =
this.scrollBarV = new VScrollBar(this.container, this);
this.scrollBarH = new HScrollBar(this.container, this);
this.scrollBarV.addEventListener("scroll", function(e) {
if (!_self.$scrollAnimation)
_self.session.setScrollTop(e.data - _self.scrollMargin.top);
});
this.scrollBarH.addEventListener("scroll", function(e) {
if (!_self.$scrollAnimation)
_self.session.setScrollLeft(e.data - _self.scrollMargin.left);
});
this.scrollTop = 0;
this.scrollLeft = 0;
this.cursorPos = {
row : 0,
column : 0
};
this.$fontMetrics = new FontMetrics(this.container);
this.$textLayer.$setFontMetrics(this.$fontMetrics);
this.$textLayer.addEventListener("changeCharacterSize", function(e) {
_self.updateCharacterSize();
_self.onResize(true, _self.gutterWidth, _self.$size.width, _self.$size.height);
_self._signal("changeCharacterSize", e);
});
this.$size = {
width: 0,
height: 0,
scrollerHeight: 0,
scrollerWidth: 0,
$dirty: true
};
this.layerConfig = {
width : 1,
padding : 0,
firstRow : 0,
firstRowScreen: 0,
lastRow : 0,
lineHeight : 0,
characterWidth : 0,
minHeight : 1,
maxHeight : 1,
offset : 0,
height : 1,
gutterOffset: 1
};
this.scrollMargin = {
left: 0,
right: 0,
top: 0,
bottom: 0,
v: 0,
h: 0
};
this.$loop = new RenderLoop(
this.$renderChanges.bind(this),
this.container.ownerDocument.defaultView
);
this.$loop.schedule(this.CHANGE_FULL);
this.updateCharacterSize();
this.setPadding(4);
config.resetOptions(this);
config._emit("renderer", this);
};
(function() {
this.CHANGE_CURSOR = 1;
this.CHANGE_MARKER = 2;
this.CHANGE_GUTTER = 4;
this.CHANGE_SCROLL = 8;
this.CHANGE_LINES = 16;
this.CHANGE_TEXT = 32;
this.CHANGE_SIZE = 64;
this.CHANGE_MARKER_BACK = 128;
this.CHANGE_MARKER_FRONT = 256;
this.CHANGE_FULL = 512;
this.CHANGE_H_SCROLL = 1024;
oop.implement(this, EventEmitter);
this.updateCharacterSize = function() {
if (this.$textLayer.allowBoldFonts != this.$allowBoldFonts) {
this.$allowBoldFonts = this.$textLayer.allowBoldFonts;
this.setStyle("ace_nobold", !this.$allowBoldFonts);
}
this.layerConfig.characterWidth =
this.characterWidth = this.$textLayer.getCharacterWidth();
this.layerConfig.lineHeight =
this.lineHeight = this.$textLayer.getLineHeight();
this.$updatePrintMargin();
};
this.setSession = function(session) {
if (this.session)
this.session.doc.off("changeNewLineMode", this.onChangeNewLineMode);
this.session = session;
if (session && this.scrollMargin.top && session.getScrollTop() <= 0)
session.setScrollTop(-this.scrollMargin.top);
this.$cursorLayer.setSession(session);
this.$markerBack.setSession(session);
this.$markerFront.setSession(session);
this.$gutterLayer.setSession(session);
this.$textLayer.setSession(session);
if (!session)
return;
this.$loop.schedule(this.CHANGE_FULL);
this.session.$setFontMetrics(this.$fontMetrics);
this.scrollBarV.scrollLeft = this.scrollBarV.scrollTop = null;
this.onChangeNewLineMode = this.onChangeNewLineMode.bind(this);
this.onChangeNewLineMode()
this.session.doc.on("changeNewLineMode", this.onChangeNewLineMode);
};
this.updateLines = function(firstRow, lastRow, force) {
if (lastRow === undefined)
lastRow = Infinity;
if (!this.$changedLines) {
this.$changedLines = {
firstRow: firstRow,
lastRow: lastRow
};
}
else {
if (this.$changedLines.firstRow > firstRow)
this.$changedLines.firstRow = firstRow;
if (this.$changedLines.lastRow < lastRow)
this.$changedLines.lastRow = lastRow;
}
if (this.$changedLines.lastRow < this.layerConfig.firstRow) {
if (force)
this.$changedLines.lastRow = this.layerConfig.lastRow;
else
return;
}
if (this.$changedLines.firstRow > this.layerConfig.lastRow)
return;
this.$loop.schedule(this.CHANGE_LINES);
};
this.onChangeNewLineMode = function() {
this.$loop.schedule(this.CHANGE_TEXT);
this.$textLayer.$updateEolChar();
};
this.onChangeTabSize = function() {
this.$loop.schedule(this.CHANGE_TEXT | this.CHANGE_MARKER);
this.$textLayer.onChangeTabSize();
};
this.updateText = function() {
this.$loop.schedule(this.CHANGE_TEXT);
};
this.updateFull = function(force) {
if (force)
this.$renderChanges(this.CHANGE_FULL, true);
else
this.$loop.schedule(this.CHANGE_FULL);
};
this.updateFontSize = function() {
this.$textLayer.checkForSizeChanges();
};
this.$changes = 0;
this.$updateSizeAsync = function() {
if (this.$loop.pending)
this.$size.$dirty = true;
else
this.onResize();
};
this.onResize = function(force, gutterWidth, width, height) {
if (this.resizing > 2)
return;
else if (this.resizing > 0)
this.resizing++;
else
this.resizing = force ? 1 : 0;
var el = this.container;
if (!height)
height = el.clientHeight || el.scrollHeight;
if (!width)
width = el.clientWidth || el.scrollWidth;
var changes = this.$updateCachedSize(force, gutterWidth, width, height);
if (!this.$size.scrollerHeight || (!width && !height))
return this.resizing = 0;
if (force)
this.$gutterLayer.$padding = null;
if (force)
this.$renderChanges(changes | this.$changes, true);
else
this.$loop.schedule(changes | this.$changes);
if (this.resizing)
this.resizing = 0;
this.scrollBarV.scrollLeft = this.scrollBarV.scrollTop = null;
};
this.$updateCachedSize = function(force, gutterWidth, width, height) {
height -= (this.$extraHeight || 0);
var changes = 0;
var size = this.$size;
var oldSize = {
width: size.width,
height: size.height,
scrollerHeight: size.scrollerHeight,
scrollerWidth: size.scrollerWidth
};
if (height && (force || size.height != height)) {
size.height = height;
changes |= this.CHANGE_SIZE;
size.scrollerHeight = size.height;
if (this.$horizScroll)
size.scrollerHeight -= this.scrollBarH.getHeight();
this.scrollBarV.element.style.bottom = this.scrollBarH.getHeight() + "px";
changes = changes | this.CHANGE_SCROLL;
}
if (width && (force || size.width != width)) {
changes |= this.CHANGE_SIZE;
size.width = width;
if (gutterWidth == null)
gutterWidth = this.$showGutter ? this.$gutter.offsetWidth : 0;
this.gutterWidth = gutterWidth;
this.scrollBarH.element.style.left =
this.scroller.style.left = gutterWidth + "px";
size.scrollerWidth = Math.max(0, width - gutterWidth - this.scrollBarV.getWidth());
this.scrollBarH.element.style.right =
this.scroller.style.right = this.scrollBarV.getWidth() + "px";
this.scroller.style.bottom = this.scrollBarH.getHeight() + "px";
if (this.session && this.session.getUseWrapMode() && this.adjustWrapLimit() || force)
changes |= this.CHANGE_FULL;
}
size.$dirty = !width || !height;
if (changes)
this._signal("resize", oldSize);
return changes;
};
this.onGutterResize = function() {
var gutterWidth = this.$showGutter ? this.$gutter.offsetWidth : 0;
if (gutterWidth != this.gutterWidth)
this.$changes |= this.$updateCachedSize(true, gutterWidth, this.$size.width, this.$size.height);
if (this.session.getUseWrapMode() && this.adjustWrapLimit()) {
this.$loop.schedule(this.CHANGE_FULL);
} else if (this.$size.$dirty) {
this.$loop.schedule(this.CHANGE_FULL);
} else {
this.$computeLayerConfig();
this.$loop.schedule(this.CHANGE_MARKER);
}
};
this.adjustWrapLimit = function() {
var availableWidth = this.$size.scrollerWidth - this.$padding * 2;
var limit = Math.floor(availableWidth / this.characterWidth);
return this.session.adjustWrapLimit(limit, this.$showPrintMargin && this.$printMarginColumn);
};
this.setAnimatedScroll = function(shouldAnimate){
this.setOption("animatedScroll", shouldAnimate);
};
this.getAnimatedScroll = function() {
return this.$animatedScroll;
};
this.setShowInvisibles = function(showInvisibles) {
this.setOption("showInvisibles", showInvisibles);
};
this.getShowInvisibles = function() {
return this.getOption("showInvisibles");
};
this.getDisplayIndentGuides = function() {
return this.getOption("displayIndentGuides");
};
this.setDisplayIndentGuides = function(display) {
this.setOption("displayIndentGuides", display);
};
this.setShowPrintMargin = function(showPrintMargin) {
this.setOption("showPrintMargin", showPrintMargin);
};
this.getShowPrintMargin = function() {
return this.getOption("showPrintMargin");
};
this.setPrintMarginColumn = function(showPrintMargin) {
this.setOption("printMarginColumn", showPrintMargin);
};
this.getPrintMarginColumn = function() {
return this.getOption("printMarginColumn");
};
this.getShowGutter = function(){
return this.getOption("showGutter");
};
this.setShowGutter = function(show){
return this.setOption("showGutter", show);
};
this.getFadeFoldWidgets = function(){
return this.getOption("fadeFoldWidgets")
};
this.setFadeFoldWidgets = function(show) {
this.setOption("fadeFoldWidgets", show);
};
this.setHighlightGutterLine = function(shouldHighlight) {
this.setOption("highlightGutterLine", shouldHighlight);
};
this.getHighlightGutterLine = function() {
return this.getOption("highlightGutterLine");
};
this.$updateGutterLineHighlight = function() {
var pos = this.$cursorLayer.$pixelPos;
var height = this.layerConfig.lineHeight;
if (this.session.getUseWrapMode()) {
var cursor = this.session.selection.getCursor();
cursor.column = 0;
pos = this.$cursorLayer.getPixelPosition(cursor, true);
height *= this.session.getRowLength(cursor.row);
}
this.$gutterLineHighlight.style.top = pos.top - this.layerConfig.offset + "px";
this.$gutterLineHighlight.style.height = height + "px";
};
this.$updatePrintMargin = function() {
if (!this.$showPrintMargin && !this.$printMarginEl)
return;
if (!this.$printMarginEl) {
var containerEl = dom.createElement("div");
containerEl.className = "ace_layer ace_print-margin-layer";
this.$printMarginEl = dom.createElement("div");
this.$printMarginEl.className = "ace_print-margin";
containerEl.appendChild(this.$printMarginEl);
this.content.insertBefore(containerEl, this.content.firstChild);
}
var style = this.$printMarginEl.style;
style.left = ((this.characterWidth * this.$printMarginColumn) + this.$padding) + "px";
style.visibility = this.$showPrintMargin ? "visible" : "hidden";
if (this.session && this.session.$wrap == -1)
this.adjustWrapLimit();
};
this.getContainerElement = function() {
return this.container;
};
this.getMouseEventTarget = function() {
return this.scroller;
};
this.getTextAreaContainer = function() {
return this.container;
};
this.$moveTextAreaToCursor = function() {
if (!this.$keepTextAreaAtCursor)
return;
var config = this.layerConfig;
var posTop = this.$cursorLayer.$pixelPos.top;
var posLeft = this.$cursorLayer.$pixelPos.left;
posTop -= config.offset;
var style = this.textarea.style;
var h = this.lineHeight;
if (posTop < 0 || posTop > config.height - h) {
style.top = style.left = "0";
return;
}
var w = this.characterWidth;
if (this.$composition) {
var val = this.textarea.value.replace(/^\x01+/, "");
w *= (this.session.$getStringScreenWidth(val)[0]+2);
h += 2;
}
posLeft -= this.scrollLeft;
if (posLeft > this.$size.scrollerWidth - w)
posLeft = this.$size.scrollerWidth - w;
posLeft += this.gutterWidth;
style.height = h + "px";
style.width = w + "px";
style.left = Math.min(posLeft, this.$size.scrollerWidth - w) + "px";
style.top = Math.min(posTop, this.$size.height - h) + "px";
};
this.getFirstVisibleRow = function() {
return this.layerConfig.firstRow;
};
this.getFirstFullyVisibleRow = function() {
return this.layerConfig.firstRow + (this.layerConfig.offset === 0 ? 0 : 1);
};
this.getLastFullyVisibleRow = function() {
var config = this.layerConfig;
var lastRow = config.lastRow
var top = this.session.documentToScreenRow(lastRow, 0) * config.lineHeight;
if (top - this.session.getScrollTop() > config.height - config.lineHeight)
return lastRow - 1;
return lastRow;
};
this.getLastVisibleRow = function() {
return this.layerConfig.lastRow;
};
this.$padding = null;
this.setPadding = function(padding) {
this.$padding = padding;
this.$textLayer.setPadding(padding);
this.$cursorLayer.setPadding(padding);
this.$markerFront.setPadding(padding);
this.$markerBack.setPadding(padding);
this.$loop.schedule(this.CHANGE_FULL);
this.$updatePrintMargin();
};
this.setScrollMargin = function(top, bottom, left, right) {
var sm = this.scrollMargin;
sm.top = top|0;
sm.bottom = bottom|0;
sm.right = right|0;
sm.left = left|0;
sm.v = sm.top + sm.bottom;
sm.h = sm.left + sm.right;
if (sm.top && this.scrollTop <= 0 && this.session)
this.session.setScrollTop(-sm.top);
this.updateFull();
};
this.getHScrollBarAlwaysVisible = function() {
return this.$hScrollBarAlwaysVisible;
};
this.setHScrollBarAlwaysVisible = function(alwaysVisible) {
this.setOption("hScrollBarAlwaysVisible", alwaysVisible);
};
this.getVScrollBarAlwaysVisible = function() {
return this.$vScrollBarAlwaysVisible;
};
this.setVScrollBarAlwaysVisible = function(alwaysVisible) {
this.setOption("vScrollBarAlwaysVisible", alwaysVisible);
};
this.$updateScrollBarV = function() {
var scrollHeight = this.layerConfig.maxHeight;
var scrollerHeight = this.$size.scrollerHeight;
if (!this.$maxLines && this.$scrollPastEnd) {
scrollHeight -= (scrollerHeight - this.lineHeight) * this.$scrollPastEnd;
if (this.scrollTop > scrollHeight - scrollerHeight) {
scrollHeight = this.scrollTop + scrollerHeight;
this.scrollBarV.scrollTop = null;
}
}
this.scrollBarV.setScrollHeight(scrollHeight + this.scrollMargin.v);
this.scrollBarV.setScrollTop(this.scrollTop + this.scrollMargin.top);
};
this.$updateScrollBarH = function() {
this.scrollBarH.setScrollWidth(this.layerConfig.width + 2 * this.$padding + this.scrollMargin.h);
this.scrollBarH.setScrollLeft(this.scrollLeft + this.scrollMargin.left);
};
this.$frozen = false;
this.freeze = function() {
this.$frozen = true;
};
this.unfreeze = function() {
this.$frozen = false;
};
this.$renderChanges = function(changes, force) {
if (this.$changes) {
changes |= this.$changes;
this.$changes = 0;
}
if ((!this.session || !this.container.offsetWidth || this.$frozen) || (!changes && !force)) {
this.$changes |= changes;
return;
}
if (this.$size.$dirty) {
this.$changes |= changes;
return this.onResize(true);
}
if (!this.lineHeight) {
this.$textLayer.checkForSizeChanges();
}
this._signal("beforeRender");
var config = this.layerConfig;
if (changes & this.CHANGE_FULL ||
changes & this.CHANGE_SIZE ||
changes & this.CHANGE_TEXT ||
changes & this.CHANGE_LINES ||
changes & this.CHANGE_SCROLL ||
changes & this.CHANGE_H_SCROLL
) {
changes |= this.$computeLayerConfig();
if (config.firstRow != this.layerConfig.firstRow && config.firstRowScreen == this.layerConfig.firstRowScreen) {
var st = this.scrollTop + (config.firstRow - this.layerConfig.firstRow) * this.lineHeight;
if (st > 0) {
this.scrollTop = st;
changes = changes | this.CHANGE_SCROLL;
changes |= this.$computeLayerConfig();
}
}
config = this.layerConfig;
this.$updateScrollBarV();
if (changes & this.CHANGE_H_SCROLL)
this.$updateScrollBarH();
this.$gutterLayer.element.style.marginTop = (-config.offset) + "px";
this.content.style.marginTop = (-config.offset) + "px";
this.content.style.width = config.width + 2 * this.$padding + "px";
this.content.style.height = config.minHeight + "px";
}
if (changes & this.CHANGE_H_SCROLL) {
this.content.style.marginLeft = -this.scrollLeft + "px";
this.scroller.className = this.scrollLeft <= 0 ? "ace_scroller" : "ace_scroller ace_scroll-left";
}
if (changes & this.CHANGE_FULL) {
this.$textLayer.update(config);
if (this.$showGutter)
this.$gutterLayer.update(config);
this.$markerBack.update(config);
this.$markerFront.update(config);
this.$cursorLayer.update(config);
this.$moveTextAreaToCursor();
this.$highlightGutterLine && this.$updateGutterLineHighlight();
this._signal("afterRender");
return;
}
if (changes & this.CHANGE_SCROLL) {
if (changes & this.CHANGE_TEXT || changes & this.CHANGE_LINES)
this.$textLayer.update(config);
else
this.$textLayer.scrollLines(config);
if (this.$showGutter)
this.$gutterLayer.update(config);
this.$markerBack.update(config);
this.$markerFront.update(config);
this.$cursorLayer.update(config);
this.$highlightGutterLine && this.$updateGutterLineHighlight();
this.$moveTextAreaToCursor();
this._signal("afterRender");
return;
}
if (changes & this.CHANGE_TEXT) {
this.$textLayer.update(config);
if (this.$showGutter)
this.$gutterLayer.update(config);
}
else if (changes & this.CHANGE_LINES) {
if (this.$updateLines() || (changes & this.CHANGE_GUTTER) && this.$showGutter)
this.$gutterLayer.update(config);
}
else if (changes & this.CHANGE_TEXT || changes & this.CHANGE_GUTTER) {
if (this.$showGutter)
this.$gutterLayer.update(config);
}
if (changes & this.CHANGE_CURSOR) {
this.$cursorLayer.update(config);
this.$moveTextAreaToCursor();
this.$highlightGutterLine && this.$updateGutterLineHighlight();
}
if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_FRONT)) {
this.$markerFront.update(config);
}
if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_BACK)) {
this.$markerBack.update(config);
}
this._signal("afterRender");
};
this.$autosize = function() {
var height = this.session.getScreenLength() * this.lineHeight;
var maxHeight = this.$maxLines * this.lineHeight;
var desiredHeight = Math.min(maxHeight,
Math.max((this.$minLines || 1) * this.lineHeight, height)
) + this.scrollMargin.v + (this.$extraHeight || 0);
if (this.$horizScroll)
desiredHeight += this.scrollBarH.getHeight();
if (this.$maxPixelHeight && desiredHeight > this.$maxPixelHeight)
desiredHeight = this.$maxPixelHeight;
var vScroll = height > maxHeight;
if (desiredHeight != this.desiredHeight ||
this.$size.height != this.desiredHeight || vScroll != this.$vScroll) {
if (vScroll != this.$vScroll) {
this.$vScroll = vScroll;
this.scrollBarV.setVisible(vScroll);
}
var w = this.container.clientWidth;
this.container.style.height = desiredHeight + "px";
this.$updateCachedSize(true, this.$gutterWidth, w, desiredHeight);
this.desiredHeight = desiredHeight;
this._signal("autosize");
}
};
this.$computeLayerConfig = function() {
var session = this.session;
var size = this.$size;
var hideScrollbars = size.height <= 2 * this.lineHeight;
var screenLines = this.session.getScreenLength();
var maxHeight = screenLines * this.lineHeight;
var longestLine = this.$getLongestLine();
var horizScroll = !hideScrollbars && (this.$hScrollBarAlwaysVisible ||
size.scrollerWidth - longestLine - 2 * this.$padding < 0);
var hScrollChanged = this.$horizScroll !== horizScroll;
if (hScrollChanged) {
this.$horizScroll = horizScroll;
this.scrollBarH.setVisible(horizScroll);
}
var vScrollBefore = this.$vScroll; // autosize can change vscroll value in which case we need to update longestLine
if (this.$maxLines && this.lineHeight > 1)
this.$autosize();
var offset = this.scrollTop % this.lineHeight;
var minHeight = size.scrollerHeight + this.lineHeight;
var scrollPastEnd = !this.$maxLines && this.$scrollPastEnd
? (size.scrollerHeight - this.lineHeight) * this.$scrollPastEnd
: 0;
maxHeight += scrollPastEnd;
var sm = this.scrollMargin;
this.session.setScrollTop(Math.max(-sm.top,
Math.min(this.scrollTop, maxHeight - size.scrollerHeight + sm.bottom)));
this.session.setScrollLeft(Math.max(-sm.left, Math.min(this.scrollLeft,
longestLine + 2 * this.$padding - size.scrollerWidth + sm.right)));
var vScroll = !hideScrollbars && (this.$vScrollBarAlwaysVisible ||
size.scrollerHeight - maxHeight + scrollPastEnd < 0 || this.scrollTop > sm.top);
var vScrollChanged = vScrollBefore !== vScroll;
if (vScrollChanged) {
this.$vScroll = vScroll;
this.scrollBarV.setVisible(vScroll);
}
var lineCount = Math.ceil(minHeight / this.lineHeight) - 1;
var firstRow = Math.max(0, Math.round((this.scrollTop - offset) / this.lineHeight));
var lastRow = firstRow + lineCount;
var firstRowScreen, firstRowHeight;
var lineHeight = this.lineHeight;
firstRow = session.screenToDocumentRow(firstRow, 0);
var foldLine = session.getFoldLine(firstRow);
if (foldLine) {
firstRow = foldLine.start.row;
}
firstRowScreen = session.documentToScreenRow(firstRow, 0);
firstRowHeight = session.getRowLength(firstRow) * lineHeight;
lastRow = Math.min(session.screenToDocumentRow(lastRow, 0), session.getLength() - 1);
minHeight = size.scrollerHeight + session.getRowLength(lastRow) * lineHeight +
firstRowHeight;
offset = this.scrollTop - firstRowScreen * lineHeight;
var changes = 0;
if (this.layerConfig.width != longestLine)
changes = this.CHANGE_H_SCROLL;
if (hScrollChanged || vScrollChanged) {
changes = this.$updateCachedSize(true, this.gutterWidth, size.width, size.height);
this._signal("scrollbarVisibilityChanged");
if (vScrollChanged)
longestLine = this.$getLongestLine();
}
this.layerConfig = {
width : longestLine,
padding : this.$padding,
firstRow : firstRow,
firstRowScreen: firstRowScreen,
lastRow : lastRow,
lineHeight : lineHeight,
characterWidth : this.characterWidth,
minHeight : minHeight,
maxHeight : maxHeight,
offset : offset,
gutterOffset : lineHeight ? Math.max(0, Math.ceil((offset + size.height - size.scrollerHeight) / lineHeight)) : 0,
height : this.$size.scrollerHeight
};
return changes;
};
this.$updateLines = function() {
var firstRow = this.$changedLines.firstRow;
var lastRow = this.$changedLines.lastRow;
this.$changedLines = null;
var layerConfig = this.layerConfig;
if (firstRow > layerConfig.lastRow + 1) { return; }
if (lastRow < layerConfig.firstRow) { return; }
if (lastRow === Infinity) {
if (this.$showGutter)
this.$gutterLayer.update(layerConfig);
this.$textLayer.update(layerConfig);
return;
}
this.$textLayer.updateLines(layerConfig, firstRow, lastRow);
return true;
};
this.$getLongestLine = function() {
var charCount = this.session.getScreenWidth();
if (this.showInvisibles && !this.session.$useWrapMode)
charCount += 1;
return Math.max(this.$size.scrollerWidth - 2 * this.$padding, Math.round(charCount * this.characterWidth));
};
this.updateFrontMarkers = function() {
this.$markerFront.setMarkers(this.session.getMarkers(true));
this.$loop.schedule(this.CHANGE_MARKER_FRONT);
};
this.updateBackMarkers = function() {
this.$markerBack.setMarkers(this.session.getMarkers());
this.$loop.schedule(this.CHANGE_MARKER_BACK);
};
this.addGutterDecoration = function(row, className){
this.$gutterLayer.addGutterDecoration(row, className);
};
this.removeGutterDecoration = function(row, className){
this.$gutterLayer.removeGutterDecoration(row, className);
};
this.updateBreakpoints = function(rows) {
this.$loop.schedule(this.CHANGE_GUTTER);
};
this.setAnnotations = function(annotations) {
this.$gutterLayer.setAnnotations(annotations);
this.$loop.schedule(this.CHANGE_GUTTER);
};
this.updateCursor = function() {
this.$loop.schedule(this.CHANGE_CURSOR);
};
this.hideCursor = function() {
this.$cursorLayer.hideCursor();
};
this.showCursor = function() {
this.$cursorLayer.showCursor();
};
this.scrollSelectionIntoView = function(anchor, lead, offset) {
this.scrollCursorIntoView(anchor, offset);
this.scrollCursorIntoView(lead, offset);
};
this.scrollCursorIntoView = function(cursor, offset, $viewMargin) {
if (this.$size.scrollerHeight === 0)
return;
var pos = this.$cursorLayer.getPixelPosition(cursor);
var left = pos.left;
var top = pos.top;
var topMargin = $viewMargin && $viewMargin.top || 0;
var bottomMargin = $viewMargin && $viewMargin.bottom || 0;
var scrollTop = this.$scrollAnimation ? this.session.getScrollTop() : this.scrollTop;
if (scrollTop + topMargin > top) {
if (offset && scrollTop + topMargin > top + this.lineHeight)
top -= offset * this.$size.scrollerHeight;
if (top === 0)
top = -this.scrollMargin.top;
this.session.setScrollTop(top);
} else if (scrollTop + this.$size.scrollerHeight - bottomMargin < top + this.lineHeight) {
if (offset && scrollTop + this.$size.scrollerHeight - bottomMargin < top - this.lineHeight)
top += offset * this.$size.scrollerHeight;
this.session.setScrollTop(top + this.lineHeight - this.$size.scrollerHeight);
}
var scrollLeft = this.scrollLeft;
if (scrollLeft > left) {
if (left < this.$padding + 2 * this.layerConfig.characterWidth)
left = -this.scrollMargin.left;
this.session.setScrollLeft(left);
} else if (scrollLeft + this.$size.scrollerWidth < left + this.characterWidth) {
this.session.setScrollLeft(Math.round(left + this.characterWidth - this.$size.scrollerWidth));
} else if (scrollLeft <= this.$padding && left - scrollLeft < this.characterWidth) {
this.session.setScrollLeft(0);
}
};
this.getScrollTop = function() {
return this.session.getScrollTop();
};
this.getScrollLeft = function() {
return this.session.getScrollLeft();
};
this.getScrollTopRow = function() {
return this.scrollTop / this.lineHeight;
};
this.getScrollBottomRow = function() {
return Math.max(0, Math.floor((this.scrollTop + this.$size.scrollerHeight) / this.lineHeight) - 1);
};
this.scrollToRow = function(row) {
this.session.setScrollTop(row * this.lineHeight);
};
this.alignCursor = function(cursor, alignment) {
if (typeof cursor == "number")
cursor = {row: cursor, column: 0};
var pos = this.$cursorLayer.getPixelPosition(cursor);
var h = this.$size.scrollerHeight - this.lineHeight;
var offset = pos.top - h * (alignment || 0);
this.session.setScrollTop(offset);
return offset;
};
this.STEPS = 8;
this.$calcSteps = function(fromValue, toValue){
var i = 0;
var l = this.STEPS;
var steps = [];
var func = function(t, x_min, dx) {
return dx * (Math.pow(t - 1, 3) + 1) + x_min;
};
for (i = 0; i < l; ++i)
steps.push(func(i / this.STEPS, fromValue, toValue - fromValue));
return steps;
};
this.scrollToLine = function(line, center, animate, callback) {
var pos = this.$cursorLayer.getPixelPosition({row: line, column: 0});
var offset = pos.top;
if (center)
offset -= this.$size.scrollerHeight / 2;
var initialScroll = this.scrollTop;
this.session.setScrollTop(offset);
if (animate !== false)
this.animateScrolling(initialScroll, callback);
};
this.animateScrolling = function(fromValue, callback) {
var toValue = this.scrollTop;
if (!this.$animatedScroll)
return;
var _self = this;
if (fromValue == toValue)
return;
if (this.$scrollAnimation) {
var oldSteps = this.$scrollAnimation.steps;
if (oldSteps.length) {
fromValue = oldSteps[0];
if (fromValue == toValue)
return;
}
}
var steps = _self.$calcSteps(fromValue, toValue);
this.$scrollAnimation = {from: fromValue, to: toValue, steps: steps};
clearInterval(this.$timer);
_self.session.setScrollTop(steps.shift());
_self.session.$scrollTop = toValue;
this.$timer = setInterval(function() {
if (steps.length) {
_self.session.setScrollTop(steps.shift());
_self.session.$scrollTop = toValue;
} else if (toValue != null) {
_self.session.$scrollTop = -1;
_self.session.setScrollTop(toValue);
toValue = null;
} else {
_self.$timer = clearInterval(_self.$timer);
_self.$scrollAnimation = null;
callback && callback();
}
}, 10);
};
this.scrollToY = function(scrollTop) {
if (this.scrollTop !== scrollTop) {
this.$loop.schedule(this.CHANGE_SCROLL);
this.scrollTop = scrollTop;
}
};
this.scrollToX = function(scrollLeft) {
if (this.scrollLeft !== scrollLeft)
this.scrollLeft = scrollLeft;
this.$loop.schedule(this.CHANGE_H_SCROLL);
};
this.scrollTo = function(x, y) {
this.session.setScrollTop(y);
this.session.setScrollLeft(y);
};
this.scrollBy = function(deltaX, deltaY) {
deltaY && this.session.setScrollTop(this.session.getScrollTop() + deltaY);
deltaX && this.session.setScrollLeft(this.session.getScrollLeft() + deltaX);
};
this.isScrollableBy = function(deltaX, deltaY) {
if (deltaY < 0 && this.session.getScrollTop() >= 1 - this.scrollMargin.top)
return true;
if (deltaY > 0 && this.session.getScrollTop() + this.$size.scrollerHeight
- this.layerConfig.maxHeight < -1 + this.scrollMargin.bottom)
return true;
if (deltaX < 0 && this.session.getScrollLeft() >= 1 - this.scrollMargin.left)
return true;
if (deltaX > 0 && this.session.getScrollLeft() + this.$size.scrollerWidth
- this.layerConfig.width < -1 + this.scrollMargin.right)
return true;
};
this.pixelToScreenCoordinates = function(x, y) {
var canvasPos = this.scroller.getBoundingClientRect();
var offset = (x + this.scrollLeft - canvasPos.left - this.$padding) / this.characterWidth;
var row = Math.floor((y + this.scrollTop - canvasPos.top) / this.lineHeight);
var col = Math.round(offset);
return {row: row, column: col, side: offset - col > 0 ? 1 : -1};
};
this.screenToTextCoordinates = function(x, y) {
var canvasPos = this.scroller.getBoundingClientRect();
var col = Math.round(
(x + this.scrollLeft - canvasPos.left - this.$padding) / this.characterWidth
);
var row = (y + this.scrollTop - canvasPos.top) / this.lineHeight;
return this.session.screenToDocumentPosition(row, Math.max(col, 0));
};
this.textToScreenCoordinates = function(row, column) {
var canvasPos = this.scroller.getBoundingClientRect();
var pos = this.session.documentToScreenPosition(row, column);
var x = this.$padding + Math.round(pos.column * this.characterWidth);
var y = pos.row * this.lineHeight;
return {
pageX: canvasPos.left + x - this.scrollLeft,
pageY: canvasPos.top + y - this.scrollTop
};
};
this.visualizeFocus = function() {
dom.addCssClass(this.container, "ace_focus");
};
this.visualizeBlur = function() {
dom.removeCssClass(this.container, "ace_focus");
};
this.showComposition = function(position) {
if (!this.$composition)
this.$composition = {
keepTextAreaAtCursor: this.$keepTextAreaAtCursor,
cssText: this.textarea.style.cssText
};
this.$keepTextAreaAtCursor = true;
dom.addCssClass(this.textarea, "ace_composition");
this.textarea.style.cssText = "";
this.$moveTextAreaToCursor();
};
this.setCompositionText = function(text) {
this.$moveTextAreaToCursor();
};
this.hideComposition = function() {
if (!this.$composition)
return;
dom.removeCssClass(this.textarea, "ace_composition");
this.$keepTextAreaAtCursor = this.$composition.keepTextAreaAtCursor;
this.textarea.style.cssText = this.$composition.cssText;
this.$composition = null;
};
this.setTheme = function(theme, cb) {
var _self = this;
this.$themeId = theme;
_self._dispatchEvent('themeChange',{theme:theme});
if (!theme || typeof theme == "string") {
var moduleName = theme || this.$options.theme.initialValue;
config.loadModule(["theme", moduleName], afterLoad);
} else {
afterLoad(theme);
}
function afterLoad(module) {
if (_self.$themeId != theme)
return cb && cb();
if (!module || !module.cssClass)
throw new Error("couldn't load module " + theme + " or it didn't call define");
dom.importCssString(
module.cssText,
module.cssClass,
_self.container.ownerDocument
);
if (_self.theme)
dom.removeCssClass(_self.container, _self.theme.cssClass);
var padding = "padding" in module ? module.padding
: "padding" in (_self.theme || {}) ? 4 : _self.$padding;
if (_self.$padding && padding != _self.$padding)
_self.setPadding(padding);
_self.$theme = module.cssClass;
_self.theme = module;
dom.addCssClass(_self.container, module.cssClass);
dom.setCssClass(_self.container, "ace_dark", module.isDark);
if (_self.$size) {
_self.$size.width = 0;
_self.$updateSizeAsync();
}
_self._dispatchEvent('themeLoaded', {theme:module});
cb && cb();
}
};
this.getTheme = function() {
return this.$themeId;
};
this.setStyle = function(style, include) {
dom.setCssClass(this.container, style, include !== false);
};
this.unsetStyle = function(style) {
dom.removeCssClass(this.container, style);
};
this.setCursorStyle = function(style) {
if (this.scroller.style.cursor != style)
this.scroller.style.cursor = style;
};
this.setMouseCursor = function(cursorStyle) {
this.scroller.style.cursor = cursorStyle;
};
this.destroy = function() {
this.$textLayer.destroy();
this.$cursorLayer.destroy();
};
}).call(VirtualRenderer.prototype);
config.defineOptions(VirtualRenderer.prototype, "renderer", {
animatedScroll: {initialValue: false},
showInvisibles: {
set: function(value) {
if (this.$textLayer.setShowInvisibles(value))
this.$loop.schedule(this.CHANGE_TEXT);
},
initialValue: false
},
showPrintMargin: {
set: function() { this.$updatePrintMargin(); },
initialValue: true
},
printMarginColumn: {
set: function() { this.$updatePrintMargin(); },
initialValue: 80
},
printMargin: {
set: function(val) {
if (typeof val == "number")
this.$printMarginColumn = val;
this.$showPrintMargin = !!val;
this.$updatePrintMargin();
},
get: function() {
return this.$showPrintMargin && this.$printMarginColumn;
}
},
showGutter: {
set: function(show){
this.$gutter.style.display = show ? "block" : "none";
this.$loop.schedule(this.CHANGE_FULL);
this.onGutterResize();
},
initialValue: true
},
fadeFoldWidgets: {
set: function(show) {
dom.setCssClass(this.$gutter, "ace_fade-fold-widgets", show);
},
initialValue: false
},
showFoldWidgets: {
set: function(show) {this.$gutterLayer.setShowFoldWidgets(show)},
initialValue: true
},
showLineNumbers: {
set: function(show) {
this.$gutterLayer.setShowLineNumbers(show);
this.$loop.schedule(this.CHANGE_GUTTER);
},
initialValue: true
},
displayIndentGuides: {
set: function(show) {
if (this.$textLayer.setDisplayIndentGuides(show))
this.$loop.schedule(this.CHANGE_TEXT);
},
initialValue: true
},
highlightGutterLine: {
set: function(shouldHighlight) {
if (!this.$gutterLineHighlight) {
this.$gutterLineHighlight = dom.createElement("div");
this.$gutterLineHighlight.className = "ace_gutter-active-line";
this.$gutter.appendChild(this.$gutterLineHighlight);
return;
}
this.$gutterLineHighlight.style.display = shouldHighlight ? "" : "none";
if (this.$cursorLayer.$pixelPos)
this.$updateGutterLineHighlight();
},
initialValue: false,
value: true
},
hScrollBarAlwaysVisible: {
set: function(val) {
if (!this.$hScrollBarAlwaysVisible || !this.$horizScroll)
this.$loop.schedule(this.CHANGE_SCROLL);
},
initialValue: false
},
vScrollBarAlwaysVisible: {
set: function(val) {
if (!this.$vScrollBarAlwaysVisible || !this.$vScroll)
this.$loop.schedule(this.CHANGE_SCROLL);
},
initialValue: false
},
fontSize: {
set: function(size) {
if (typeof size == "number")
size = size + "px";
this.container.style.fontSize = size;
this.updateFontSize();
},
initialValue: 12
},
fontFamily: {
set: function(name) {
this.container.style.fontFamily = name;
this.updateFontSize();
}
},
maxLines: {
set: function(val) {
this.updateFull();
}
},
minLines: {
set: function(val) {
this.updateFull();
}
},
maxPixelHeight: {
set: function(val) {
this.updateFull();
},
initialValue: 0
},
scrollPastEnd: {
set: function(val) {
val = +val || 0;
if (this.$scrollPastEnd == val)
return;
this.$scrollPastEnd = val;
this.$loop.schedule(this.CHANGE_SCROLL);
},
initialValue: 0,
handlesSet: true
},
fixedWidthGutter: {
set: function(val) {
this.$gutterLayer.$fixedWidth = !!val;
this.$loop.schedule(this.CHANGE_GUTTER);
}
},
theme: {
set: function(val) { this.setTheme(val) },
get: function() { return this.$themeId || this.theme; },
initialValue: "./theme/textmate",
handlesSet: true
}
});
exports.VirtualRenderer = VirtualRenderer;
});
ace.define("ace/worker/worker_client",["require","exports","module","ace/lib/oop","ace/lib/net","ace/lib/event_emitter","ace/config"], function(acequire, exports, module) {
"use strict";
var oop = acequire("../lib/oop");
var net = acequire("../lib/net");
var EventEmitter = acequire("../lib/event_emitter").EventEmitter;
var config = acequire("../config");
var WorkerClient = function(topLevelNamespaces, mod, classname, workerUrl) {
this.$sendDeltaQueue = this.$sendDeltaQueue.bind(this);
this.changeListener = this.changeListener.bind(this);
this.onMessage = this.onMessage.bind(this);
if (acequire.nameToUrl && !acequire.toUrl)
acequire.toUrl = acequire.nameToUrl;
if (config.get("packaged") || !acequire.toUrl) {
workerUrl = workerUrl || config.moduleUrl(mod.id, "worker")
} else {
var normalizePath = this.$normalizePath;
workerUrl = workerUrl || normalizePath(acequire.toUrl("ace/worker/worker.js", null, "_"));
var tlns = {};
topLevelNamespaces.forEach(function(ns) {
tlns[ns] = normalizePath(acequire.toUrl(ns, null, "_").replace(/(\.js)?(\?.*)?$/, ""));
});
}
try {
var workerSrc = mod.src;
var Blob = __webpack_require__(14);
var blob = new Blob([ workerSrc ], { type: 'application/javascript' });
var blobUrl = (window.URL || window.webkitURL).createObjectURL(blob);
this.$worker = new Worker(blobUrl);
} catch(e) {
if (e instanceof window.DOMException) {
var blob = this.$workerBlob(workerUrl);
var URL = window.URL || window.webkitURL;
var blobURL = URL.createObjectURL(blob);
this.$worker = new Worker(blobURL);
URL.revokeObjectURL(blobURL);
} else {
throw e;
}
}
this.$worker.postMessage({
init : true,
tlns : tlns,
module : mod.id,
classname : classname
});
this.callbackId = 1;
this.callbacks = {};
this.$worker.onmessage = this.onMessage;
};
(function(){
oop.implement(this, EventEmitter);
this.onMessage = function(e) {
var msg = e.data;
switch(msg.type) {
case "event":
this._signal(msg.name, {data: msg.data});
break;
case "call":
var callback = this.callbacks[msg.id];
if (callback) {
callback(msg.data);
delete this.callbacks[msg.id];
}
break;
case "error":
this.reportError(msg.data);
break;
case "log":
window.console && console.log && console.log.apply(console, msg.data);
break;
}
};
this.reportError = function(err) {
window.console && console.error && console.error(err);
};
this.$normalizePath = function(path) {
return net.qualifyURL(path);
};
this.terminate = function() {
this._signal("terminate", {});
this.deltaQueue = null;
this.$worker.terminate();
this.$worker = null;
if (this.$doc)
this.$doc.off("change", this.changeListener);
this.$doc = null;
};
this.send = function(cmd, args) {
this.$worker.postMessage({command: cmd, args: args});
};
this.call = function(cmd, args, callback) {
if (callback) {
var id = this.callbackId++;
this.callbacks[id] = callback;
args.push(id);
}
this.send(cmd, args);
};
this.emit = function(event, data) {
try {
this.$worker.postMessage({event: event, data: {data: data.data}});
}
catch(ex) {
console.error(ex.stack);
}
};
this.attachToDocument = function(doc) {
if(this.$doc)
this.terminate();
this.$doc = doc;
this.call("setValue", [doc.getValue()]);
doc.on("change", this.changeListener);
};
this.changeListener = function(delta) {
if (!this.deltaQueue) {
this.deltaQueue = [];
setTimeout(this.$sendDeltaQueue, 0);
}
if (delta.action == "insert")
this.deltaQueue.push(delta.start, delta.lines);
else
this.deltaQueue.push(delta.start, delta.end);
};
this.$sendDeltaQueue = function() {
var q = this.deltaQueue;
if (!q) return;
this.deltaQueue = null;
if (q.length > 50 && q.length > this.$doc.getLength() >> 1) {
this.call("setValue", [this.$doc.getValue()]);
} else
this.emit("change", {data: q});
};
this.$workerBlob = function(workerUrl) {
var script = "importScripts('" + net.qualifyURL(workerUrl) + "');";
try {
return new Blob([script], {"type": "application/javascript"});
} catch (e) { // Backwards-compatibility
var BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder;
var blobBuilder = new BlobBuilder();
blobBuilder.append(script);
return blobBuilder.getBlob("application/javascript");
}
};
}).call(WorkerClient.prototype);
var UIWorkerClient = function(topLevelNamespaces, mod, classname) {
this.$sendDeltaQueue = this.$sendDeltaQueue.bind(this);
this.changeListener = this.changeListener.bind(this);
this.callbackId = 1;
this.callbacks = {};
this.messageBuffer = [];
var main = null;
var emitSync = false;
var sender = Object.create(EventEmitter);
var _self = this;
this.$worker = {};
this.$worker.terminate = function() {};
this.$worker.postMessage = function(e) {
_self.messageBuffer.push(e);
if (main) {
if (emitSync)
setTimeout(processNext);
else
processNext();
}
};
this.setEmitSync = function(val) { emitSync = val };
var processNext = function() {
var msg = _self.messageBuffer.shift();
if (msg.command)
main[msg.command].apply(main, msg.args);
else if (msg.event)
sender._signal(msg.event, msg.data);
};
sender.postMessage = function(msg) {
_self.onMessage({data: msg});
};
sender.callback = function(data, callbackId) {
this.postMessage({type: "call", id: callbackId, data: data});
};
sender.emit = function(name, data) {
this.postMessage({type: "event", name: name, data: data});
};
config.loadModule(["worker", mod], function(Main) {
main = new Main[classname](sender);
while (_self.messageBuffer.length)
processNext();
});
};
UIWorkerClient.prototype = WorkerClient.prototype;
exports.UIWorkerClient = UIWorkerClient;
exports.WorkerClient = WorkerClient;
});
ace.define("ace/placeholder",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/oop"], function(acequire, exports, module) {
"use strict";
var Range = acequire("./range").Range;
var EventEmitter = acequire("./lib/event_emitter").EventEmitter;
var oop = acequire("./lib/oop");
var PlaceHolder = function(session, length, pos, others, mainClass, othersClass) {
var _self = this;
this.length = length;
this.session = session;
this.doc = session.getDocument();
this.mainClass = mainClass;
this.othersClass = othersClass;
this.$onUpdate = this.onUpdate.bind(this);
this.doc.on("change", this.$onUpdate);
this.$others = others;
this.$onCursorChange = function() {
setTimeout(function() {
_self.onCursorChange();
});
};
this.$pos = pos;
var undoStack = session.getUndoManager().$undoStack || session.getUndoManager().$undostack || {length: -1};
this.$undoStackDepth = undoStack.length;
this.setup();
session.selection.on("changeCursor", this.$onCursorChange);
};
(function() {
oop.implement(this, EventEmitter);
this.setup = function() {
var _self = this;
var doc = this.doc;
var session = this.session;
this.selectionBefore = session.selection.toJSON();
if (session.selection.inMultiSelectMode)
session.selection.toSingleRange();
this.pos = doc.createAnchor(this.$pos.row, this.$pos.column);
var pos = this.pos;
pos.$insertRight = true;
pos.detach();
pos.markerId = session.addMarker(new Range(pos.row, pos.column, pos.row, pos.column + this.length), this.mainClass, null, false);
this.others = [];
this.$others.forEach(function(other) {
var anchor = doc.createAnchor(other.row, other.column);
anchor.$insertRight = true;
anchor.detach();
_self.others.push(anchor);
});
session.setUndoSelect(false);
};
this.showOtherMarkers = function() {
if (this.othersActive) return;
var session = this.session;
var _self = this;
this.othersActive = true;
this.others.forEach(function(anchor) {
anchor.markerId = session.addMarker(new Range(anchor.row, anchor.column, anchor.row, anchor.column+_self.length), _self.othersClass, null, false);
});
};
this.hideOtherMarkers = function() {
if (!this.othersActive) return;
this.othersActive = false;
for (var i = 0; i < this.others.length; i++) {
this.session.removeMarker(this.others[i].markerId);
}
};
this.onUpdate = function(delta) {
if (this.$updating)
return this.updateAnchors(delta);
var range = delta;
if (range.start.row !== range.end.row) return;
if (range.start.row !== this.pos.row) return;
this.$updating = true;
var lengthDiff = delta.action === "insert" ? range.end.column - range.start.column : range.start.column - range.end.column;
var inMainRange = range.start.column >= this.pos.column && range.start.column <= this.pos.column + this.length + 1;
var distanceFromStart = range.start.column - this.pos.column;
this.updateAnchors(delta);
if (inMainRange)
this.length += lengthDiff;
if (inMainRange && !this.session.$fromUndo) {
if (delta.action === 'insert') {
for (var i = this.others.length - 1; i >= 0; i--) {
var otherPos = this.others[i];
var newPos = {row: otherPos.row, column: otherPos.column + distanceFromStart};
this.doc.insertMergedLines(newPos, delta.lines);
}
} else if (delta.action === 'remove') {
for (var i = this.others.length - 1; i >= 0; i--) {
var otherPos = this.others[i];
var newPos = {row: otherPos.row, column: otherPos.column + distanceFromStart};
this.doc.remove(new Range(newPos.row, newPos.column, newPos.row, newPos.column - lengthDiff));
}
}
}
this.$updating = false;
this.updateMarkers();
};
this.updateAnchors = function(delta) {
this.pos.onChange(delta);
for (var i = this.others.length; i--;)
this.others[i].onChange(delta);
this.updateMarkers();
};
this.updateMarkers = function() {
if (this.$updating)
return;
var _self = this;
var session = this.session;
var updateMarker = function(pos, className) {
session.removeMarker(pos.markerId);
pos.markerId = session.addMarker(new Range(pos.row, pos.column, pos.row, pos.column+_self.length), className, null, false);
};
updateMarker(this.pos, this.mainClass);
for (var i = this.others.length; i--;)
updateMarker(this.others[i], this.othersClass);
};
this.onCursorChange = function(event) {
if (this.$updating || !this.session) return;
var pos = this.session.selection.getCursor();
if (pos.row === this.pos.row && pos.column >= this.pos.column && pos.column <= this.pos.column + this.length) {
this.showOtherMarkers();
this._emit("cursorEnter", event);
} else {
this.hideOtherMarkers();
this._emit("cursorLeave", event);
}
};
this.detach = function() {
this.session.removeMarker(this.pos && this.pos.markerId);
this.hideOtherMarkers();
this.doc.removeEventListener("change", this.$onUpdate);
this.session.selection.removeEventListener("changeCursor", this.$onCursorChange);
this.session.setUndoSelect(true);
this.session = null;
};
this.cancel = function() {
if (this.$undoStackDepth === -1)
return;
var undoManager = this.session.getUndoManager();
var undosRequired = (undoManager.$undoStack || undoManager.$undostack).length - this.$undoStackDepth;
for (var i = 0; i < undosRequired; i++) {
undoManager.undo(true);
}
if (this.selectionBefore)
this.session.selection.fromJSON(this.selectionBefore);
};
}).call(PlaceHolder.prototype);
exports.PlaceHolder = PlaceHolder;
});
ace.define("ace/mouse/multi_select_handler",["require","exports","module","ace/lib/event","ace/lib/useragent"], function(acequire, exports, module) {
var event = acequire("../lib/event");
var useragent = acequire("../lib/useragent");
function isSamePoint(p1, p2) {
return p1.row == p2.row && p1.column == p2.column;
}
function onMouseDown(e) {
var ev = e.domEvent;
var alt = ev.altKey;
var shift = ev.shiftKey;
var ctrl = ev.ctrlKey;
var accel = e.getAccelKey();
var button = e.getButton();
if (ctrl && useragent.isMac)
button = ev.button;
if (e.editor.inMultiSelectMode && button == 2) {
e.editor.textInput.onContextMenu(e.domEvent);
return;
}
if (!ctrl && !alt && !accel) {
if (button === 0 && e.editor.inMultiSelectMode)
e.editor.exitMultiSelectMode();
return;
}
if (button !== 0)
return;
var editor = e.editor;
var selection = editor.selection;
var isMultiSelect = editor.inMultiSelectMode;
var pos = e.getDocumentPosition();
var cursor = selection.getCursor();
var inSelection = e.inSelection() || (selection.isEmpty() && isSamePoint(pos, cursor));
var mouseX = e.x, mouseY = e.y;
var onMouseSelection = function(e) {
mouseX = e.clientX;
mouseY = e.clientY;
};
var session = editor.session;
var screenAnchor = editor.renderer.pixelToScreenCoordinates(mouseX, mouseY);
var screenCursor = screenAnchor;
var selectionMode;
if (editor.$mouseHandler.$enableJumpToDef) {
if (ctrl && alt || accel && alt)
selectionMode = shift ? "block" : "add";
else if (alt && editor.$blockSelectEnabled)
selectionMode = "block";
} else {
if (accel && !alt) {
selectionMode = "add";
if (!isMultiSelect && shift)
return;
} else if (alt && editor.$blockSelectEnabled) {
selectionMode = "block";
}
}
if (selectionMode && useragent.isMac && ev.ctrlKey) {
editor.$mouseHandler.cancelContextMenu();
}
if (selectionMode == "add") {
if (!isMultiSelect && inSelection)
return; // dragging
if (!isMultiSelect) {
var range = selection.toOrientedRange();
editor.addSelectionMarker(range);
}
var oldRange = selection.rangeList.rangeAtPoint(pos);
editor.$blockScrolling++;
editor.inVirtualSelectionMode = true;
if (shift) {
oldRange = null;
range = selection.ranges[0] || range;
editor.removeSelectionMarker(range);
}
editor.once("mouseup", function() {
var tmpSel = selection.toOrientedRange();
if (oldRange && tmpSel.isEmpty() && isSamePoint(oldRange.cursor, tmpSel.cursor))
selection.substractPoint(tmpSel.cursor);
else {
if (shift) {
selection.substractPoint(range.cursor);
} else if (range) {
editor.removeSelectionMarker(range);
selection.addRange(range);
}
selection.addRange(tmpSel);
}
editor.$blockScrolling--;
editor.inVirtualSelectionMode = false;
});
} else if (selectionMode == "block") {
e.stop();
editor.inVirtualSelectionMode = true;
var initialRange;
var rectSel = [];
var blockSelect = function() {
var newCursor = editor.renderer.pixelToScreenCoordinates(mouseX, mouseY);
var cursor = session.screenToDocumentPosition(newCursor.row, newCursor.column);
if (isSamePoint(screenCursor, newCursor) && isSamePoint(cursor, selection.lead))
return;
screenCursor = newCursor;
editor.$blockScrolling++;
editor.selection.moveToPosition(cursor);
editor.renderer.scrollCursorIntoView();
editor.removeSelectionMarkers(rectSel);
rectSel = selection.rectangularRangeBlock(screenCursor, screenAnchor);
if (editor.$mouseHandler.$clickSelection && rectSel.length == 1 && rectSel[0].isEmpty())
rectSel[0] = editor.$mouseHandler.$clickSelection.clone();
rectSel.forEach(editor.addSelectionMarker, editor);
editor.updateSelectionMarkers();
editor.$blockScrolling--;
};
editor.$blockScrolling++;
if (isMultiSelect && !accel) {
selection.toSingleRange();
} else if (!isMultiSelect && accel) {
initialRange = selection.toOrientedRange();
editor.addSelectionMarker(initialRange);
}
if (shift)
screenAnchor = session.documentToScreenPosition(selection.lead);
else
selection.moveToPosition(pos);
editor.$blockScrolling--;
screenCursor = {row: -1, column: -1};
var onMouseSelectionEnd = function(e) {
clearInterval(timerId);
editor.removeSelectionMarkers(rectSel);
if (!rectSel.length)
rectSel = [selection.toOrientedRange()];
editor.$blockScrolling++;
if (initialRange) {
editor.removeSelectionMarker(initialRange);
selection.toSingleRange(initialRange);
}
for (var i = 0; i < rectSel.length; i++)
selection.addRange(rectSel[i]);
editor.inVirtualSelectionMode = false;
editor.$mouseHandler.$clickSelection = null;
editor.$blockScrolling--;
};
var onSelectionInterval = blockSelect;
event.capture(editor.container, onMouseSelection, onMouseSelectionEnd);
var timerId = setInterval(function() {onSelectionInterval();}, 20);
return e.preventDefault();
}
}
exports.onMouseDown = onMouseDown;
});
ace.define("ace/commands/multi_select_commands",["require","exports","module","ace/keyboard/hash_handler"], function(acequire, exports, module) {
exports.defaultCommands = [{
name: "addCursorAbove",
exec: function(editor) { editor.selectMoreLines(-1); },
bindKey: {win: "Ctrl-Alt-Up", mac: "Ctrl-Alt-Up"},
scrollIntoView: "cursor",
readOnly: true
}, {
name: "addCursorBelow",
exec: function(editor) { editor.selectMoreLines(1); },
bindKey: {win: "Ctrl-Alt-Down", mac: "Ctrl-Alt-Down"},
scrollIntoView: "cursor",
readOnly: true
}, {
name: "addCursorAboveSkipCurrent",
exec: function(editor) { editor.selectMoreLines(-1, true); },
bindKey: {win: "Ctrl-Alt-Shift-Up", mac: "Ctrl-Alt-Shift-Up"},
scrollIntoView: "cursor",
readOnly: true
}, {
name: "addCursorBelowSkipCurrent",
exec: function(editor) { editor.selectMoreLines(1, true); },
bindKey: {win: "Ctrl-Alt-Shift-Down", mac: "Ctrl-Alt-Shift-Down"},
scrollIntoView: "cursor",
readOnly: true
}, {
name: "selectMoreBefore",
exec: function(editor) { editor.selectMore(-1); },
bindKey: {win: "Ctrl-Alt-Left", mac: "Ctrl-Alt-Left"},
scrollIntoView: "cursor",
readOnly: true
}, {
name: "selectMoreAfter",
exec: function(editor) { editor.selectMore(1); },
bindKey: {win: "Ctrl-Alt-Right", mac: "Ctrl-Alt-Right"},
scrollIntoView: "cursor",
readOnly: true
}, {
name: "selectNextBefore",
exec: function(editor) { editor.selectMore(-1, true); },
bindKey: {win: "Ctrl-Alt-Shift-Left", mac: "Ctrl-Alt-Shift-Left"},
scrollIntoView: "cursor",
readOnly: true
}, {
name: "selectNextAfter",
exec: function(editor) { editor.selectMore(1, true); },
bindKey: {win: "Ctrl-Alt-Shift-Right", mac: "Ctrl-Alt-Shift-Right"},
scrollIntoView: "cursor",
readOnly: true
}, {
name: "splitIntoLines",
exec: function(editor) { editor.multiSelect.splitIntoLines(); },
bindKey: {win: "Ctrl-Alt-L", mac: "Ctrl-Alt-L"},
readOnly: true
}, {
name: "alignCursors",
exec: function(editor) { editor.alignCursors(); },
bindKey: {win: "Ctrl-Alt-A", mac: "Ctrl-Alt-A"},
scrollIntoView: "cursor"
}, {
name: "findAll",
exec: function(editor) { editor.findAll(); },
bindKey: {win: "Ctrl-Alt-K", mac: "Ctrl-Alt-G"},
scrollIntoView: "cursor",
readOnly: true
}];
exports.multiSelectCommands = [{
name: "singleSelection",
bindKey: "esc",
exec: function(editor) { editor.exitMultiSelectMode(); },
scrollIntoView: "cursor",
readOnly: true,
isAvailable: function(editor) {return editor && editor.inMultiSelectMode}
}];
var HashHandler = acequire("../keyboard/hash_handler").HashHandler;
exports.keyboardHandler = new HashHandler(exports.multiSelectCommands);
});
ace.define("ace/multi_select",["require","exports","module","ace/range_list","ace/range","ace/selection","ace/mouse/multi_select_handler","ace/lib/event","ace/lib/lang","ace/commands/multi_select_commands","ace/search","ace/edit_session","ace/editor","ace/config"], function(acequire, exports, module) {
var RangeList = acequire("./range_list").RangeList;
var Range = acequire("./range").Range;
var Selection = acequire("./selection").Selection;
var onMouseDown = acequire("./mouse/multi_select_handler").onMouseDown;
var event = acequire("./lib/event");
var lang = acequire("./lib/lang");
var commands = acequire("./commands/multi_select_commands");
exports.commands = commands.defaultCommands.concat(commands.multiSelectCommands);
var Search = acequire("./search").Search;
var search = new Search();
function find(session, needle, dir) {
search.$options.wrap = true;
search.$options.needle = needle;
search.$options.backwards = dir == -1;
return search.find(session);
}
var EditSession = acequire("./edit_session").EditSession;
(function() {
this.getSelectionMarkers = function() {
return this.$selectionMarkers;
};
}).call(EditSession.prototype);
(function() {
this.ranges = null;
this.rangeList = null;
this.addRange = function(range, $blockChangeEvents) {
if (!range)
return;
if (!this.inMultiSelectMode && this.rangeCount === 0) {
var oldRange = this.toOrientedRange();
this.rangeList.add(oldRange);
this.rangeList.add(range);
if (this.rangeList.ranges.length != 2) {
this.rangeList.removeAll();
return $blockChangeEvents || this.fromOrientedRange(range);
}
this.rangeList.removeAll();
this.rangeList.add(oldRange);
this.$onAddRange(oldRange);
}
if (!range.cursor)
range.cursor = range.end;
var removed = this.rangeList.add(range);
this.$onAddRange(range);
if (removed.length)
this.$onRemoveRange(removed);
if (this.rangeCount > 1 && !this.inMultiSelectMode) {
this._signal("multiSelect");
this.inMultiSelectMode = true;
this.session.$undoSelect = false;
this.rangeList.attach(this.session);
}
return $blockChangeEvents || this.fromOrientedRange(range);
};
this.toSingleRange = function(range) {
range = range || this.ranges[0];
var removed = this.rangeList.removeAll();
if (removed.length)
this.$onRemoveRange(removed);
range && this.fromOrientedRange(range);
};
this.substractPoint = function(pos) {
var removed = this.rangeList.substractPoint(pos);
if (removed) {
this.$onRemoveRange(removed);
return removed[0];
}
};
this.mergeOverlappingRanges = function() {
var removed = this.rangeList.merge();
if (removed.length)
this.$onRemoveRange(removed);
else if(this.ranges[0])
this.fromOrientedRange(this.ranges[0]);
};
this.$onAddRange = function(range) {
this.rangeCount = this.rangeList.ranges.length;
this.ranges.unshift(range);
this._signal("addRange", {range: range});
};
this.$onRemoveRange = function(removed) {
this.rangeCount = this.rangeList.ranges.length;
if (this.rangeCount == 1 && this.inMultiSelectMode) {
var lastRange = this.rangeList.ranges.pop();
removed.push(lastRange);
this.rangeCount = 0;
}
for (var i = removed.length; i--; ) {
var index = this.ranges.indexOf(removed[i]);
this.ranges.splice(index, 1);
}
this._signal("removeRange", {ranges: removed});
if (this.rangeCount === 0 && this.inMultiSelectMode) {
this.inMultiSelectMode = false;
this._signal("singleSelect");
this.session.$undoSelect = true;
this.rangeList.detach(this.session);
}
lastRange = lastRange || this.ranges[0];
if (lastRange && !lastRange.isEqual(this.getRange()))
this.fromOrientedRange(lastRange);
};
this.$initRangeList = function() {
if (this.rangeList)
return;
this.rangeList = new RangeList();
this.ranges = [];
this.rangeCount = 0;
};
this.getAllRanges = function() {
return this.rangeCount ? this.rangeList.ranges.concat() : [this.getRange()];
};
this.splitIntoLines = function () {
if (this.rangeCount > 1) {
var ranges = this.rangeList.ranges;
var lastRange = ranges[ranges.length - 1];
var range = Range.fromPoints(ranges[0].start, lastRange.end);
this.toSingleRange();
this.setSelectionRange(range, lastRange.cursor == lastRange.start);
} else {
var range = this.getRange();
var isBackwards = this.isBackwards();
var startRow = range.start.row;
var endRow = range.end.row;
if (startRow == endRow) {
if (isBackwards)
var start = range.end, end = range.start;
else
var start = range.start, end = range.end;
this.addRange(Range.fromPoints(end, end));
this.addRange(Range.fromPoints(start, start));
return;
}
var rectSel = [];
var r = this.getLineRange(startRow, true);
r.start.column = range.start.column;
rectSel.push(r);
for (var i = startRow + 1; i < endRow; i++)
rectSel.push(this.getLineRange(i, true));
r = this.getLineRange(endRow, true);
r.end.column = range.end.column;
rectSel.push(r);
rectSel.forEach(this.addRange, this);
}
};
this.toggleBlockSelection = function () {
if (this.rangeCount > 1) {
var ranges = this.rangeList.ranges;
var lastRange = ranges[ranges.length - 1];
var range = Range.fromPoints(ranges[0].start, lastRange.end);
this.toSingleRange();
this.setSelectionRange(range, lastRange.cursor == lastRange.start);
} else {
var cursor = this.session.documentToScreenPosition(this.selectionLead);
var anchor = this.session.documentToScreenPosition(this.selectionAnchor);
var rectSel = this.rectangularRangeBlock(cursor, anchor);
rectSel.forEach(this.addRange, this);
}
};
this.rectangularRangeBlock = function(screenCursor, screenAnchor, includeEmptyLines) {
var rectSel = [];
var xBackwards = screenCursor.column < screenAnchor.column;
if (xBackwards) {
var startColumn = screenCursor.column;
var endColumn = screenAnchor.column;
} else {
var startColumn = screenAnchor.column;
var endColumn = screenCursor.column;
}
var yBackwards = screenCursor.row < screenAnchor.row;
if (yBackwards) {
var startRow = screenCursor.row;
var endRow = screenAnchor.row;
} else {
var startRow = screenAnchor.row;
var endRow = screenCursor.row;
}
if (startColumn < 0)
startColumn = 0;
if (startRow < 0)
startRow = 0;
if (startRow == endRow)
includeEmptyLines = true;
for (var row = startRow; row <= endRow; row++) {
var range = Range.fromPoints(
this.session.screenToDocumentPosition(row, startColumn),
this.session.screenToDocumentPosition(row, endColumn)
);
if (range.isEmpty()) {
if (docEnd && isSamePoint(range.end, docEnd))
break;
var docEnd = range.end;
}
range.cursor = xBackwards ? range.start : range.end;
rectSel.push(range);
}
if (yBackwards)
rectSel.reverse();
if (!includeEmptyLines) {
var end = rectSel.length - 1;
while (rectSel[end].isEmpty() && end > 0)
end--;
if (end > 0) {
var start = 0;
while (rectSel[start].isEmpty())
start++;
}
for (var i = end; i >= start; i--) {
if (rectSel[i].isEmpty())
rectSel.splice(i, 1);
}
}
return rectSel;
};
}).call(Selection.prototype);
var Editor = acequire("./editor").Editor;
(function() {
this.updateSelectionMarkers = function() {
this.renderer.updateCursor();
this.renderer.updateBackMarkers();
};
this.addSelectionMarker = function(orientedRange) {
if (!orientedRange.cursor)
orientedRange.cursor = orientedRange.end;
var style = this.getSelectionStyle();
orientedRange.marker = this.session.addMarker(orientedRange, "ace_selection", style);
this.session.$selectionMarkers.push(orientedRange);
this.session.selectionMarkerCount = this.session.$selectionMarkers.length;
return orientedRange;
};
this.removeSelectionMarker = function(range) {
if (!range.marker)
return;
this.session.removeMarker(range.marker);
var index = this.session.$selectionMarkers.indexOf(range);
if (index != -1)
this.session.$selectionMarkers.splice(index, 1);
this.session.selectionMarkerCount = this.session.$selectionMarkers.length;
};
this.removeSelectionMarkers = function(ranges) {
var markerList = this.session.$selectionMarkers;
for (var i = ranges.length; i--; ) {
var range = ranges[i];
if (!range.marker)
continue;
this.session.removeMarker(range.marker);
var index = markerList.indexOf(range);
if (index != -1)
markerList.splice(index, 1);
}
this.session.selectionMarkerCount = markerList.length;
};
this.$onAddRange = function(e) {
this.addSelectionMarker(e.range);
this.renderer.updateCursor();
this.renderer.updateBackMarkers();
};
this.$onRemoveRange = function(e) {
this.removeSelectionMarkers(e.ranges);
this.renderer.updateCursor();
this.renderer.updateBackMarkers();
};
this.$onMultiSelect = function(e) {
if (this.inMultiSelectMode)
return;
this.inMultiSelectMode = true;
this.setStyle("ace_multiselect");
this.keyBinding.addKeyboardHandler(commands.keyboardHandler);
this.commands.setDefaultHandler("exec", this.$onMultiSelectExec);
this.renderer.updateCursor();
this.renderer.updateBackMarkers();
};
this.$onSingleSelect = function(e) {
if (this.session.multiSelect.inVirtualMode)
return;
this.inMultiSelectMode = false;
this.unsetStyle("ace_multiselect");
this.keyBinding.removeKeyboardHandler(commands.keyboardHandler);
this.commands.removeDefaultHandler("exec", this.$onMultiSelectExec);
this.renderer.updateCursor();
this.renderer.updateBackMarkers();
this._emit("changeSelection");
};
this.$onMultiSelectExec = function(e) {
var command = e.command;
var editor = e.editor;
if (!editor.multiSelect)
return;
if (!command.multiSelectAction) {
var result = command.exec(editor, e.args || {});
editor.multiSelect.addRange(editor.multiSelect.toOrientedRange());
editor.multiSelect.mergeOverlappingRanges();
} else if (command.multiSelectAction == "forEach") {
result = editor.forEachSelection(command, e.args);
} else if (command.multiSelectAction == "forEachLine") {
result = editor.forEachSelection(command, e.args, true);
} else if (command.multiSelectAction == "single") {
editor.exitMultiSelectMode();
result = command.exec(editor, e.args || {});
} else {
result = command.multiSelectAction(editor, e.args || {});
}
return result;
};
this.forEachSelection = function(cmd, args, options) {
if (this.inVirtualSelectionMode)
return;
var keepOrder = options && options.keepOrder;
var $byLines = options == true || options && options.$byLines
var session = this.session;
var selection = this.selection;
var rangeList = selection.rangeList;
var ranges = (keepOrder ? selection : rangeList).ranges;
var result;
if (!ranges.length)
return cmd.exec ? cmd.exec(this, args || {}) : cmd(this, args || {});
var reg = selection._eventRegistry;
selection._eventRegistry = {};
var tmpSel = new Selection(session);
this.inVirtualSelectionMode = true;
for (var i = ranges.length; i--;) {
if ($byLines) {
while (i > 0 && ranges[i].start.row == ranges[i - 1].end.row)
i--;
}
tmpSel.fromOrientedRange(ranges[i]);
tmpSel.index = i;
this.selection = session.selection = tmpSel;
var cmdResult = cmd.exec ? cmd.exec(this, args || {}) : cmd(this, args || {});
if (!result && cmdResult !== undefined)
result = cmdResult;
tmpSel.toOrientedRange(ranges[i]);
}
tmpSel.detach();
this.selection = session.selection = selection;
this.inVirtualSelectionMode = false;
selection._eventRegistry = reg;
selection.mergeOverlappingRanges();
var anim = this.renderer.$scrollAnimation;
this.onCursorChange();
this.onSelectionChange();
if (anim && anim.from == anim.to)
this.renderer.animateScrolling(anim.from);
return result;
};
this.exitMultiSelectMode = function() {
if (!this.inMultiSelectMode || this.inVirtualSelectionMode)
return;
this.multiSelect.toSingleRange();
};
this.getSelectedText = function() {
var text = "";
if (this.inMultiSelectMode && !this.inVirtualSelectionMode) {
var ranges = this.multiSelect.rangeList.ranges;
var buf = [];
for (var i = 0; i < ranges.length; i++) {
buf.push(this.session.getTextRange(ranges[i]));
}
var nl = this.session.getDocument().getNewLineCharacter();
text = buf.join(nl);
if (text.length == (buf.length - 1) * nl.length)
text = "";
} else if (!this.selection.isEmpty()) {
text = this.session.getTextRange(this.getSelectionRange());
}
return text;
};
this.$checkMultiselectChange = function(e, anchor) {
if (this.inMultiSelectMode && !this.inVirtualSelectionMode) {
var range = this.multiSelect.ranges[0];
if (this.multiSelect.isEmpty() && anchor == this.multiSelect.anchor)
return;
var pos = anchor == this.multiSelect.anchor
? range.cursor == range.start ? range.end : range.start
: range.cursor;
if (pos.row != anchor.row
|| this.session.$clipPositionToDocument(pos.row, pos.column).column != anchor.column)
this.multiSelect.toSingleRange(this.multiSelect.toOrientedRange());
}
};
this.findAll = function(needle, options, additive) {
options = options || {};
options.needle = needle || options.needle;
if (options.needle == undefined) {
var range = this.selection.isEmpty()
? this.selection.getWordRange()
: this.selection.getRange();
options.needle = this.session.getTextRange(range);
}
this.$search.set(options);
var ranges = this.$search.findAll(this.session);
if (!ranges.length)
return 0;
this.$blockScrolling += 1;
var selection = this.multiSelect;
if (!additive)
selection.toSingleRange(ranges[0]);
for (var i = ranges.length; i--; )
selection.addRange(ranges[i], true);
if (range && selection.rangeList.rangeAtPoint(range.start))
selection.addRange(range, true);
this.$blockScrolling -= 1;
return ranges.length;
};
this.selectMoreLines = function(dir, skip) {
var range = this.selection.toOrientedRange();
var isBackwards = range.cursor == range.end;
var screenLead = this.session.documentToScreenPosition(range.cursor);
if (this.selection.$desiredColumn)
screenLead.column = this.selection.$desiredColumn;
var lead = this.session.screenToDocumentPosition(screenLead.row + dir, screenLead.column);
if (!range.isEmpty()) {
var screenAnchor = this.session.documentToScreenPosition(isBackwards ? range.end : range.start);
var anchor = this.session.screenToDocumentPosition(screenAnchor.row + dir, screenAnchor.column);
} else {
var anchor = lead;
}
if (isBackwards) {
var newRange = Range.fromPoints(lead, anchor);
newRange.cursor = newRange.start;
} else {
var newRange = Range.fromPoints(anchor, lead);
newRange.cursor = newRange.end;
}
newRange.desiredColumn = screenLead.column;
if (!this.selection.inMultiSelectMode) {
this.selection.addRange(range);
} else {
if (skip)
var toRemove = range.cursor;
}
this.selection.addRange(newRange);
if (toRemove)
this.selection.substractPoint(toRemove);
};
this.transposeSelections = function(dir) {
var session = this.session;
var sel = session.multiSelect;
var all = sel.ranges;
for (var i = all.length; i--; ) {
var range = all[i];
if (range.isEmpty()) {
var tmp = session.getWordRange(range.start.row, range.start.column);
range.start.row = tmp.start.row;
range.start.column = tmp.start.column;
range.end.row = tmp.end.row;
range.end.column = tmp.end.column;
}
}
sel.mergeOverlappingRanges();
var words = [];
for (var i = all.length; i--; ) {
var range = all[i];
words.unshift(session.getTextRange(range));
}
if (dir < 0)
words.unshift(words.pop());
else
words.push(words.shift());
for (var i = all.length; i--; ) {
var range = all[i];
var tmp = range.clone();
session.replace(range, words[i]);
range.start.row = tmp.start.row;
range.start.column = tmp.start.column;
}
};
this.selectMore = function(dir, skip, stopAtFirst) {
var session = this.session;
var sel = session.multiSelect;
var range = sel.toOrientedRange();
if (range.isEmpty()) {
range = session.getWordRange(range.start.row, range.start.column);
range.cursor = dir == -1 ? range.start : range.end;
this.multiSelect.addRange(range);
if (stopAtFirst)
return;
}
var needle = session.getTextRange(range);
var newRange = find(session, needle, dir);
if (newRange) {
newRange.cursor = dir == -1 ? newRange.start : newRange.end;
this.$blockScrolling += 1;
this.session.unfold(newRange);
this.multiSelect.addRange(newRange);
this.$blockScrolling -= 1;
this.renderer.scrollCursorIntoView(null, 0.5);
}
if (skip)
this.multiSelect.substractPoint(range.cursor);
};
this.alignCursors = function() {
var session = this.session;
var sel = session.multiSelect;
var ranges = sel.ranges;
var row = -1;
var sameRowRanges = ranges.filter(function(r) {
if (r.cursor.row == row)
return true;
row = r.cursor.row;
});
if (!ranges.length || sameRowRanges.length == ranges.length - 1) {
var range = this.selection.getRange();
var fr = range.start.row, lr = range.end.row;
var guessRange = fr == lr;
if (guessRange) {
var max = this.session.getLength();
var line;
do {
line = this.session.getLine(lr);
} while (/[=:]/.test(line) && ++lr < max);
do {
line = this.session.getLine(fr);
} while (/[=:]/.test(line) && --fr > 0);
if (fr < 0) fr = 0;
if (lr >= max) lr = max - 1;
}
var lines = this.session.removeFullLines(fr, lr);
lines = this.$reAlignText(lines, guessRange);
this.session.insert({row: fr, column: 0}, lines.join("\n") + "\n");
if (!guessRange) {
range.start.column = 0;
range.end.column = lines[lines.length - 1].length;
}
this.selection.setRange(range);
} else {
sameRowRanges.forEach(function(r) {
sel.substractPoint(r.cursor);
});
var maxCol = 0;
var minSpace = Infinity;
var spaceOffsets = ranges.map(function(r) {
var p = r.cursor;
var line = session.getLine(p.row);
var spaceOffset = line.substr(p.column).search(/\S/g);
if (spaceOffset == -1)
spaceOffset = 0;
if (p.column > maxCol)
maxCol = p.column;
if (spaceOffset < minSpace)
minSpace = spaceOffset;
return spaceOffset;
});
ranges.forEach(function(r, i) {
var p = r.cursor;
var l = maxCol - p.column;
var d = spaceOffsets[i] - minSpace;
if (l > d)
session.insert(p, lang.stringRepeat(" ", l - d));
else
session.remove(new Range(p.row, p.column, p.row, p.column - l + d));
r.start.column = r.end.column = maxCol;
r.start.row = r.end.row = p.row;
r.cursor = r.end;
});
sel.fromOrientedRange(ranges[0]);
this.renderer.updateCursor();
this.renderer.updateBackMarkers();
}
};
this.$reAlignText = function(lines, forceLeft) {
var isLeftAligned = true, isRightAligned = true;
var startW, textW, endW;
return lines.map(function(line) {
var m = line.match(/(\s*)(.*?)(\s*)([=:].*)/);
if (!m)
return [line];
if (startW == null) {
startW = m[1].length;
textW = m[2].length;
endW = m[3].length;
return m;
}
if (startW + textW + endW != m[1].length + m[2].length + m[3].length)
isRightAligned = false;
if (startW != m[1].length)
isLeftAligned = false;
if (startW > m[1].length)
startW = m[1].length;
if (textW < m[2].length)
textW = m[2].length;
if (endW > m[3].length)
endW = m[3].length;
return m;
}).map(forceLeft ? alignLeft :
isLeftAligned ? isRightAligned ? alignRight : alignLeft : unAlign);
function spaces(n) {
return lang.stringRepeat(" ", n);
}
function alignLeft(m) {
return !m[2] ? m[0] : spaces(startW) + m[2]
+ spaces(textW - m[2].length + endW)
+ m[4].replace(/^([=:])\s+/, "$1 ");
}
function alignRight(m) {
return !m[2] ? m[0] : spaces(startW + textW - m[2].length) + m[2]
+ spaces(endW, " ")
+ m[4].replace(/^([=:])\s+/, "$1 ");
}
function unAlign(m) {
return !m[2] ? m[0] : spaces(startW) + m[2]
+ spaces(endW)
+ m[4].replace(/^([=:])\s+/, "$1 ");
}
};
}).call(Editor.prototype);
function isSamePoint(p1, p2) {
return p1.row == p2.row && p1.column == p2.column;
}
exports.onSessionChange = function(e) {
var session = e.session;
if (session && !session.multiSelect) {
session.$selectionMarkers = [];
session.selection.$initRangeList();
session.multiSelect = session.selection;
}
this.multiSelect = session && session.multiSelect;
var oldSession = e.oldSession;
if (oldSession) {
oldSession.multiSelect.off("addRange", this.$onAddRange);
oldSession.multiSelect.off("removeRange", this.$onRemoveRange);
oldSession.multiSelect.off("multiSelect", this.$onMultiSelect);
oldSession.multiSelect.off("singleSelect", this.$onSingleSelect);
oldSession.multiSelect.lead.off("change", this.$checkMultiselectChange);
oldSession.multiSelect.anchor.off("change", this.$checkMultiselectChange);
}
if (session) {
session.multiSelect.on("addRange", this.$onAddRange);
session.multiSelect.on("removeRange", this.$onRemoveRange);
session.multiSelect.on("multiSelect", this.$onMultiSelect);
session.multiSelect.on("singleSelect", this.$onSingleSelect);
session.multiSelect.lead.on("change", this.$checkMultiselectChange);
session.multiSelect.anchor.on("change", this.$checkMultiselectChange);
}
if (session && this.inMultiSelectMode != session.selection.inMultiSelectMode) {
if (session.selection.inMultiSelectMode)
this.$onMultiSelect();
else
this.$onSingleSelect();
}
};
function MultiSelect(editor) {
if (editor.$multiselectOnSessionChange)
return;
editor.$onAddRange = editor.$onAddRange.bind(editor);
editor.$onRemoveRange = editor.$onRemoveRange.bind(editor);
editor.$onMultiSelect = editor.$onMultiSelect.bind(editor);
editor.$onSingleSelect = editor.$onSingleSelect.bind(editor);
editor.$multiselectOnSessionChange = exports.onSessionChange.bind(editor);
editor.$checkMultiselectChange = editor.$checkMultiselectChange.bind(editor);
editor.$multiselectOnSessionChange(editor);
editor.on("changeSession", editor.$multiselectOnSessionChange);
editor.on("mousedown", onMouseDown);
editor.commands.addCommands(commands.defaultCommands);
addAltCursorListeners(editor);
}
function addAltCursorListeners(editor){
var el = editor.textInput.getElement();
var altCursor = false;
event.addListener(el, "keydown", function(e) {
var altDown = e.keyCode == 18 && !(e.ctrlKey || e.shiftKey || e.metaKey);
if (editor.$blockSelectEnabled && altDown) {
if (!altCursor) {
editor.renderer.setMouseCursor("crosshair");
altCursor = true;
}
} else if (altCursor) {
reset();
}
});
event.addListener(el, "keyup", reset);
event.addListener(el, "blur", reset);
function reset(e) {
if (altCursor) {
editor.renderer.setMouseCursor("");
altCursor = false;
}
}
}
exports.MultiSelect = MultiSelect;
acequire("./config").defineOptions(Editor.prototype, "editor", {
enableMultiselect: {
set: function(val) {
MultiSelect(this);
if (val) {
this.on("changeSession", this.$multiselectOnSessionChange);
this.on("mousedown", onMouseDown);
} else {
this.off("changeSession", this.$multiselectOnSessionChange);
this.off("mousedown", onMouseDown);
}
},
value: true
},
enableBlockSelect: {
set: function(val) {
this.$blockSelectEnabled = val;
},
value: true
}
});
});
ace.define("ace/mode/folding/fold_mode",["require","exports","module","ace/range"], function(acequire, exports, module) {
"use strict";
var Range = acequire("../../range").Range;
var FoldMode = exports.FoldMode = function() {};
(function() {
this.foldingStartMarker = null;
this.foldingStopMarker = null;
this.getFoldWidget = function(session, foldStyle, row) {
var line = session.getLine(row);
if (this.foldingStartMarker.test(line))
return "start";
if (foldStyle == "markbeginend"
&& this.foldingStopMarker
&& this.foldingStopMarker.test(line))
return "end";
return "";
};
this.getFoldWidgetRange = function(session, foldStyle, row) {
return null;
};
this.indentationBlock = function(session, row, column) {
var re = /\S/;
var line = session.getLine(row);
var startLevel = line.search(re);
if (startLevel == -1)
return;
var startColumn = column || line.length;
var maxRow = session.getLength();
var startRow = row;
var endRow = row;
while (++row < maxRow) {
var level = session.getLine(row).search(re);
if (level == -1)
continue;
if (level <= startLevel)
break;
endRow = row;
}
if (endRow > startRow) {
var endColumn = session.getLine(endRow).length;
return new Range(startRow, startColumn, endRow, endColumn);
}
};
this.openingBracketBlock = function(session, bracket, row, column, typeRe) {
var start = {row: row, column: column + 1};
var end = session.$findClosingBracket(bracket, start, typeRe);
if (!end)
return;
var fw = session.foldWidgets[end.row];
if (fw == null)
fw = session.getFoldWidget(end.row);
if (fw == "start" && end.row > start.row) {
end.row --;
end.column = session.getLine(end.row).length;
}
return Range.fromPoints(start, end);
};
this.closingBracketBlock = function(session, bracket, row, column, typeRe) {
var end = {row: row, column: column};
var start = session.$findOpeningBracket(bracket, end);
if (!start)
return;
start.column++;
end.column--;
return Range.fromPoints(start, end);
};
}).call(FoldMode.prototype);
});
ace.define("ace/theme/textmate",["require","exports","module","ace/lib/dom"], function(acequire, exports, module) {
"use strict";
exports.isDark = false;
exports.cssClass = "ace-tm";
exports.cssText = ".ace-tm .ace_gutter {\
background: #f0f0f0;\
color: #333;\
}\
.ace-tm .ace_print-margin {\
width: 1px;\
background: #e8e8e8;\
}\
.ace-tm .ace_fold {\
background-color: #6B72E6;\
}\
.ace-tm {\
background-color: #FFFFFF;\
color: black;\
}\
.ace-tm .ace_cursor {\
color: black;\
}\
.ace-tm .ace_invisible {\
color: rgb(191, 191, 191);\
}\
.ace-tm .ace_storage,\
.ace-tm .ace_keyword {\
color: blue;\
}\
.ace-tm .ace_constant {\
color: rgb(197, 6, 11);\
}\
.ace-tm .ace_constant.ace_buildin {\
color: rgb(88, 72, 246);\
}\
.ace-tm .ace_constant.ace_language {\
color: rgb(88, 92, 246);\
}\
.ace-tm .ace_constant.ace_library {\
color: rgb(6, 150, 14);\
}\
.ace-tm .ace_invalid {\
background-color: rgba(255, 0, 0, 0.1);\
color: red;\
}\
.ace-tm .ace_support.ace_function {\
color: rgb(60, 76, 114);\
}\
.ace-tm .ace_support.ace_constant {\
color: rgb(6, 150, 14);\
}\
.ace-tm .ace_support.ace_type,\
.ace-tm .ace_support.ace_class {\
color: rgb(109, 121, 222);\
}\
.ace-tm .ace_keyword.ace_operator {\
color: rgb(104, 118, 135);\
}\
.ace-tm .ace_string {\
color: rgb(3, 106, 7);\
}\
.ace-tm .ace_comment {\
color: rgb(76, 136, 107);\
}\
.ace-tm .ace_comment.ace_doc {\
color: rgb(0, 102, 255);\
}\
.ace-tm .ace_comment.ace_doc.ace_tag {\
color: rgb(128, 159, 191);\
}\
.ace-tm .ace_constant.ace_numeric {\
color: rgb(0, 0, 205);\
}\
.ace-tm .ace_variable {\
color: rgb(49, 132, 149);\
}\
.ace-tm .ace_xml-pe {\
color: rgb(104, 104, 91);\
}\
.ace-tm .ace_entity.ace_name.ace_function {\
color: #0000A2;\
}\
.ace-tm .ace_heading {\
color: rgb(12, 7, 255);\
}\
.ace-tm .ace_list {\
color:rgb(185, 6, 144);\
}\
.ace-tm .ace_meta.ace_tag {\
color:rgb(0, 22, 142);\
}\
.ace-tm .ace_string.ace_regex {\
color: rgb(255, 0, 0)\
}\
.ace-tm .ace_marker-layer .ace_selection {\
background: rgb(181, 213, 255);\
}\
.ace-tm.ace_multiselect .ace_selection.ace_start {\
box-shadow: 0 0 3px 0px white;\
}\
.ace-tm .ace_marker-layer .ace_step {\
background: rgb(252, 255, 0);\
}\
.ace-tm .ace_marker-layer .ace_stack {\
background: rgb(164, 229, 101);\
}\
.ace-tm .ace_marker-layer .ace_bracket {\
margin: -1px 0 0 -1px;\
border: 1px solid rgb(192, 192, 192);\
}\
.ace-tm .ace_marker-layer .ace_active-line {\
background: rgba(0, 0, 0, 0.07);\
}\
.ace-tm .ace_gutter-active-line {\
background-color : #dcdcdc;\
}\
.ace-tm .ace_marker-layer .ace_selected-word {\
background: rgb(250, 250, 255);\
border: 1px solid rgb(200, 200, 250);\
}\
.ace-tm .ace_indent-guide {\
background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==\") right repeat-y;\
}\
";
var dom = acequire("../lib/dom");
dom.importCssString(exports.cssText, exports.cssClass);
});
ace.define("ace/line_widgets",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/range"], function(acequire, exports, module) {
"use strict";
var oop = acequire("./lib/oop");
var dom = acequire("./lib/dom");
var Range = acequire("./range").Range;
function LineWidgets(session) {
this.session = session;
this.session.widgetManager = this;
this.session.getRowLength = this.getRowLength;
this.session.$getWidgetScreenLength = this.$getWidgetScreenLength;
this.updateOnChange = this.updateOnChange.bind(this);
this.renderWidgets = this.renderWidgets.bind(this);
this.measureWidgets = this.measureWidgets.bind(this);
this.session._changedWidgets = [];
this.$onChangeEditor = this.$onChangeEditor.bind(this);
this.session.on("change", this.updateOnChange);
this.session.on("changeFold", this.updateOnFold);
this.session.on("changeEditor", this.$onChangeEditor);
}
(function() {
this.getRowLength = function(row) {
var h;
if (this.lineWidgets)
h = this.lineWidgets[row] && this.lineWidgets[row].rowCount || 0;
else
h = 0;
if (!this.$useWrapMode || !this.$wrapData[row]) {
return 1 + h;
} else {
return this.$wrapData[row].length + 1 + h;
}
};
this.$getWidgetScreenLength = function() {
var screenRows = 0;
this.lineWidgets.forEach(function(w){
if (w && w.rowCount && !w.hidden)
screenRows += w.rowCount;
});
return screenRows;
};
this.$onChangeEditor = function(e) {
this.attach(e.editor);
};
this.attach = function(editor) {
if (editor && editor.widgetManager && editor.widgetManager != this)
editor.widgetManager.detach();
if (this.editor == editor)
return;
this.detach();
this.editor = editor;
if (editor) {
editor.widgetManager = this;
editor.renderer.on("beforeRender", this.measureWidgets);
editor.renderer.on("afterRender", this.renderWidgets);
}
};
this.detach = function(e) {
var editor = this.editor;
if (!editor)
return;
this.editor = null;
editor.widgetManager = null;
editor.renderer.off("beforeRender", this.measureWidgets);
editor.renderer.off("afterRender", this.renderWidgets);
var lineWidgets = this.session.lineWidgets;
lineWidgets && lineWidgets.forEach(function(w) {
if (w && w.el && w.el.parentNode) {
w._inDocument = false;
w.el.parentNode.removeChild(w.el);
}
});
};
this.updateOnFold = function(e, session) {
var lineWidgets = session.lineWidgets;
if (!lineWidgets || !e.action)
return;
var fold = e.data;
var start = fold.start.row;
var end = fold.end.row;
var hide = e.action == "add";
for (var i = start + 1; i < end; i++) {
if (lineWidgets[i])
lineWidgets[i].hidden = hide;
}
if (lineWidgets[end]) {
if (hide) {
if (!lineWidgets[start])
lineWidgets[start] = lineWidgets[end];
else
lineWidgets[end].hidden = hide;
} else {
if (lineWidgets[start] == lineWidgets[end])
lineWidgets[start] = undefined;
lineWidgets[end].hidden = hide;
}
}
};
this.updateOnChange = function(delta) {
var lineWidgets = this.session.lineWidgets;
if (!lineWidgets) return;
var startRow = delta.start.row;
var len = delta.end.row - startRow;
if (len === 0) {
} else if (delta.action == 'remove') {
var removed = lineWidgets.splice(startRow + 1, len);
removed.forEach(function(w) {
w && this.removeLineWidget(w);
}, this);
this.$updateRows();
} else {
var args = new Array(len);
args.unshift(startRow, 0);
lineWidgets.splice.apply(lineWidgets, args);
this.$updateRows();
}
};
this.$updateRows = function() {
var lineWidgets = this.session.lineWidgets;
if (!lineWidgets) return;
var noWidgets = true;
lineWidgets.forEach(function(w, i) {
if (w) {
noWidgets = false;
w.row = i;
while (w.$oldWidget) {
w.$oldWidget.row = i;
w = w.$oldWidget;
}
}
});
if (noWidgets)
this.session.lineWidgets = null;
};
this.addLineWidget = function(w) {
if (!this.session.lineWidgets)
this.session.lineWidgets = new Array(this.session.getLength());
var old = this.session.lineWidgets[w.row];
if (old) {
w.$oldWidget = old;
if (old.el && old.el.parentNode) {
old.el.parentNode.removeChild(old.el);
old._inDocument = false;
}
}
this.session.lineWidgets[w.row] = w;
w.session = this.session;
var renderer = this.editor.renderer;
if (w.html && !w.el) {
w.el = dom.createElement("div");
w.el.innerHTML = w.html;
}
if (w.el) {
dom.addCssClass(w.el, "ace_lineWidgetContainer");
w.el.style.position = "absolute";
w.el.style.zIndex = 5;
renderer.container.appendChild(w.el);
w._inDocument = true;
}
if (!w.coverGutter) {
w.el.style.zIndex = 3;
}
if (w.pixelHeight == null) {
w.pixelHeight = w.el.offsetHeight;
}
if (w.rowCount == null) {
w.rowCount = w.pixelHeight / renderer.layerConfig.lineHeight;
}
var fold = this.session.getFoldAt(w.row, 0);
w.$fold = fold;
if (fold) {
var lineWidgets = this.session.lineWidgets;
if (w.row == fold.end.row && !lineWidgets[fold.start.row])
lineWidgets[fold.start.row] = w;
else
w.hidden = true;
}
this.session._emit("changeFold", {data:{start:{row: w.row}}});
this.$updateRows();
this.renderWidgets(null, renderer);
this.onWidgetChanged(w);
return w;
};
this.removeLineWidget = function(w) {
w._inDocument = false;
w.session = null;
if (w.el && w.el.parentNode)
w.el.parentNode.removeChild(w.el);
if (w.editor && w.editor.destroy) try {
w.editor.destroy();
} catch(e){}
if (this.session.lineWidgets) {
var w1 = this.session.lineWidgets[w.row]
if (w1 == w) {
this.session.lineWidgets[w.row] = w.$oldWidget;
if (w.$oldWidget)
this.onWidgetChanged(w.$oldWidget);
} else {
while (w1) {
if (w1.$oldWidget == w) {
w1.$oldWidget = w.$oldWidget;
break;
}
w1 = w1.$oldWidget;
}
}
}
this.session._emit("changeFold", {data:{start:{row: w.row}}});
this.$updateRows();
};
this.getWidgetsAtRow = function(row) {
var lineWidgets = this.session.lineWidgets;
var w = lineWidgets && lineWidgets[row];
var list = [];
while (w) {
list.push(w);
w = w.$oldWidget;
}
return list;
};
this.onWidgetChanged = function(w) {
this.session._changedWidgets.push(w);
this.editor && this.editor.renderer.updateFull();
};
this.measureWidgets = function(e, renderer) {
var changedWidgets = this.session._changedWidgets;
var config = renderer.layerConfig;
if (!changedWidgets || !changedWidgets.length) return;
var min = Infinity;
for (var i = 0; i < changedWidgets.length; i++) {
var w = changedWidgets[i];
if (!w || !w.el) continue;
if (w.session != this.session) continue;
if (!w._inDocument) {
if (this.session.lineWidgets[w.row] != w)
continue;
w._inDocument = true;
renderer.container.appendChild(w.el);
}
w.h = w.el.offsetHeight;
if (!w.fixedWidth) {
w.w = w.el.offsetWidth;
w.screenWidth = Math.ceil(w.w / config.characterWidth);
}
var rowCount = w.h / config.lineHeight;
if (w.coverLine) {
rowCount -= this.session.getRowLineCount(w.row);
if (rowCount < 0)
rowCount = 0;
}
if (w.rowCount != rowCount) {
w.rowCount = rowCount;
if (w.row < min)
min = w.row;
}
}
if (min != Infinity) {
this.session._emit("changeFold", {data:{start:{row: min}}});
this.session.lineWidgetWidth = null;
}
this.session._changedWidgets = [];
};
this.renderWidgets = function(e, renderer) {
var config = renderer.layerConfig;
var lineWidgets = this.session.lineWidgets;
if (!lineWidgets)
return;
var first = Math.min(this.firstRow, config.firstRow);
var last = Math.max(this.lastRow, config.lastRow, lineWidgets.length);
while (first > 0 && !lineWidgets[first])
first--;
this.firstRow = config.firstRow;
this.lastRow = config.lastRow;
renderer.$cursorLayer.config = config;
for (var i = first; i <= last; i++) {
var w = lineWidgets[i];
if (!w || !w.el) continue;
if (w.hidden) {
w.el.style.top = -100 - (w.pixelHeight || 0) + "px";
continue;
}
if (!w._inDocument) {
w._inDocument = true;
renderer.container.appendChild(w.el);
}
var top = renderer.$cursorLayer.getPixelPosition({row: i, column:0}, true).top;
if (!w.coverLine)
top += config.lineHeight * this.session.getRowLineCount(w.row);
w.el.style.top = top - config.offset + "px";
var left = w.coverGutter ? 0 : renderer.gutterWidth;
if (!w.fixedWidth)
left -= renderer.scrollLeft;
w.el.style.left = left + "px";
if (w.fullWidth && w.screenWidth) {
w.el.style.minWidth = config.width + 2 * config.padding + "px";
}
if (w.fixedWidth) {
w.el.style.right = renderer.scrollBar.getWidth() + "px";
} else {
w.el.style.right = "";
}
}
};
}).call(LineWidgets.prototype);
exports.LineWidgets = LineWidgets;
});
ace.define("ace/ext/error_marker",["require","exports","module","ace/line_widgets","ace/lib/dom","ace/range"], function(acequire, exports, module) {
"use strict";
var LineWidgets = acequire("../line_widgets").LineWidgets;
var dom = acequire("../lib/dom");
var Range = acequire("../range").Range;
function binarySearch(array, needle, comparator) {
var first = 0;
var last = array.length - 1;
while (first <= last) {
var mid = (first + last) >> 1;
var c = comparator(needle, array[mid]);
if (c > 0)
first = mid + 1;
else if (c < 0)
last = mid - 1;
else
return mid;
}
return -(first + 1);
}
function findAnnotations(session, row, dir) {
var annotations = session.getAnnotations().sort(Range.comparePoints);
if (!annotations.length)
return;
var i = binarySearch(annotations, {row: row, column: -1}, Range.comparePoints);
if (i < 0)
i = -i - 1;
if (i >= annotations.length)
i = dir > 0 ? 0 : annotations.length - 1;
else if (i === 0 && dir < 0)
i = annotations.length - 1;
var annotation = annotations[i];
if (!annotation || !dir)
return;
if (annotation.row === row) {
do {
annotation = annotations[i += dir];
} while (annotation && annotation.row === row);
if (!annotation)
return annotations.slice();
}
var matched = [];
row = annotation.row;
do {
matched[dir < 0 ? "unshift" : "push"](annotation);
annotation = annotations[i += dir];
} while (annotation && annotation.row == row);
return matched.length && matched;
}
exports.showErrorMarker = function(editor, dir) {
var session = editor.session;
if (!session.widgetManager) {
session.widgetManager = new LineWidgets(session);
session.widgetManager.attach(editor);
}
var pos = editor.getCursorPosition();
var row = pos.row;
var oldWidget = session.widgetManager.getWidgetsAtRow(row).filter(function(w) {
return w.type == "errorMarker";
})[0];
if (oldWidget) {
oldWidget.destroy();
} else {
row -= dir;
}
var annotations = findAnnotations(session, row, dir);
var gutterAnno;
if (annotations) {
var annotation = annotations[0];
pos.column = (annotation.pos && typeof annotation.column != "number"
? annotation.pos.sc
: annotation.column) || 0;
pos.row = annotation.row;
gutterAnno = editor.renderer.$gutterLayer.$annotations[pos.row];
} else if (oldWidget) {
return;
} else {
gutterAnno = {
text: ["Looks good!"],
className: "ace_ok"
};
}
editor.session.unfold(pos.row);
editor.selection.moveToPosition(pos);
var w = {
row: pos.row,
fixedWidth: true,
coverGutter: true,
el: dom.createElement("div"),
type: "errorMarker"
};
var el = w.el.appendChild(dom.createElement("div"));
var arrow = w.el.appendChild(dom.createElement("div"));
arrow.className = "error_widget_arrow " + gutterAnno.className;
var left = editor.renderer.$cursorLayer
.getPixelPosition(pos).left;
arrow.style.left = left + editor.renderer.gutterWidth - 5 + "px";
w.el.className = "error_widget_wrapper";
el.className = "error_widget " + gutterAnno.className;
el.innerHTML = gutterAnno.text.join("<br>");
el.appendChild(dom.createElement("div"));
var kb = function(_, hashId, keyString) {
if (hashId === 0 && (keyString === "esc" || keyString === "return")) {
w.destroy();
return {command: "null"};
}
};
w.destroy = function() {
if (editor.$mouseHandler.isMousePressed)
return;
editor.keyBinding.removeKeyboardHandler(kb);
session.widgetManager.removeLineWidget(w);
editor.off("changeSelection", w.destroy);
editor.off("changeSession", w.destroy);
editor.off("mouseup", w.destroy);
editor.off("change", w.destroy);
};
editor.keyBinding.addKeyboardHandler(kb);
editor.on("changeSelection", w.destroy);
editor.on("changeSession", w.destroy);
editor.on("mouseup", w.destroy);
editor.on("change", w.destroy);
editor.session.widgetManager.addLineWidget(w);
w.el.onmousedown = editor.focus.bind(editor);
editor.renderer.scrollCursorIntoView(null, 0.5, {bottom: w.el.offsetHeight});
};
dom.importCssString("\
.error_widget_wrapper {\
background: inherit;\
color: inherit;\
border:none\
}\
.error_widget {\
border-top: solid 2px;\
border-bottom: solid 2px;\
margin: 5px 0;\
padding: 10px 40px;\
white-space: pre-wrap;\
}\
.error_widget.ace_error, .error_widget_arrow.ace_error{\
border-color: #ff5a5a\
}\
.error_widget.ace_warning, .error_widget_arrow.ace_warning{\
border-color: #F1D817\
}\
.error_widget.ace_info, .error_widget_arrow.ace_info{\
border-color: #5a5a5a\
}\
.error_widget.ace_ok, .error_widget_arrow.ace_ok{\
border-color: #5aaa5a\
}\
.error_widget_arrow {\
position: absolute;\
border: solid 5px;\
border-top-color: transparent!important;\
border-right-color: transparent!important;\
border-left-color: transparent!important;\
top: -5px;\
}\
", "");
});
ace.define("ace/ace",["require","exports","module","ace/lib/fixoldbrowsers","ace/lib/dom","ace/lib/event","ace/editor","ace/edit_session","ace/undomanager","ace/virtual_renderer","ace/worker/worker_client","ace/keyboard/hash_handler","ace/placeholder","ace/multi_select","ace/mode/folding/fold_mode","ace/theme/textmate","ace/ext/error_marker","ace/config"], function(acequire, exports, module) {
"use strict";
acequire("./lib/fixoldbrowsers");
var dom = acequire("./lib/dom");
var event = acequire("./lib/event");
var Editor = acequire("./editor").Editor;
var EditSession = acequire("./edit_session").EditSession;
var UndoManager = acequire("./undomanager").UndoManager;
var Renderer = acequire("./virtual_renderer").VirtualRenderer;
acequire("./worker/worker_client");
acequire("./keyboard/hash_handler");
acequire("./placeholder");
acequire("./multi_select");
acequire("./mode/folding/fold_mode");
acequire("./theme/textmate");
acequire("./ext/error_marker");
exports.config = acequire("./config");
exports.acequire = acequire;
if (true)
exports.define = __webpack_require__(5);
exports.edit = function(el) {
if (typeof el == "string") {
var _id = el;
el = document.getElementById(_id);
if (!el)
throw new Error("ace.edit can't find div #" + _id);
}
if (el && el.env && el.env.editor instanceof Editor)
return el.env.editor;
var value = "";
if (el && /input|textarea/i.test(el.tagName)) {
var oldNode = el;
value = oldNode.value;
el = dom.createElement("pre");
oldNode.parentNode.replaceChild(el, oldNode);
} else if (el) {
value = dom.getInnerText(el);
el.innerHTML = "";
}
var doc = exports.createEditSession(value);
var editor = new Editor(new Renderer(el));
editor.setSession(doc);
var env = {
document: doc,
editor: editor,
onResize: editor.resize.bind(editor, null)
};
if (oldNode) env.textarea = oldNode;
event.addListener(window, "resize", env.onResize);
editor.on("destroy", function() {
event.removeListener(window, "resize", env.onResize);
env.editor.container.env = null; // prevent memory leak on old ie
});
editor.container.env = editor.env = env;
return editor;
};
exports.createEditSession = function(text, mode) {
var doc = new EditSession(text, mode);
doc.setUndoManager(new UndoManager());
return doc;
}
exports.EditSession = EditSession;
exports.UndoManager = UndoManager;
exports.version = "1.2.6";
});
(function() {
ace.acequire(["ace/ace"], function(a) {
if (a) {
a.config.init(true);
a.define = ace.define;
}
if (!window.ace)
window.ace = a;
for (var key in a) if (a.hasOwnProperty(key))
window.ace[key] = a[key];
});
})();
module.exports = window.ace.acequire("ace/ace");
/***/ }),
/* 5 */
/***/ (function(module, exports) {
module.exports = function() {
throw new Error("define cannot be used indirect");
};
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
if (false) {
module.exports = require('./cjs/react.production.min.js');
} else {
module.exports = __webpack_require__(15);
}
/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/
/* eslint-disable no-unused-vars */
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var hasOwnProperty = Object.prototype.hasOwnProperty;
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
function toObject(val) {
if (val === null || val === undefined) {
throw new TypeError('Object.assign cannot be called with null or undefined');
}
return Object(val);
}
function shouldUseNative() {
try {
if (!Object.assign) {
return false;
}
// Detect buggy property enumeration order in older V8 versions.
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
test1[5] = 'de';
if (Object.getOwnPropertyNames(test1)[0] === '5') {
return false;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test2 = {};
for (var i = 0; i < 10; i++) {
test2['_' + String.fromCharCode(i)] = i;
}
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
return test2[n];
});
if (order2.join('') !== '0123456789') {
return false;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test3 = {};
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
test3[letter] = letter;
});
if (Object.keys(Object.assign({}, test3)).join('') !==
'abcdefghijklmnopqrst') {
return false;
}
return true;
} catch (err) {
// We don't expect any of the above to throw, but better to be safe.
return false;
}
}
module.exports = shouldUseNative() ? Object.assign : function (target, source) {
var from;
var to = toObject(target);
var symbols;
for (var s = 1; s < arguments.length; s++) {
from = Object(arguments[s]);
for (var key in from) {
if (hasOwnProperty.call(from, key)) {
to[key] = from[key];
}
}
if (getOwnPropertySymbols) {
symbols = getOwnPropertySymbols(from);
for (var i = 0; i < symbols.length; i++) {
if (propIsEnumerable.call(from, symbols[i])) {
to[symbols[i]] = from[symbols[i]];
}
}
}
}
return to;
};
/***/ }),
/* 8 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
if (true) {
var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
Symbol.for &&
Symbol.for('react.element')) ||
0xeac7;
var isValidElement = function(object) {
return typeof object === 'object' &&
object !== null &&
object.$$typeof === REACT_ELEMENT_TYPE;
};
// By explicitly using `prop-types` you are opting into new development behavior.
// http://fb.me/prop-types-in-prod
var throwOnDirectAccess = true;
module.exports = __webpack_require__(19)(isValidElement, throwOnDirectAccess);
} else {
// By explicitly using `prop-types` you are opting into new production behavior.
// http://fb.me/prop-types-in-prod
module.exports = require('./factoryWithThrowingShims')();
}
/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
module.exports = ReactPropTypesSecret;
/***/ }),
/* 10 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global, module) {/**
* Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="npm" -o ./`
* Copyright JS Foundation and other contributors <https://js.foundation/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED = '__lodash_hash_undefined__';
/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG = 1,
COMPARE_UNORDERED_FLAG = 2;
/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER = 9007199254740991;
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
arrayTag = '[object Array]',
asyncTag = '[object AsyncFunction]',
boolTag = '[object Boolean]',
dateTag = '[object Date]',
errorTag = '[object Error]',
funcTag = '[object Function]',
genTag = '[object GeneratorFunction]',
mapTag = '[object Map]',
numberTag = '[object Number]',
nullTag = '[object Null]',
objectTag = '[object Object]',
promiseTag = '[object Promise]',
proxyTag = '[object Proxy]',
regexpTag = '[object RegExp]',
setTag = '[object Set]',
stringTag = '[object String]',
symbolTag = '[object Symbol]',
undefinedTag = '[object Undefined]',
weakMapTag = '[object WeakMap]';
var arrayBufferTag = '[object ArrayBuffer]',
dataViewTag = '[object DataView]',
float32Tag = '[object Float32Array]',
float64Tag = '[object Float64Array]',
int8Tag = '[object Int8Array]',
int16Tag = '[object Int16Array]',
int32Tag = '[object Int32Array]',
uint8Tag = '[object Uint8Array]',
uint8ClampedTag = '[object Uint8ClampedArray]',
uint16Tag = '[object Uint16Array]',
uint32Tag = '[object Uint32Array]';
/**
* Used to match `RegExp`
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
*/
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
/** Used to detect host constructors (Safari). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;
/** Used to detect unsigned integer values. */
var reIsUint = /^(?:0|[1-9]\d*)$/;
/** Used to identify `toStringTag` values of typed arrays. */
var typedArrayTags = {};
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
typedArrayTags[uint32Tag] = true;
typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
typedArrayTags[errorTag] = typedArrayTags[funcTag] =
typedArrayTags[mapTag] = typedArrayTags[numberTag] =
typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
typedArrayTags[setTag] = typedArrayTags[stringTag] =
typedArrayTags[weakMapTag] = false;
/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root = freeGlobal || freeSelf || Function('return this')();
/** Detect free variable `exports`. */
var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
/** Detect free variable `module`. */
var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports;
/** Detect free variable `process` from Node.js. */
var freeProcess = moduleExports && freeGlobal.process;
/** Used to access faster Node.js helpers. */
var nodeUtil = (function() {
try {
return freeProcess && freeProcess.binding && freeProcess.binding('util');
} catch (e) {}
}());
/* Node.js helper references. */
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
/**
* A specialized version of `_.filter` for arrays without support for
* iteratee shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
*/
function arrayFilter(array, predicate) {
var index = -1,
length = array == null ? 0 : array.length,
resIndex = 0,
result = [];
while (++index < length) {
var value = array[index];
if (predicate(value, index, array)) {
result[resIndex++] = value;
}
}
return result;
}
/**
* Appends the elements of `values` to `array`.
*
* @private
* @param {Array} array The array to modify.
* @param {Array} values The values to append.
* @returns {Array} Returns `array`.
*/
function arrayPush(array, values) {
var index = -1,
length = values.length,
offset = array.length;
while (++index < length) {
array[offset + index] = values[index];
}
return array;
}
/**
* A specialized version of `_.some` for arrays without support for iteratee
* shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {boolean} Returns `true` if any element passes the predicate check,
* else `false`.
*/
function arraySome(array, predicate) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
if (predicate(array[index], index, array)) {
return true;
}
}
return false;
}
/**
* The base implementation of `_.times` without support for iteratee shorthands
* or max array length checks.
*
* @private
* @param {number} n The number of times to invoke `iteratee`.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the array of results.
*/
function baseTimes(n, iteratee) {
var index = -1,
result = Array(n);
while (++index < n) {
result[index] = iteratee(index);
}
return result;
}
/**
* The base implementation of `_.unary` without support for storing metadata.
*
* @private
* @param {Function} func The function to cap arguments for.
* @returns {Function} Returns the new capped function.
*/
function baseUnary(func) {
return function(value) {
return func(value);
};
}
/**
* Checks if a `cache` value for `key` exists.
*
* @private
* @param {Object} cache The cache to query.
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function cacheHas(cache, key) {
return cache.has(key);
}
/**
* Gets the value at `key` of `object`.
*
* @private
* @param {Object} [object] The object to query.
* @param {string} key The key of the property to get.
* @returns {*} Returns the property value.
*/
function getValue(object, key) {
return object == null ? undefined : object[key];
}
/**
* Converts `map` to its key-value pairs.
*
* @private
* @param {Object} map The map to convert.
* @returns {Array} Returns the key-value pairs.
*/
function mapToArray(map) {
var index = -1,
result = Array(map.size);
map.forEach(function(value, key) {
result[++index] = [key, value];
});
return result;
}
/**
* Creates a unary function that invokes `func` with its argument transformed.
*
* @private
* @param {Function} func The function to wrap.
* @param {Function} transform The argument transform.
* @returns {Function} Returns the new function.
*/
function overArg(func, transform) {
return function(arg) {
return func(transform(arg));
};
}
/**
* Converts `set` to an array of its values.
*
* @private
* @param {Object} set The set to convert.
* @returns {Array} Returns the values.
*/
function setToArray(set) {
var index = -1,
result = Array(set.size);
set.forEach(function(value) {
result[++index] = value;
});
return result;
}
/** Used for built-in method references. */
var arrayProto = Array.prototype,
funcProto = Function.prototype,
objectProto = Object.prototype;
/** Used to detect overreaching core-js shims. */
var coreJsData = root['__core-js_shared__'];
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/** Used to detect methods masquerading as native. */
var maskSrcKey = (function() {
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
return uid ? ('Symbol(src)_1.' + uid) : '';
}());
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString = objectProto.toString;
/** Used to detect if a method is native. */
var reIsNative = RegExp('^' +
funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
);
/** Built-in value references. */
var Buffer = moduleExports ? root.Buffer : undefined,
Symbol = root.Symbol,
Uint8Array = root.Uint8Array,
propertyIsEnumerable = objectProto.propertyIsEnumerable,
splice = arrayProto.splice,
symToStringTag = Symbol ? Symbol.toStringTag : undefined;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeGetSymbols = Object.getOwnPropertySymbols,
nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
nativeKeys = overArg(Object.keys, Object);
/* Built-in method references that are verified to be native. */
var DataView = getNative(root, 'DataView'),
Map = getNative(root, 'Map'),
Promise = getNative(root, 'Promise'),
Set = getNative(root, 'Set'),
WeakMap = getNative(root, 'WeakMap'),
nativeCreate = getNative(Object, 'create');
/** Used to detect maps, sets, and weakmaps. */
var dataViewCtorString = toSource(DataView),
mapCtorString = toSource(Map),
promiseCtorString = toSource(Promise),
setCtorString = toSource(Set),
weakMapCtorString = toSource(WeakMap);
/** Used to convert symbols to primitives and strings. */
var symbolProto = Symbol ? Symbol.prototype : undefined,
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
/**
* Creates a hash object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Hash(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
/**
* Removes all key-value entries from the hash.
*
* @private
* @name clear
* @memberOf Hash
*/
function hashClear() {
this.__data__ = nativeCreate ? nativeCreate(null) : {};
this.size = 0;
}
/**
* Removes `key` and its value from the hash.
*
* @private
* @name delete
* @memberOf Hash
* @param {Object} hash The hash to modify.
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function hashDelete(key) {
var result = this.has(key) && delete this.__data__[key];
this.size -= result ? 1 : 0;
return result;
}
/**
* Gets the hash value for `key`.
*
* @private
* @name get
* @memberOf Hash
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function hashGet(key) {
var data = this.__data__;
if (nativeCreate) {
var result = data[key];
return result === HASH_UNDEFINED ? undefined : result;
}
return hasOwnProperty.call(data, key) ? data[key] : undefined;
}
/**
* Checks if a hash value for `key` exists.
*
* @private
* @name has
* @memberOf Hash
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function hashHas(key) {
var data = this.__data__;
return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
}
/**
* Sets the hash `key` to `value`.
*
* @private
* @name set
* @memberOf Hash
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the hash instance.
*/
function hashSet(key, value) {
var data = this.__data__;
this.size += this.has(key) ? 0 : 1;
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
return this;
}
// Add methods to `Hash`.
Hash.prototype.clear = hashClear;
Hash.prototype['delete'] = hashDelete;
Hash.prototype.get = hashGet;
Hash.prototype.has = hashHas;
Hash.prototype.set = hashSet;
/**
* Creates an list cache object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function ListCache(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
/**
* Removes all key-value entries from the list cache.
*
* @private
* @name clear
* @memberOf ListCache
*/
function listCacheClear() {
this.__data__ = [];
this.size = 0;
}
/**
* Removes `key` and its value from the list cache.
*
* @private
* @name delete
* @memberOf ListCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function listCacheDelete(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
if (index < 0) {
return false;
}
var lastIndex = data.length - 1;
if (index == lastIndex) {
data.pop();
} else {
splice.call(data, index, 1);
}
--this.size;
return true;
}
/**
* Gets the list cache value for `key`.
*
* @private
* @name get
* @memberOf ListCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function listCacheGet(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
return index < 0 ? undefined : data[index][1];
}
/**
* Checks if a list cache value for `key` exists.
*
* @private
* @name has
* @memberOf ListCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function listCacheHas(key) {
return assocIndexOf(this.__data__, key) > -1;
}
/**
* Sets the list cache `key` to `value`.
*
* @private
* @name set
* @memberOf ListCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the list cache instance.
*/
function listCacheSet(key, value) {
var data = this.__data__,
index = assocIndexOf(data, key);
if (index < 0) {
++this.size;
data.push([key, value]);
} else {
data[index][1] = value;
}
return this;
}
// Add methods to `ListCache`.
ListCache.prototype.clear = listCacheClear;
ListCache.prototype['delete'] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;
/**
* Creates a map cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function MapCache(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
/**
* Removes all key-value entries from the map.
*
* @private
* @name clear
* @memberOf MapCache
*/
function mapCacheClear() {
this.size = 0;
this.__data__ = {
'hash': new Hash,
'map': new (Map || ListCache),
'string': new Hash
};
}
/**
* Removes `key` and its value from the map.
*
* @private
* @name delete
* @memberOf MapCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function mapCacheDelete(key) {
var result = getMapData(this, key)['delete'](key);
this.size -= result ? 1 : 0;
return result;
}
/**
* Gets the map value for `key`.
*
* @private
* @name get
* @memberOf MapCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function mapCacheGet(key) {
return getMapData(this, key).get(key);
}
/**
* Checks if a map value for `key` exists.
*
* @private
* @name has
* @memberOf MapCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function mapCacheHas(key) {
return getMapData(this, key).has(key);
}
/**
* Sets the map `key` to `value`.
*
* @private
* @name set
* @memberOf MapCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the map cache instance.
*/
function mapCacheSet(key, value) {
var data = getMapData(this, key),
size = data.size;
data.set(key, value);
this.size += data.size == size ? 0 : 1;
return this;
}
// Add methods to `MapCache`.
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype['delete'] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;
/**
*
* Creates an array cache object to store unique values.
*
* @private
* @constructor
* @param {Array} [values] The values to cache.
*/
function SetCache(values) {
var index = -1,
length = values == null ? 0 : values.length;
this.__data__ = new MapCache;
while (++index < length) {
this.add(values[index]);
}
}
/**
* Adds `value` to the array cache.
*
* @private
* @name add
* @memberOf SetCache
* @alias push
* @param {*} value The value to cache.
* @returns {Object} Returns the cache instance.
*/
function setCacheAdd(value) {
this.__data__.set(value, HASH_UNDEFINED);
return this;
}
/**
* Checks if `value` is in the array cache.
*
* @private
* @name has
* @memberOf SetCache
* @param {*} value The value to search for.
* @returns {number} Returns `true` if `value` is found, else `false`.
*/
function setCacheHas(value) {
return this.__data__.has(value);
}
// Add methods to `SetCache`.
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
SetCache.prototype.has = setCacheHas;
/**
* Creates a stack cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Stack(entries) {
var data = this.__data__ = new ListCache(entries);
this.size = data.size;
}
/**
* Removes all key-value entries from the stack.
*
* @private
* @name clear
* @memberOf Stack
*/
function stackClear() {
this.__data__ = new ListCache;
this.size = 0;
}
/**
* Removes `key` and its value from the stack.
*
* @private
* @name delete
* @memberOf Stack
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function stackDelete(key) {
var data = this.__data__,
result = data['delete'](key);
this.size = data.size;
return result;
}
/**
* Gets the stack value for `key`.
*
* @private
* @name get
* @memberOf Stack
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function stackGet(key) {
return this.__data__.get(key);
}
/**
* Checks if a stack value for `key` exists.
*
* @private
* @name has
* @memberOf Stack
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function stackHas(key) {
return this.__data__.has(key);
}
/**
* Sets the stack `key` to `value`.
*
* @private
* @name set
* @memberOf Stack
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the stack cache instance.
*/
function stackSet(key, value) {
var data = this.__data__;
if (data instanceof ListCache) {
var pairs = data.__data__;
if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
pairs.push([key, value]);
this.size = ++data.size;
return this;
}
data = this.__data__ = new MapCache(pairs);
}
data.set(key, value);
this.size = data.size;
return this;
}
// Add methods to `Stack`.
Stack.prototype.clear = stackClear;
Stack.prototype['delete'] = stackDelete;
Stack.prototype.get = stackGet;
Stack.prototype.has = stackHas;
Stack.prototype.set = stackSet;
/**
* Creates an array of the enumerable property names of the array-like `value`.
*
* @private
* @param {*} value The value to query.
* @param {boolean} inherited Specify returning inherited property names.
* @returns {Array} Returns the array of property names.
*/
function arrayLikeKeys(value, inherited) {
var isArr = isArray(value),
isArg = !isArr && isArguments(value),
isBuff = !isArr && !isArg && isBuffer(value),
isType = !isArr && !isArg && !isBuff && isTypedArray(value),
skipIndexes = isArr || isArg || isBuff || isType,
result = skipIndexes ? baseTimes(value.length, String) : [],
length = result.length;
for (var key in value) {
if ((inherited || hasOwnProperty.call(value, key)) &&
!(skipIndexes && (
// Safari 9 has enumerable `arguments.length` in strict mode.
key == 'length' ||
// Node.js 0.10 has enumerable non-index properties on buffers.
(isBuff && (key == 'offset' || key == 'parent')) ||
// PhantomJS 2 has enumerable non-index properties on typed arrays.
(isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
// Skip index properties.
isIndex(key, length)
))) {
result.push(key);
}
}
return result;
}
/**
* Gets the index at which the `key` is found in `array` of key-value pairs.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} key The key to search for.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function assocIndexOf(array, key) {
var length = array.length;
while (length--) {
if (eq(array[length][0], key)) {
return length;
}
}
return -1;
}
/**
* The base implementation of `getAllKeys` and `getAllKeysIn` which uses
* `keysFunc` and `symbolsFunc` to get the enumerable property names and
* symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {Function} keysFunc The function to get the keys of `object`.
* @param {Function} symbolsFunc The function to get the symbols of `object`.
* @returns {Array} Returns the array of property names and symbols.
*/
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
var result = keysFunc(object);
return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
}
/**
* The base implementation of `getTag` without fallbacks for buggy environments.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
function baseGetTag(value) {
if (value == null) {
return value === undefined ? undefinedTag : nullTag;
}
return (symToStringTag && symToStringTag in Object(value))
? getRawTag(value)
: objectToString(value);
}
/**
* The base implementation of `_.isArguments`.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
*/
function baseIsArguments(value) {
return isObjectLike(value) && baseGetTag(value) == argsTag;
}
/**
* The base implementation of `_.isEqual` which supports partial comparisons
* and tracks traversed objects.
*
* @private
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @param {boolean} bitmask The bitmask flags.
* 1 - Unordered comparison
* 2 - Partial comparison
* @param {Function} [customizer] The function to customize comparisons.
* @param {Object} [stack] Tracks traversed `value` and `other` objects.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
*/
function baseIsEqual(value, other, bitmask, customizer, stack) {
if (value === other) {
return true;
}
if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
return value !== value && other !== other;
}
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
}
/**
* A specialized version of `baseIsEqual` for arrays and objects which performs
* deep comparisons and tracks traversed objects enabling objects with circular
* references to be compared.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
* @param {Function} customizer The function to customize comparisons.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Object} [stack] Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
var objIsArr = isArray(object),
othIsArr = isArray(other),
objTag = objIsArr ? arrayTag : getTag(object),
othTag = othIsArr ? arrayTag : getTag(other);
objTag = objTag == argsTag ? objectTag : objTag;
othTag = othTag == argsTag ? objectTag : othTag;
var objIsObj = objTag == objectTag,
othIsObj = othTag == objectTag,
isSameTag = objTag == othTag;
if (isSameTag && isBuffer(object)) {
if (!isBuffer(other)) {
return false;
}
objIsArr = true;
objIsObj = false;
}
if (isSameTag && !objIsObj) {
stack || (stack = new Stack);
return (objIsArr || isTypedArray(object))
? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
: equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
}
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
if (objIsWrapped || othIsWrapped) {
var objUnwrapped = objIsWrapped ? object.value() : object,
othUnwrapped = othIsWrapped ? other.value() : other;
stack || (stack = new Stack);
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
}
}
if (!isSameTag) {
return false;
}
stack || (stack = new Stack);
return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
}
/**
* The base implementation of `_.isNative` without bad shim checks.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a native function,
* else `false`.
*/
function baseIsNative(value) {
if (!isObject(value) || isMasked(value)) {
return false;
}
var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
return pattern.test(toSource(value));
}
/**
* The base implementation of `_.isTypedArray` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
*/
function baseIsTypedArray(value) {
return isObjectLike(value) &&
isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
}
/**
* The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function baseKeys(object) {
if (!isPrototype(object)) {
return nativeKeys(object);
}
var result = [];
for (var key in Object(object)) {
if (hasOwnProperty.call(object, key) && key != 'constructor') {
result.push(key);
}
}
return result;
}
/**
* A specialized version of `baseIsEqualDeep` for arrays with support for
* partial deep comparisons.
*
* @private
* @param {Array} array The array to compare.
* @param {Array} other The other array to compare.
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
* @param {Function} customizer The function to customize comparisons.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Object} stack Tracks traversed `array` and `other` objects.
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
*/
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
arrLength = array.length,
othLength = other.length;
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
return false;
}
// Assume cyclic values are equal.
var stacked = stack.get(array);
if (stacked && stack.get(other)) {
return stacked == other;
}
var index = -1,
result = true,
seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
stack.set(array, other);
stack.set(other, array);
// Ignore non-index properties.
while (++index < arrLength) {
var arrValue = array[index],
othValue = other[index];
if (customizer) {
var compared = isPartial
? customizer(othValue, arrValue, index, other, array, stack)
: customizer(arrValue, othValue, index, array, other, stack);
}
if (compared !== undefined) {
if (compared) {
continue;
}
result = false;
break;
}
// Recursively compare arrays (susceptible to call stack limits).
if (seen) {
if (!arraySome(other, function(othValue, othIndex) {
if (!cacheHas(seen, othIndex) &&
(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
return seen.push(othIndex);
}
})) {
result = false;
break;
}
} else if (!(
arrValue === othValue ||
equalFunc(arrValue, othValue, bitmask, customizer, stack)
)) {
result = false;
break;
}
}
stack['delete'](array);
stack['delete'](other);
return result;
}
/**
* A specialized version of `baseIsEqualDeep` for comparing objects of
* the same `toStringTag`.
*
* **Note:** This function only supports comparing values with tags of
* `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {string} tag The `toStringTag` of the objects to compare.
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
* @param {Function} customizer The function to customize comparisons.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Object} stack Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
switch (tag) {
case dataViewTag:
if ((object.byteLength != other.byteLength) ||
(object.byteOffset != other.byteOffset)) {
return false;
}
object = object.buffer;
other = other.buffer;
case arrayBufferTag:
if ((object.byteLength != other.byteLength) ||
!equalFunc(new Uint8Array(object), new Uint8Array(other))) {
return false;
}
return true;
case boolTag:
case dateTag:
case numberTag:
// Coerce booleans to `1` or `0` and dates to milliseconds.
// Invalid dates are coerced to `NaN`.
return eq(+object, +other);
case errorTag:
return object.name == other.name && object.message == other.message;
case regexpTag:
case stringTag:
// Coerce regexes to strings and treat strings, primitives and objects,
// as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
// for more details.
return object == (other + '');
case mapTag:
var convert = mapToArray;
case setTag:
var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
convert || (convert = setToArray);
if (object.size != other.size && !isPartial) {
return false;
}
// Assume cyclic values are equal.
var stacked = stack.get(object);
if (stacked) {
return stacked == other;
}
bitmask |= COMPARE_UNORDERED_FLAG;
// Recursively compare objects (susceptible to call stack limits).
stack.set(object, other);
var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
stack['delete'](object);
return result;
case symbolTag:
if (symbolValueOf) {
return symbolValueOf.call(object) == symbolValueOf.call(other);
}
}
return false;
}
/**
* A specialized version of `baseIsEqualDeep` for objects with support for
* partial deep comparisons.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
* @param {Function} customizer The function to customize comparisons.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Object} stack Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
objProps = getAllKeys(object),
objLength = objProps.length,
othProps = getAllKeys(other),
othLength = othProps.length;
if (objLength != othLength && !isPartial) {
return false;
}
var index = objLength;
while (index--) {
var key = objProps[index];
if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
return false;
}
}
// Assume cyclic values are equal.
var stacked = stack.get(object);
if (stacked && stack.get(other)) {
return stacked == other;
}
var result = true;
stack.set(object, other);
stack.set(other, object);
var skipCtor = isPartial;
while (++index < objLength) {
key = objProps[index];
var objValue = object[key],
othValue = other[key];
if (customizer) {
var compared = isPartial
? customizer(othValue, objValue, key, other, object, stack)
: customizer(objValue, othValue, key, object, other, stack);
}
// Recursively compare objects (susceptible to call stack limits).
if (!(compared === undefined
? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
: compared
)) {
result = false;
break;
}
skipCtor || (skipCtor = key == 'constructor');
}
if (result && !skipCtor) {
var objCtor = object.constructor,
othCtor = other.constructor;
// Non `Object` object instances with different constructors are not equal.
if (objCtor != othCtor &&
('constructor' in object && 'constructor' in other) &&
!(typeof objCtor == 'function' && objCtor instanceof objCtor &&
typeof othCtor == 'function' && othCtor instanceof othCtor)) {
result = false;
}
}
stack['delete'](object);
stack['delete'](other);
return result;
}
/**
* Creates an array of own enumerable property names and symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names and symbols.
*/
function getAllKeys(object) {
return baseGetAllKeys(object, keys, getSymbols);
}
/**
* Gets the data for `map`.
*
* @private
* @param {Object} map The map to query.
* @param {string} key The reference key.
* @returns {*} Returns the map data.
*/
function getMapData(map, key) {
var data = map.__data__;
return isKeyable(key)
? data[typeof key == 'string' ? 'string' : 'hash']
: data.map;
}
/**
* Gets the native function at `key` of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {string} key The key of the method to get.
* @returns {*} Returns the function if it's native, else `undefined`.
*/
function getNative(object, key) {
var value = getValue(object, key);
return baseIsNative(value) ? value : undefined;
}
/**
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the raw `toStringTag`.
*/
function getRawTag(value) {
var isOwn = hasOwnProperty.call(value, symToStringTag),
tag = value[symToStringTag];
try {
value[symToStringTag] = undefined;
var unmasked = true;
} catch (e) {}
var result = nativeObjectToString.call(value);
if (unmasked) {
if (isOwn) {
value[symToStringTag] = tag;
} else {
delete value[symToStringTag];
}
}
return result;
}
/**
* Creates an array of the own enumerable symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of symbols.
*/
var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
if (object == null) {
return [];
}
object = Object(object);
return arrayFilter(nativeGetSymbols(object), function(symbol) {
return propertyIsEnumerable.call(object, symbol);
});
};
/**
* Gets the `toStringTag` of `value`.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
var getTag = baseGetTag;
// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
(Map && getTag(new Map) != mapTag) ||
(Promise && getTag(Promise.resolve()) != promiseTag) ||
(Set && getTag(new Set) != setTag) ||
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
getTag = function(value) {
var result = baseGetTag(value),
Ctor = result == objectTag ? value.constructor : undefined,
ctorString = Ctor ? toSource(Ctor) : '';
if (ctorString) {
switch (ctorString) {
case dataViewCtorString: return dataViewTag;
case mapCtorString: return mapTag;
case promiseCtorString: return promiseTag;
case setCtorString: return setTag;
case weakMapCtorString: return weakMapTag;
}
}
return result;
};
}
/**
* Checks if `value` is a valid array-like index.
*
* @private
* @param {*} value The value to check.
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
*/
function isIndex(value, length) {
length = length == null ? MAX_SAFE_INTEGER : length;
return !!length &&
(typeof value == 'number' || reIsUint.test(value)) &&
(value > -1 && value % 1 == 0 && value < length);
}
/**
* Checks if `value` is suitable for use as unique object key.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
*/
function isKeyable(value) {
var type = typeof value;
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
? (value !== '__proto__')
: (value === null);
}
/**
* Checks if `func` has its source masked.
*
* @private
* @param {Function} func The function to check.
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
*/
function isMasked(func) {
return !!maskSrcKey && (maskSrcKey in func);
}
/**
* Checks if `value` is likely a prototype object.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
*/
function isPrototype(value) {
var Ctor = value && value.constructor,
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
return value === proto;
}
/**
* Converts `value` to a string using `Object.prototype.toString`.
*
* @private
* @param {*} value The value to convert.
* @returns {string} Returns the converted string.
*/
function objectToString(value) {
return nativeObjectToString.call(value);
}
/**
* Converts `func` to its source code.
*
* @private
* @param {Function} func The function to convert.
* @returns {string} Returns the source code.
*/
function toSource(func) {
if (func != null) {
try {
return funcToString.call(func);
} catch (e) {}
try {
return (func + '');
} catch (e) {}
}
return '';
}
/**
* Performs a
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* comparison between two values to determine if they are equivalent.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* var object = { 'a': 1 };
* var other = { 'a': 1 };
*
* _.eq(object, object);
* // => true
*
* _.eq(object, other);
* // => false
*
* _.eq('a', 'a');
* // => true
*
* _.eq('a', Object('a'));
* // => false
*
* _.eq(NaN, NaN);
* // => true
*/
function eq(value, other) {
return value === other || (value !== value && other !== other);
}
/**
* Checks if `value` is likely an `arguments` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
* else `false`.
* @example
*
* _.isArguments(function() { return arguments; }());
* // => true
*
* _.isArguments([1, 2, 3]);
* // => false
*/
var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
!propertyIsEnumerable.call(value, 'callee');
};
/**
* Checks if `value` is classified as an `Array` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
* @example
*
* _.isArray([1, 2, 3]);
* // => true
*
* _.isArray(document.body.children);
* // => false
*
* _.isArray('abc');
* // => false
*
* _.isArray(_.noop);
* // => false
*/
var isArray = Array.isArray;
/**
* Checks if `value` is array-like. A value is considered array-like if it's
* not a function and has a `value.length` that's an integer greater than or
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
* @example
*
* _.isArrayLike([1, 2, 3]);
* // => true
*
* _.isArrayLike(document.body.children);
* // => true
*
* _.isArrayLike('abc');
* // => true
*
* _.isArrayLike(_.noop);
* // => false
*/
function isArrayLike(value) {
return value != null && isLength(value.length) && !isFunction(value);
}
/**
* Checks if `value` is a buffer.
*
* @static
* @memberOf _
* @since 4.3.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
* @example
*
* _.isBuffer(new Buffer(2));
* // => true
*
* _.isBuffer(new Uint8Array(2));
* // => false
*/
var isBuffer = nativeIsBuffer || stubFalse;
/**
* Performs a deep comparison between two values to determine if they are
* equivalent.
*
* **Note:** This method supports comparing arrays, array buffers, booleans,
* date objects, error objects, maps, numbers, `Object` objects, regexes,
* sets, strings, symbols, and typed arrays. `Object` objects are compared
* by their own, not inherited, enumerable properties. Functions and DOM
* nodes are compared by strict equality, i.e. `===`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* var object = { 'a': 1 };
* var other = { 'a': 1 };
*
* _.isEqual(object, other);
* // => true
*
* object === other;
* // => false
*/
function isEqual(value, other) {
return baseIsEqual(value, other);
}
/**
* Checks if `value` is classified as a `Function` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
* @example
*
* _.isFunction(_);
* // => true
*
* _.isFunction(/abc/);
* // => false
*/
function isFunction(value) {
if (!isObject(value)) {
return false;
}
// The use of `Object#toString` avoids issues with the `typeof` operator
// in Safari 9 which returns 'object' for typed arrays and other constructors.
var tag = baseGetTag(value);
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
}
/**
* Checks if `value` is a valid array-like length.
*
* **Note:** This method is loosely based on
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
* @example
*
* _.isLength(3);
* // => true
*
* _.isLength(Number.MIN_VALUE);
* // => false
*
* _.isLength(Infinity);
* // => false
*
* _.isLength('3');
* // => false
*/
function isLength(value) {
return typeof value == 'number' &&
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}
/**
* Checks if `value` is the
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(_.noop);
* // => true
*
* _.isObject(null);
* // => false
*/
function isObject(value) {
var type = typeof value;
return value != null && (type == 'object' || type == 'function');
}
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike(value) {
return value != null && typeof value == 'object';
}
/**
* Checks if `value` is classified as a typed array.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
* @example
*
* _.isTypedArray(new Uint8Array);
* // => true
*
* _.isTypedArray([]);
* // => false
*/
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
/**
* Creates an array of the own enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects. See the
* [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
* for more details.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.keys(new Foo);
* // => ['a', 'b'] (iteration order is not guaranteed)
*
* _.keys('hi');
* // => ['0', '1']
*/
function keys(object) {
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
}
/**
* This method returns a new empty array.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {Array} Returns the new empty array.
* @example
*
* var arrays = _.times(2, _.stubArray);
*
* console.log(arrays);
* // => [[], []]
*
* console.log(arrays[0] === arrays[1]);
* // => false
*/
function stubArray() {
return [];
}
/**
* This method returns `false`.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {boolean} Returns `false`.
* @example
*
* _.times(2, _.stubFalse);
* // => [false, false]
*/
function stubFalse() {
return false;
}
module.exports = isEqual;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(21)(module)))
/***/ }),
/* 11 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var editorOptions = ['minLines', 'maxLines', 'readOnly', 'highlightActiveLine', 'tabSize', 'enableBasicAutocompletion', 'enableLiveAutocompletion', 'enableSnippets'];
var editorEvents = ['onChange', 'onFocus', 'onInput', 'onBlur', 'onCopy', 'onPaste', 'onSelectionChange', 'onScroll', 'handleOptions', 'updateRef'];
exports.editorOptions = editorOptions;
exports.editorEvents = editorEvents;
/***/ }),
/* 12 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.split = undefined;
var _ace = __webpack_require__(13);
var _ace2 = _interopRequireDefault(_ace);
var _split = __webpack_require__(22);
var _split2 = _interopRequireDefault(_split);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.split = _split2.default;
exports.default = _ace2.default;
/***/ }),
/* 13 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _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 _brace = __webpack_require__(4);
var _brace2 = _interopRequireDefault(_brace);
var _react = __webpack_require__(6);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(8);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _lodash = __webpack_require__(10);
var _lodash2 = _interopRequireDefault(_lodash);
var _editorOptions = __webpack_require__(11);
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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _ace$acequire = _brace2.default.acequire('ace/range'),
Range = _ace$acequire.Range;
var ReactAce = function (_Component) {
_inherits(ReactAce, _Component);
function ReactAce(props) {
_classCallCheck(this, ReactAce);
var _this = _possibleConstructorReturn(this, (ReactAce.__proto__ || Object.getPrototypeOf(ReactAce)).call(this, props));
_editorOptions.editorEvents.forEach(function (method) {
_this[method] = _this[method].bind(_this);
});
return _this;
}
_createClass(ReactAce, [{
key: 'componentDidMount',
value: function componentDidMount() {
var _this2 = this;
var _props = this.props,
className = _props.className,
onBeforeLoad = _props.onBeforeLoad,
onValidate = _props.onValidate,
mode = _props.mode,
focus = _props.focus,
theme = _props.theme,
fontSize = _props.fontSize,
value = _props.value,
defaultValue = _props.defaultValue,
cursorStart = _props.cursorStart,
showGutter = _props.showGutter,
wrapEnabled = _props.wrapEnabled,
showPrintMargin = _props.showPrintMargin,
_props$scrollMargin = _props.scrollMargin,
scrollMargin = _props$scrollMargin === undefined ? [0, 0, 0, 0] : _props$scrollMargin,
keyboardHandler = _props.keyboardHandler,
onLoad = _props.onLoad,
commands = _props.commands,
annotations = _props.annotations,
markers = _props.markers;
this.editor = _brace2.default.edit(this.refEditor);
if (onBeforeLoad) {
onBeforeLoad(_brace2.default);
}
var editorProps = Object.keys(this.props.editorProps);
for (var i = 0; i < editorProps.length; i++) {
this.editor[editorProps[i]] = this.props.editorProps[editorProps[i]];
}
this.editor.renderer.setScrollMargin(scrollMargin[0], scrollMargin[1], scrollMargin[2], scrollMargin[3]);
this.editor.getSession().setMode('ace/mode/' + mode);
this.editor.setTheme('ace/theme/' + theme);
this.editor.setFontSize(fontSize);
this.editor.setValue(defaultValue === undefined ? value : defaultValue, cursorStart);
this.editor.renderer.setShowGutter(showGutter);
this.editor.getSession().setUseWrapMode(wrapEnabled);
this.editor.setShowPrintMargin(showPrintMargin);
this.editor.on('focus', this.onFocus);
this.editor.on('blur', this.onBlur);
this.editor.on('copy', this.onCopy);
this.editor.on('paste', this.onPaste);
this.editor.on('change', this.onChange);
this.editor.on('input', this.onInput);
this.editor.getSession().selection.on('changeSelection', this.onSelectionChange);
if (onValidate) {
this.editor.getSession().on('changeAnnotation', function () {
var annotations = _this2.editor.getSession().getAnnotations();
_this2.props.onValidate(annotations);
});
}
this.editor.session.on('changeScrollTop', this.onScroll);
this.editor.getSession().setAnnotations(annotations || []);
if (markers && markers.length > 0) {
this.handleMarkers(markers);
}
// get a list of possible options to avoid 'misspelled option errors'
var availableOptions = this.editor.$options;
for (var _i = 0; _i < _editorOptions.editorOptions.length; _i++) {
var option = _editorOptions.editorOptions[_i];
if (availableOptions.hasOwnProperty(option)) {
this.editor.setOption(option, this.props[option]);
} else if (this.props[option]) {
console.warn('ReaceAce: editor option ' + option + ' was activated but not found. Did you need to import a related tool or did you possibly mispell the option?');
}
}
this.handleOptions(this.props);
if (Array.isArray(commands)) {
commands.forEach(function (command) {
if (typeof command.exec == 'string') {
_this2.editor.commands.bindKey(command.bindKey, command.exec);
} else {
_this2.editor.commands.addCommand(command);
}
});
}
if (keyboardHandler) {
this.editor.setKeyboardHandler('ace/keyboard/' + keyboardHandler);
}
if (className) {
this.refEditor.className += ' ' + className;
}
if (focus) {
this.editor.focus();
}
if (onLoad) {
onLoad(this.editor);
}
this.editor.resize();
}
}, {
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
var oldProps = this.props;
for (var i = 0; i < _editorOptions.editorOptions.length; i++) {
var option = _editorOptions.editorOptions[i];
if (nextProps[option] !== oldProps[option]) {
this.editor.setOption(option, nextProps[option]);
}
}
if (nextProps.className !== oldProps.className) {
var appliedClasses = this.refEditor.className;
var appliedClassesArray = appliedClasses.trim().split(' ');
var oldClassesArray = oldProps.className.trim().split(' ');
oldClassesArray.forEach(function (oldClass) {
var index = appliedClassesArray.indexOf(oldClass);
appliedClassesArray.splice(index, 1);
});
this.refEditor.className = ' ' + nextProps.className + ' ' + appliedClassesArray.join(' ');
}
if (nextProps.mode !== oldProps.mode) {
this.editor.getSession().setMode('ace/mode/' + nextProps.mode);
}
if (nextProps.theme !== oldProps.theme) {
this.editor.setTheme('ace/theme/' + nextProps.theme);
}
if (nextProps.keyboardHandler !== oldProps.keyboardHandler) {
if (nextProps.keyboardHandler) {
this.editor.setKeyboardHandler('ace/keyboard/' + nextProps.keyboardHandler);
} else {
this.editor.setKeyboardHandler(null);
}
}
if (nextProps.fontSize !== oldProps.fontSize) {
this.editor.setFontSize(nextProps.fontSize);
}
if (nextProps.wrapEnabled !== oldProps.wrapEnabled) {
this.editor.getSession().setUseWrapMode(nextProps.wrapEnabled);
}
if (nextProps.showPrintMargin !== oldProps.showPrintMargin) {
this.editor.setShowPrintMargin(nextProps.showPrintMargin);
}
if (nextProps.showGutter !== oldProps.showGutter) {
this.editor.renderer.setShowGutter(nextProps.showGutter);
}
if (!(0, _lodash2.default)(nextProps.setOptions, oldProps.setOptions)) {
this.handleOptions(nextProps);
}
if (!(0, _lodash2.default)(nextProps.annotations, oldProps.annotations)) {
this.editor.getSession().setAnnotations(nextProps.annotations || []);
}
if (!(0, _lodash2.default)(nextProps.markers, oldProps.markers) && Array.isArray(nextProps.markers)) {
this.handleMarkers(nextProps.markers);
}
// this doesn't look like it works at all....
if (!(0, _lodash2.default)(nextProps.scrollMargin, oldProps.scrollMargin)) {
this.handleScrollMargins(nextProps.scrollMargin);
}
if (this.editor && this.editor.getValue() !== nextProps.value) {
// editor.setValue is a synchronous function call, change event is emitted before setValue return.
this.silent = true;
var pos = this.editor.session.selection.toJSON();
this.editor.setValue(nextProps.value, nextProps.cursorStart);
this.editor.session.selection.fromJSON(pos);
this.silent = false;
}
if (nextProps.focus && !oldProps.focus) {
this.editor.focus();
}
}
}, {
key: 'componentDidUpdate',
value: function componentDidUpdate(prevProps) {
if (prevProps.height !== this.props.height || prevProps.width !== this.props.width) {
this.editor.resize();
}
}
}, {
key: 'handleScrollMargins',
value: function handleScrollMargins() {
var margins = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [0, 0, 0, 0];
this.editor.renderer.setScrollMargins(margins[0], margins[1], margins[2], margins[3]);
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
this.editor.destroy();
this.editor = null;
}
}, {
key: 'onChange',
value: function onChange(event) {
if (this.props.onChange && !this.silent) {
var value = this.editor.getValue();
this.props.onChange(value, event);
}
}
}, {
key: 'onSelectionChange',
value: function onSelectionChange(event) {
if (this.props.onSelectionChange) {
var value = this.editor.getSelection();
this.props.onSelectionChange(value, event);
}
}
}, {
key: 'onInput',
value: function onInput(event) {
if (this.props.onInput) {
this.props.onInput(event);
}
}
}, {
key: 'onFocus',
value: function onFocus(event) {
if (this.props.onFocus) {
this.props.onFocus(event);
}
}
}, {
key: 'onBlur',
value: function onBlur(event) {
if (this.props.onBlur) {
this.props.onBlur(event);
}
}
}, {
key: 'onCopy',
value: function onCopy(text) {
if (this.props.onCopy) {
this.props.onCopy(text);
}
}
}, {
key: 'onPaste',
value: function onPaste(text) {
if (this.props.onPaste) {
this.props.onPaste(text);
}
}
}, {
key: 'onScroll',
value: function onScroll() {
if (this.props.onScroll) {
this.props.onScroll(this.editor);
}
}
}, {
key: 'handleOptions',
value: function handleOptions(props) {
var setOptions = Object.keys(props.setOptions);
for (var y = 0; y < setOptions.length; y++) {
this.editor.setOption(setOptions[y], props.setOptions[setOptions[y]]);
}
}
}, {
key: 'handleMarkers',
value: function handleMarkers(markers) {
var _this3 = this;
// remove foreground markers
var currentMarkers = this.editor.getSession().getMarkers(true);
for (var i in currentMarkers) {
if (currentMarkers.hasOwnProperty(i)) {
this.editor.getSession().removeMarker(currentMarkers[i].id);
}
}
// remove background markers
currentMarkers = this.editor.getSession().getMarkers(false);
for (var _i2 in currentMarkers) {
if (currentMarkers.hasOwnProperty(_i2)) {
this.editor.getSession().removeMarker(currentMarkers[_i2].id);
}
}
// add new markers
markers.forEach(function (_ref) {
var startRow = _ref.startRow,
startCol = _ref.startCol,
endRow = _ref.endRow,
endCol = _ref.endCol,
className = _ref.className,
type = _ref.type,
_ref$inFront = _ref.inFront,
inFront = _ref$inFront === undefined ? false : _ref$inFront;
var range = new Range(startRow, startCol, endRow, endCol);
_this3.editor.getSession().addMarker(range, className, type, inFront);
});
}
}, {
key: 'updateRef',
value: function updateRef(item) {
this.refEditor = item;
}
}, {
key: 'render',
value: function render() {
var _props2 = this.props,
name = _props2.name,
width = _props2.width,
height = _props2.height,
style = _props2.style;
var divStyle = _extends({ width: width, height: height }, style);
return _react2.default.createElement('div', { ref: this.updateRef,
id: name,
style: divStyle
});
}
}]);
return ReactAce;
}(_react.Component);
exports.default = ReactAce;
ReactAce.propTypes = {
mode: _propTypes2.default.string,
focus: _propTypes2.default.bool,
theme: _propTypes2.default.string,
name: _propTypes2.default.string,
className: _propTypes2.default.string,
height: _propTypes2.default.string,
width: _propTypes2.default.string,
fontSize: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string]),
showGutter: _propTypes2.default.bool,
onChange: _propTypes2.default.func,
onCopy: _propTypes2.default.func,
onPaste: _propTypes2.default.func,
onFocus: _propTypes2.default.func,
onInput: _propTypes2.default.func,
onBlur: _propTypes2.default.func,
onScroll: _propTypes2.default.func,
value: _propTypes2.default.string,
defaultValue: _propTypes2.default.string,
onLoad: _propTypes2.default.func,
onSelectionChange: _propTypes2.default.func,
onBeforeLoad: _propTypes2.default.func,
onValidate: _propTypes2.default.func,
minLines: _propTypes2.default.number,
maxLines: _propTypes2.default.number,
readOnly: _propTypes2.default.bool,
highlightActiveLine: _propTypes2.default.bool,
tabSize: _propTypes2.default.number,
showPrintMargin: _propTypes2.default.bool,
cursorStart: _propTypes2.default.number,
editorProps: _propTypes2.default.object,
setOptions: _propTypes2.default.object,
style: _propTypes2.default.object,
scrollMargin: _propTypes2.default.array,
annotations: _propTypes2.default.array,
markers: _propTypes2.default.array,
keyboardHandler: _propTypes2.default.string,
wrapEnabled: _propTypes2.default.bool,
enableBasicAutocompletion: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.array]),
enableLiveAutocompletion: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.array]),
commands: _propTypes2.default.array
};
ReactAce.defaultProps = {
name: 'brace-editor',
focus: false,
mode: '',
theme: '',
height: '500px',
width: '500px',
value: '',
fontSize: 12,
showGutter: true,
onChange: null,
onPaste: null,
onLoad: null,
onScroll: null,
minLines: null,
maxLines: null,
readOnly: false,
highlightActiveLine: true,
showPrintMargin: true,
tabSize: 4,
cursorStart: 1,
editorProps: {},
style: {},
scrollMargin: [0, 0, 0, 0],
setOptions: {},
wrapEnabled: false,
enableBasicAutocompletion: false,
enableLiveAutocompletion: false
};
/***/ }),
/* 14 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global) {module.exports = get_blob()
function get_blob() {
if(global.Blob) {
try {
new Blob(['asdf'], {type: 'text/plain'})
return Blob
} catch(err) {}
}
var Builder = global.WebKitBlobBuilder ||
global.MozBlobBuilder ||
global.MSBlobBuilder
return function(parts, bag) {
var builder = new Builder
, endings = bag.endings
, type = bag.type
if(endings) for(var i = 0, len = parts.length; i < len; ++i) {
builder.append(parts[i], endings)
} else for(var i = 0, len = parts.length; i < len; ++i) {
builder.append(parts[i])
}
return type ? builder.getBlob(type) : builder.getBlob()
}
}
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
/***/ }),
/* 15 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/** @license React v16.0.0
* react.development.js
*
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
if (true) {
(function() {
'use strict';
var objectAssign$1 = __webpack_require__(7);
var require$$0 = __webpack_require__(0);
var emptyObject = __webpack_require__(16);
var invariant = __webpack_require__(1);
var emptyFunction = __webpack_require__(3);
var checkPropTypes = __webpack_require__(17);
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @providesModule reactProdInvariant
*
*/
{
var warning = require$$0;
}
function warnNoop(publicInstance, callerName) {
{
var constructor = publicInstance.constructor;
warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op.\n\nPlease check the code for the %s component.', callerName, callerName, constructor && (constructor.displayName || constructor.name) || 'ReactClass');
}
}
/**
* This is the abstract API for an update queue.
*/
var ReactNoopUpdateQueue = {
/**
* Checks whether or not this composite component is mounted.
* @param {ReactClass} publicInstance The instance we want to test.
* @return {boolean} True if mounted, false otherwise.
* @protected
* @final
*/
isMounted: function (publicInstance) {
return false;
},
/**
* Forces an update. This should only be invoked when it is known with
* certainty that we are **not** in a DOM transaction.
*
* You may want to call this when you know that some deeper aspect of the
* component's state has changed but `setState` was not called.
*
* This will not invoke `shouldComponentUpdate`, but it will invoke
* `componentWillUpdate` and `componentDidUpdate`.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {?function} callback Called after component is updated.
* @param {?string} callerName name of the calling function in the public API.
* @internal
*/
enqueueForceUpdate: function (publicInstance, callback, callerName) {
warnNoop(publicInstance, 'forceUpdate');
},
/**
* Replaces all of the state. Always use this or `setState` to mutate state.
* You should treat `this.state` as immutable.
*
* There is no guarantee that `this.state` will be immediately updated, so
* accessing `this.state` after calling this method may return the old value.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object} completeState Next state.
* @param {?function} callback Called after component is updated.
* @param {?string} callerName name of the calling function in the public API.
* @internal
*/
enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
warnNoop(publicInstance, 'replaceState');
},
/**
* Sets a subset of the state. This only exists because _pendingState is
* internal. This provides a merging strategy that is not available to deep
* properties which is confusing. TODO: Expose pendingState or don't use it
* during the merge.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object} partialState Next partial state to be merged with state.
* @param {?function} callback Called after component is updated.
* @param {?string} Name of the calling function in the public API.
* @internal
*/
enqueueSetState: function (publicInstance, partialState, callback, callerName) {
warnNoop(publicInstance, 'setState');
}
};
var ReactNoopUpdateQueue_1 = ReactNoopUpdateQueue;
/**
* Copyright (c) 2014-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @providesModule lowPriorityWarning
*/
/**
* Forked from fbjs/warning:
* https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
*
* Only change is we use console.warn instead of console.error,
* and do nothing when 'console' is not supported.
* This really simplifies the code.
* ---
* Similar to invariant but only logs a warning if the condition is not met.
* This can be used to log issues in development environments in critical
* paths. Removing the logging code for production environments will keep the
* same logic and follow the same code paths.
*/
var lowPriorityWarning = function () {};
{
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;
var message = 'Warning: ' + format.replace(/%s/g, function () {
return args[argIndex++];
});
if (typeof console !== 'undefined') {
console.warn(message);
}
try {
// --- Welcome to debugging React ---
// This error was thrown as a convenience so that you can use this stack
// to find the callsite that caused this warning to fire.
throw new Error(message);
} catch (x) {}
};
lowPriorityWarning = function (condition, format) {
if (format === undefined) {
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
}
if (!condition) {
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
args[_key2 - 2] = arguments[_key2];
}
printWarning.apply(undefined, [format].concat(args));
}
};
}
var lowPriorityWarning_1 = lowPriorityWarning;
/**
* Base class helpers for the updating state of a component.
*/
function ReactComponent(props, context, updater) {
this.props = props;
this.context = context;
this.refs = emptyObject;
// We initialize the default updater but the real one gets injected by the
// renderer.
this.updater = updater || ReactNoopUpdateQueue_1;
}
ReactComponent.prototype.isReactComponent = {};
/**
* Sets a subset of the state. Always use this to mutate
* state. You should treat `this.state` as immutable.
*
* There is no guarantee that `this.state` will be immediately updated, so
* accessing `this.state` after calling this method may return the old value.
*
* There is no guarantee that calls to `setState` will run synchronously,
* as they may eventually be batched together. You can provide an optional
* callback that will be executed when the call to setState is actually
* completed.
*
* When a function is provided to setState, it will be called at some point in
* the future (not synchronously). It will be called with the up to date
* component arguments (state, props, context). These values can be different
* from this.* because your function may be called after receiveProps but before
* shouldComponentUpdate, and this new state, props, and context will not yet be
* assigned to this.
*
* @param {object|function} partialState Next partial state or function to
* produce next partial state to be merged with current state.
* @param {?function} callback Called after state is updated.
* @final
* @protected
*/
ReactComponent.prototype.setState = function (partialState, callback) {
!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? invariant(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : void 0;
this.updater.enqueueSetState(this, partialState, callback, 'setState');
};
/**
* Forces an update. This should only be invoked when it is known with
* certainty that we are **not** in a DOM transaction.
*
* You may want to call this when you know that some deeper aspect of the
* component's state has changed but `setState` was not called.
*
* This will not invoke `shouldComponentUpdate`, but it will invoke
* `componentWillUpdate` and `componentDidUpdate`.
*
* @param {?function} callback Called after update is complete.
* @final
* @protected
*/
ReactComponent.prototype.forceUpdate = function (callback) {
this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
};
/**
* Deprecated APIs. These APIs used to exist on classic React classes but since
* we would like to deprecate them, we're not going to move them over to this
* modern base class. Instead, we define a getter that warns if it's accessed.
*/
{
var deprecatedAPIs = {
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
};
var defineDeprecationWarning = function (methodName, info) {
Object.defineProperty(ReactComponent.prototype, methodName, {
get: function () {
lowPriorityWarning_1(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
return undefined;
}
});
};
for (var fnName in deprecatedAPIs) {
if (deprecatedAPIs.hasOwnProperty(fnName)) {
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
}
}
}
/**
* Base class helpers for the updating state of a component.
*/
function ReactPureComponent(props, context, updater) {
// Duplicated from ReactComponent.
this.props = props;
this.context = context;
this.refs = emptyObject;
// We initialize the default updater but the real one gets injected by the
// renderer.
this.updater = updater || ReactNoopUpdateQueue_1;
}
function ComponentDummy() {}
ComponentDummy.prototype = ReactComponent.prototype;
var pureComponentPrototype = ReactPureComponent.prototype = new ComponentDummy();
pureComponentPrototype.constructor = ReactPureComponent;
// Avoid an extra prototype jump for these methods.
objectAssign$1(pureComponentPrototype, ReactComponent.prototype);
pureComponentPrototype.isPureReactComponent = true;
function ReactAsyncComponent(props, context, updater) {
// Duplicated from ReactComponent.
this.props = props;
this.context = context;
this.refs = emptyObject;
// We initialize the default updater but the real one gets injected by the
// renderer.
this.updater = updater || ReactNoopUpdateQueue_1;
}
var asyncComponentPrototype = ReactAsyncComponent.prototype = new ComponentDummy();
asyncComponentPrototype.constructor = ReactAsyncComponent;
// Avoid an extra prototype jump for these methods.
objectAssign$1(asyncComponentPrototype, ReactComponent.prototype);
asyncComponentPrototype.unstable_isAsyncReactComponent = true;
asyncComponentPrototype.render = function () {
return this.props.children;
};
var ReactBaseClasses = {
Component: ReactComponent,
PureComponent: ReactPureComponent,
AsyncComponent: ReactAsyncComponent
};
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @providesModule ReactCurrentOwner
*
*/
/**
* Keeps track of the current owner.
*
* The current owner is the component who should own any components that are
* currently being constructed.
*/
var ReactCurrentOwner = {
/**
* @internal
* @type {ReactComponent}
*/
current: null
};
var ReactCurrentOwner_1 = ReactCurrentOwner;
var hasOwnProperty = Object.prototype.hasOwnProperty;
{
var warning$2 = require$$0;
}
// The Symbol used to tag the ReactElement type. If there is no native Symbol
// nor polyfill, then a plain number is used for performance.
var REACT_ELEMENT_TYPE$1 = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
var RESERVED_PROPS = {
key: true,
ref: true,
__self: true,
__source: true
};
var specialPropKeyWarningShown;
var specialPropRefWarningShown;
function hasValidRef(config) {
{
if (hasOwnProperty.call(config, 'ref')) {
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
if (getter && getter.isReactWarning) {
return false;
}
}
}
return config.ref !== undefined;
}
function hasValidKey(config) {
{
if (hasOwnProperty.call(config, 'key')) {
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
if (getter && getter.isReactWarning) {
return false;
}
}
}
return config.key !== undefined;
}
function defineKeyPropWarningGetter(props, displayName) {
var warnAboutAccessingKey = function () {
if (!specialPropKeyWarningShown) {
specialPropKeyWarningShown = true;
warning$2(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
}
};
warnAboutAccessingKey.isReactWarning = true;
Object.defineProperty(props, 'key', {
get: warnAboutAccessingKey,
configurable: true
});
}
function defineRefPropWarningGetter(props, displayName) {
var warnAboutAccessingRef = function () {
if (!specialPropRefWarningShown) {
specialPropRefWarningShown = true;
warning$2(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
}
};
warnAboutAccessingRef.isReactWarning = true;
Object.defineProperty(props, 'ref', {
get: warnAboutAccessingRef,
configurable: true
});
}
/**
* Factory method to create a new React element. This no longer adheres to
* the class pattern, so do not use new to call it. Also, no instanceof check
* will work. Instead test $$typeof field against Symbol.for('react.element') to check
* if something is a React Element.
*
* @param {*} type
* @param {*} key
* @param {string|object} ref
* @param {*} self A *temporary* helper to detect places where `this` is
* different from the `owner` when React.createElement is called, so that we
* can warn. We want to get rid of owner and replace string `ref`s with arrow
* functions, and as long as `this` and owner are the same, there will be no
* change in behavior.
* @param {*} source An annotation object (added by a transpiler or otherwise)
* indicating filename, line number, and/or other information.
* @param {*} owner
* @param {*} props
* @internal
*/
var ReactElement = function (type, key, ref, self, source, owner, props) {
var element = {
// This tag allow us to uniquely identify this as a React Element
$$typeof: REACT_ELEMENT_TYPE$1,
// Built-in properties that belong on the element
type: type,
key: key,
ref: ref,
props: props,
// Record the component responsible for creating this element.
_owner: owner
};
{
// The validation flag is currently mutative. We put it on
// an external backing store so that we can freeze the whole object.
// This can be replaced with a WeakMap once they are implemented in
// commonly used development environments.
element._store = {};
// To make comparing ReactElements easier for testing purposes, we make
// the validation flag non-enumerable (where possible, which should
// include every environment we run tests in), so the test framework
// ignores it.
Object.defineProperty(element._store, 'validated', {
configurable: false,
enumerable: false,
writable: true,
value: false
});
// self and source are DEV only properties.
Object.defineProperty(element, '_self', {
configurable: false,
enumerable: false,
writable: false,
value: self
});
// Two elements created in two different places should be considered
// equal for testing purposes and therefore we hide it from enumeration.
Object.defineProperty(element, '_source', {
configurable: false,
enumerable: false,
writable: false,
value: source
});
if (Object.freeze) {
Object.freeze(element.props);
Object.freeze(element);
}
}
return element;
};
/**
* Create and return a new ReactElement of the given type.
* See https://facebook.github.io/react/docs/react-api.html#createelement
*/
ReactElement.createElement = function (type, config, children) {
var propName;
// Reserved names are extracted
var props = {};
var key = null;
var ref = null;
var self = null;
var source = null;
if (config != null) {
if (hasValidRef(config)) {
ref = config.ref;
}
if (hasValidKey(config)) {
key = '' + config.key;
}
self = config.__self === undefined ? null : config.__self;
source = config.__source === undefined ? null : config.__source;
// Remaining properties are added to a new props object
for (propName in config) {
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
props[propName] = config[propName];
}
}
}
// Children can be more than one argument, and those are transferred onto
// the newly allocated props object.
var childrenLength = arguments.length - 2;
if (childrenLength === 1) {
props.children = children;
} else if (childrenLength > 1) {
var childArray = Array(childrenLength);
for (var i = 0; i < childrenLength; i++) {
childArray[i] = arguments[i + 2];
}
{
if (Object.freeze) {
Object.freeze(childArray);
}
}
props.children = childArray;
}
// Resolve default props
if (type && type.defaultProps) {
var defaultProps = type.defaultProps;
for (propName in defaultProps) {
if (props[propName] === undefined) {
props[propName] = defaultProps[propName];
}
}
}
{
if (key || ref) {
if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE$1) {
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
if (key) {
defineKeyPropWarningGetter(props, displayName);
}
if (ref) {
defineRefPropWarningGetter(props, displayName);
}
}
}
}
return ReactElement(type, key, ref, self, source, ReactCurrentOwner_1.current, props);
};
/**
* Return a function that produces ReactElements of a given type.
* See https://facebook.github.io/react/docs/react-api.html#createfactory
*/
ReactElement.createFactory = function (type) {
var factory = ReactElement.createElement.bind(null, type);
// Expose the type on the factory and the prototype so that it can be
// easily accessed on elements. E.g. `<Foo />.type === Foo`.
// This should not be named `constructor` since this may not be the function
// that created the element, and it may not even be a constructor.
// Legacy hook TODO: Warn if this is accessed
factory.type = type;
return factory;
};
ReactElement.cloneAndReplaceKey = function (oldElement, newKey) {
var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
return newElement;
};
/**
* Clone and return a new ReactElement using element as the starting point.
* See https://facebook.github.io/react/docs/react-api.html#cloneelement
*/
ReactElement.cloneElement = function (element, config, children) {
var propName;
// Original props are copied
var props = objectAssign$1({}, element.props);
// Reserved names are extracted
var key = element.key;
var ref = element.ref;
// Self is preserved since the owner is preserved.
var self = element._self;
// Source is preserved since cloneElement is unlikely to be targeted by a
// transpiler, and the original source is probably a better indicator of the
// true owner.
var source = element._source;
// Owner will be preserved, unless ref is overridden
var owner = element._owner;
if (config != null) {
if (hasValidRef(config)) {
// Silently steal the ref from the parent.
ref = config.ref;
owner = ReactCurrentOwner_1.current;
}
if (hasValidKey(config)) {
key = '' + config.key;
}
// Remaining properties override existing props
var defaultProps;
if (element.type && element.type.defaultProps) {
defaultProps = element.type.defaultProps;
}
for (propName in config) {
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
if (config[propName] === undefined && defaultProps !== undefined) {
// Resolve default props
props[propName] = defaultProps[propName];
} else {
props[propName] = config[propName];
}
}
}
}
// Children can be more than one argument, and those are transferred onto
// the newly allocated props object.
var childrenLength = arguments.length - 2;
if (childrenLength === 1) {
props.children = children;
} else if (childrenLength > 1) {
var childArray = Array(childrenLength);
for (var i = 0; i < childrenLength; i++) {
childArray[i] = arguments[i + 2];
}
props.children = childArray;
}
return ReactElement(element.type, key, ref, self, source, owner, props);
};
/**
* Verifies the object is a ReactElement.
* See https://facebook.github.io/react/docs/react-api.html#isvalidelement
* @param {?object} object
* @return {boolean} True if `object` is a valid component.
* @final
*/
ReactElement.isValidElement = function (object) {
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE$1;
};
var ReactElement_1 = ReactElement;
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @providesModule ReactDebugCurrentFrame
*
*/
var ReactDebugCurrentFrame = {};
{
// Component that is being worked on
ReactDebugCurrentFrame.getCurrentStack = null;
ReactDebugCurrentFrame.getStackAddendum = function () {
var impl = ReactDebugCurrentFrame.getCurrentStack;
if (impl) {
return impl();
}
return null;
};
}
var ReactDebugCurrentFrame_1 = ReactDebugCurrentFrame;
{
var warning$1 = require$$0;
var _require = ReactDebugCurrentFrame_1,
getStackAddendum = _require.getStackAddendum;
}
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
// The Symbol used to tag the ReactElement type. If there is no native Symbol
// nor polyfill, then a plain number is used for performance.
var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
var SEPARATOR = '.';
var SUBSEPARATOR = ':';
/**
* Escape and wrap key so it is safe to use as a reactid
*
* @param {string} key to be escaped.
* @return {string} the escaped key.
*/
function escape(key) {
var escapeRegex = /[=:]/g;
var escaperLookup = {
'=': '=0',
':': '=2'
};
var escapedString = ('' + key).replace(escapeRegex, function (match) {
return escaperLookup[match];
});
return '$' + escapedString;
}
/**
* TODO: Test that a single child and an array with one item have the same key
* pattern.
*/
var didWarnAboutMaps = false;
var userProvidedKeyEscapeRegex = /\/+/g;
function escapeUserProvidedKey(text) {
return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
}
var POOL_SIZE = 10;
var traverseContextPool = [];
function getPooledTraverseContext(mapResult, keyPrefix, mapFunction, mapContext) {
if (traverseContextPool.length) {
var traverseContext = traverseContextPool.pop();
traverseContext.result = mapResult;
traverseContext.keyPrefix = keyPrefix;
traverseContext.func = mapFunction;
traverseContext.context = mapContext;
traverseContext.count = 0;
return traverseContext;
} else {
return {
result: mapResult,
keyPrefix: keyPrefix,
func: mapFunction,
context: mapContext,
count: 0
};
}
}
function releaseTraverseContext(traverseContext) {
traverseContext.result = null;
traverseContext.keyPrefix = null;
traverseContext.func = null;
traverseContext.context = null;
traverseContext.count = 0;
if (traverseContextPool.length < POOL_SIZE) {
traverseContextPool.push(traverseContext);
}
}
/**
* @param {?*} children Children tree container.
* @param {!string} nameSoFar Name of the key path so far.
* @param {!function} callback Callback to invoke with each child found.
* @param {?*} traverseContext Used to pass information throughout the traversal
* process.
* @return {!number} The number of children in this subtree.
*/
function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
var type = typeof children;
if (type === 'undefined' || type === 'boolean') {
// All of the above are perceived as null.
children = null;
}
if (children === null || type === 'string' || type === 'number' ||
// The following is inlined from ReactElement. This means we can optimize
// some checks. React Fiber also inlines this logic for similar purposes.
type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) {
callback(traverseContext, children,
// If it's the only child, treat the name as if it was wrapped in an array
// so that it's consistent if the number of children grows.
nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
return 1;
}
var child;
var nextName;
var subtreeCount = 0; // Count of children found in the current subtree.
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
if (Array.isArray(children)) {
for (var i = 0; i < children.length; i++) {
child = children[i];
nextName = nextNamePrefix + getComponentKey(child, i);
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
}
} else {
var iteratorFn = ITERATOR_SYMBOL && children[ITERATOR_SYMBOL] || children[FAUX_ITERATOR_SYMBOL];
if (typeof iteratorFn === 'function') {
{
// Warn about using Maps as children
if (iteratorFn === children.entries) {
warning$1(didWarnAboutMaps, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.%s', getStackAddendum());
didWarnAboutMaps = true;
}
}
var iterator = iteratorFn.call(children);
var step;
var ii = 0;
while (!(step = iterator.next()).done) {
child = step.value;
nextName = nextNamePrefix + getComponentKey(child, ii++);
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
}
} else if (type === 'object') {
var addendum = '';
{
addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + getStackAddendum();
}
var childrenString = '' + children;
invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum);
}
}
return subtreeCount;
}
/**
* Traverses children that are typically specified as `props.children`, but
* might also be specified through attributes:
*
* - `traverseAllChildren(this.props.children, ...)`
* - `traverseAllChildren(this.props.leftPanelChildren, ...)`
*
* The `traverseContext` is an optional argument that is passed through the
* entire traversal. It can be used to store accumulations or anything else that
* the callback might find relevant.
*
* @param {?*} children Children tree object.
* @param {!function} callback To invoke upon traversing each child.
* @param {?*} traverseContext Context for traversal.
* @return {!number} The number of children in this subtree.
*/
function traverseAllChildren(children, callback, traverseContext) {
if (children == null) {
return 0;
}
return traverseAllChildrenImpl(children, '', callback, traverseContext);
}
/**
* Generate a key string that identifies a component within a set.
*
* @param {*} component A component that could contain a manual key.
* @param {number} index Index that is used if a manual key is not provided.
* @return {string}
*/
function getComponentKey(component, index) {
// Do some typechecking here since we call this blindly. We want to ensure
// that we don't block potential future ES APIs.
if (typeof component === 'object' && component !== null && component.key != null) {
// Explicit key
return escape(component.key);
}
// Implicit key determined by the index in the set
return index.toString(36);
}
function forEachSingleChild(bookKeeping, child, name) {
var func = bookKeeping.func,
context = bookKeeping.context;
func.call(context, child, bookKeeping.count++);
}
/**
* Iterates through children that are typically specified as `props.children`.
*
* See https://facebook.github.io/react/docs/react-api.html#react.children.foreach
*
* The provided forEachFunc(child, index) will be called for each
* leaf child.
*
* @param {?*} children Children tree container.
* @param {function(*, int)} forEachFunc
* @param {*} forEachContext Context for forEachContext.
*/
function forEachChildren(children, forEachFunc, forEachContext) {
if (children == null) {
return children;
}
var traverseContext = getPooledTraverseContext(null, null, forEachFunc, forEachContext);
traverseAllChildren(children, forEachSingleChild, traverseContext);
releaseTraverseContext(traverseContext);
}
function mapSingleChildIntoContext(bookKeeping, child, childKey) {
var result = bookKeeping.result,
keyPrefix = bookKeeping.keyPrefix,
func = bookKeeping.func,
context = bookKeeping.context;
var mappedChild = func.call(context, child, bookKeeping.count++);
if (Array.isArray(mappedChild)) {
mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
} else if (mappedChild != null) {
if (ReactElement_1.isValidElement(mappedChild)) {
mappedChild = ReactElement_1.cloneAndReplaceKey(mappedChild,
// Keep both the (mapped) and old keys if they differ, just as
// traverseAllChildren used to do for objects as children
keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
}
result.push(mappedChild);
}
}
function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
var escapedPrefix = '';
if (prefix != null) {
escapedPrefix = escapeUserProvidedKey(prefix) + '/';
}
var traverseContext = getPooledTraverseContext(array, escapedPrefix, func, context);
traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
releaseTraverseContext(traverseContext);
}
/**
* Maps children that are typically specified as `props.children`.
*
* See https://facebook.github.io/react/docs/react-api.html#react.children.map
*
* The provided mapFunction(child, key, index) will be called for each
* leaf child.
*
* @param {?*} children Children tree container.
* @param {function(*, int)} func The map function.
* @param {*} context Context for mapFunction.
* @return {object} Object containing the ordered map of results.
*/
function mapChildren(children, func, context) {
if (children == null) {
return children;
}
var result = [];
mapIntoWithKeyPrefixInternal(children, result, null, func, context);
return result;
}
/**
* Count the number of children that are typically specified as
* `props.children`.
*
* See https://facebook.github.io/react/docs/react-api.html#react.children.count
*
* @param {?*} children Children tree container.
* @return {number} The number of children.
*/
function countChildren(children, context) {
return traverseAllChildren(children, emptyFunction.thatReturnsNull, null);
}
/**
* Flatten a children object (typically specified as `props.children`) and
* return an array with appropriately re-keyed children.
*
* See https://facebook.github.io/react/docs/react-api.html#react.children.toarray
*/
function toArray(children) {
var result = [];
mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument);
return result;
}
var ReactChildren = {
forEach: forEachChildren,
map: mapChildren,
count: countChildren,
toArray: toArray
};
var ReactChildren_1 = ReactChildren;
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @providesModule ReactVersion
*/
var ReactVersion = '16.0.0';
/**
* Returns the first child in a collection of children and verifies that there
* is only one child in the collection.
*
* See https://facebook.github.io/react/docs/react-api.html#react.children.only
*
* The current implementation of this function assumes that a single child gets
* passed without a wrapper, but the purpose of this helper function is to
* abstract away the particular structure of children.
*
* @param {?object} children Child collection structure.
* @return {ReactElement} The first and only `ReactElement` contained in the
* structure.
*/
function onlyChild(children) {
!ReactElement_1.isValidElement(children) ? invariant(false, 'React.Children.only expected to receive a single React element child.') : void 0;
return children;
}
var onlyChild_1 = onlyChild;
/**
* Copyright (c) 2016-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
* @providesModule describeComponentFrame
*/
var describeComponentFrame$1 = function (name, source, ownerName) {
return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
};
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @providesModule getComponentName
*
*/
function getComponentName$1(instanceOrFiber) {
if (typeof instanceOrFiber.getName === 'function') {
// Stack reconciler
var instance = instanceOrFiber;
return instance.getName();
}
if (typeof instanceOrFiber.tag === 'number') {
// Fiber reconciler
var fiber = instanceOrFiber;
var type = fiber.type;
if (typeof type === 'string') {
return type;
}
if (typeof type === 'function') {
return type.displayName || type.name;
}
}
return null;
}
var getComponentName_1 = getComponentName$1;
{
var checkPropTypes$1 = checkPropTypes;
var lowPriorityWarning$1 = lowPriorityWarning_1;
var ReactDebugCurrentFrame$1 = ReactDebugCurrentFrame_1;
var warning$3 = require$$0;
var describeComponentFrame = describeComponentFrame$1;
var getComponentName = getComponentName_1;
var currentlyValidatingElement = null;
var getDisplayName = function (element) {
if (element == null) {
return '#empty';
} else if (typeof element === 'string' || typeof element === 'number') {
return '#text';
} else if (typeof element.type === 'string') {
return element.type;
} else {
return element.type.displayName || element.type.name || 'Unknown';
}
};
var getStackAddendum$1 = function () {
var stack = '';
if (currentlyValidatingElement) {
var name = getDisplayName(currentlyValidatingElement);
var owner = currentlyValidatingElement._owner;
stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner));
}
stack += ReactDebugCurrentFrame$1.getStackAddendum() || '';
return stack;
};
}
var ITERATOR_SYMBOL$1 = typeof Symbol === 'function' && Symbol.iterator;
var FAUX_ITERATOR_SYMBOL$1 = '@@iterator'; // Before Symbol spec.
function getDeclarationErrorAddendum() {
if (ReactCurrentOwner_1.current) {
var name = getComponentName(ReactCurrentOwner_1.current);
if (name) {
return '\n\nCheck the render method of `' + name + '`.';
}
}
return '';
}
function getSourceInfoErrorAddendum(elementProps) {
if (elementProps !== null && elementProps !== undefined && elementProps.__source !== undefined) {
var source = elementProps.__source;
var fileName = source.fileName.replace(/^.*[\\\/]/, '');
var lineNumber = source.lineNumber;
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
}
return '';
}
/**
* Warn if there's no key explicitly set on dynamic arrays of children or
* object keys are not valid. This allows us to keep track of children between
* updates.
*/
var ownerHasKeyUseWarning = {};
function getCurrentComponentErrorInfo(parentType) {
var info = getDeclarationErrorAddendum();
if (!info) {
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
if (parentName) {
info = '\n\nCheck the top-level render call using <' + parentName + '>.';
}
}
return info;
}
/**
* Warn if the element doesn't have an explicit key assigned to it.
* This element is in an array. The array could grow and shrink or be
* reordered. All children that haven't already been validated are required to
* have a "key" property assigned to it. Error statuses are cached so a warning
* will only be shown once.
*
* @internal
* @param {ReactElement} element Element that requires a key.
* @param {*} parentType element's parent's type.
*/
function validateExplicitKey(element, parentType) {
if (!element._store || element._store.validated || element.key != null) {
return;
}
element._store.validated = true;
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
return;
}
ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
// Usually the current owner is the offender, but if it accepts children as a
// property, it may be the creator of the child that's responsible for
// assigning it a key.
var childOwner = '';
if (element && element._owner && element._owner !== ReactCurrentOwner_1.current) {
// Give the component that originally created this child.
childOwner = ' It was passed a child from ' + getComponentName(element._owner) + '.';
}
currentlyValidatingElement = element;
{
warning$3(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.%s', currentComponentErrorInfo, childOwner, getStackAddendum$1());
}
currentlyValidatingElement = null;
}
/**
* Ensure that every element either is passed in a static location, in an
* array with an explicit keys property defined, or in an object literal
* with valid key property.
*
* @internal
* @param {ReactNode} node Statically passed child of any type.
* @param {*} parentType node's parent's type.
*/
function validateChildKeys(node, parentType) {
if (typeof node !== 'object') {
return;
}
if (Array.isArray(node)) {
for (var i = 0; i < node.length; i++) {
var child = node[i];
if (ReactElement_1.isValidElement(child)) {
validateExplicitKey(child, parentType);
}
}
} else if (ReactElement_1.isValidElement(node)) {
// This element was passed in a valid location.
if (node._store) {
node._store.validated = true;
}
} else if (node) {
var iteratorFn = ITERATOR_SYMBOL$1 && node[ITERATOR_SYMBOL$1] || node[FAUX_ITERATOR_SYMBOL$1];
if (typeof iteratorFn === 'function') {
// Entry iterators used to provide implicit keys,
// but now we print a separate warning for them later.
if (iteratorFn !== node.entries) {
var iterator = iteratorFn.call(node);
var step;
while (!(step = iterator.next()).done) {
if (ReactElement_1.isValidElement(step.value)) {
validateExplicitKey(step.value, parentType);
}
}
}
}
}
}
/**
* Given an element, validate that its props follow the propTypes definition,
* provided by the type.
*
* @param {ReactElement} element
*/
function validatePropTypes(element) {
var componentClass = element.type;
if (typeof componentClass !== 'function') {
return;
}
var name = componentClass.displayName || componentClass.name;
var propTypes = componentClass.propTypes;
if (propTypes) {
currentlyValidatingElement = element;
checkPropTypes$1(propTypes, element.props, 'prop', name, getStackAddendum$1);
currentlyValidatingElement = null;
}
if (typeof componentClass.getDefaultProps === 'function') {
warning$3(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
}
}
var ReactElementValidator$1 = {
createElement: function (type, props, children) {
var validType = typeof type === 'string' || typeof type === 'function';
// We warn in this case but don't throw. We expect the element creation to
// succeed and there will likely be errors in render.
if (!validType) {
var info = '';
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
info += ' You likely forgot to export your component from the file ' + "it's defined in.";
}
var sourceInfo = getSourceInfoErrorAddendum(props);
if (sourceInfo) {
info += sourceInfo;
} else {
info += getDeclarationErrorAddendum();
}
info += ReactDebugCurrentFrame$1.getStackAddendum() || '';
warning$3(false, 'React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', type == null ? type : typeof type, info);
}
var element = ReactElement_1.createElement.apply(this, arguments);
// The result can be nullish if a mock or a custom function is used.
// TODO: Drop this when these are no longer allowed as the type argument.
if (element == null) {
return element;
}
// Skip key warning if the type isn't valid since our key validation logic
// doesn't expect a non-string/function type and can throw confusing errors.
// We don't want exception behavior to differ between dev and prod.
// (Rendering will throw with a helpful message and as soon as the type is
// fixed, the key warnings will appear.)
if (validType) {
for (var i = 2; i < arguments.length; i++) {
validateChildKeys(arguments[i], type);
}
}
validatePropTypes(element);
return element;
},
createFactory: function (type) {
var validatedFactory = ReactElementValidator$1.createElement.bind(null, type);
// Legacy hook TODO: Warn if this is accessed
validatedFactory.type = type;
{
Object.defineProperty(validatedFactory, 'type', {
enumerable: false,
get: function () {
lowPriorityWarning$1(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
Object.defineProperty(this, 'type', {
value: type
});
return type;
}
});
}
return validatedFactory;
},
cloneElement: function (element, props, children) {
var newElement = ReactElement_1.cloneElement.apply(this, arguments);
for (var i = 2; i < arguments.length; i++) {
validateChildKeys(arguments[i], newElement.type);
}
validatePropTypes(newElement);
return newElement;
}
};
var ReactElementValidator_1 = ReactElementValidator$1;
{
var warning$4 = require$$0;
}
function isNative(fn) {
// Based on isNative() from Lodash
var funcToString = Function.prototype.toString;
var reIsNative = RegExp('^' + funcToString
// Take an example native function source for comparison
.call(Object.prototype.hasOwnProperty)
// Strip regex characters so we can use it for regex
.replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
// Remove hasOwnProperty from the template to make it generic
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
try {
var source = funcToString.call(fn);
return reIsNative.test(source);
} catch (err) {
return false;
}
}
var canUseCollections =
// Array.from
typeof Array.from === 'function' &&
// Map
typeof Map === 'function' && isNative(Map) &&
// Map.prototype.keys
Map.prototype != null && typeof Map.prototype.keys === 'function' && isNative(Map.prototype.keys) &&
// Set
typeof Set === 'function' && isNative(Set) &&
// Set.prototype.keys
Set.prototype != null && typeof Set.prototype.keys === 'function' && isNative(Set.prototype.keys);
var setItem;
var getItem;
var removeItem;
var getItemIDs;
var addRoot;
var removeRoot;
var getRootIDs;
if (canUseCollections) {
var itemMap = new Map();
var rootIDSet = new Set();
setItem = function (id, item) {
itemMap.set(id, item);
};
getItem = function (id) {
return itemMap.get(id);
};
removeItem = function (id) {
itemMap['delete'](id);
};
getItemIDs = function () {
return Array.from(itemMap.keys());
};
addRoot = function (id) {
rootIDSet.add(id);
};
removeRoot = function (id) {
rootIDSet['delete'](id);
};
getRootIDs = function () {
return Array.from(rootIDSet.keys());
};
} else {
var itemByKey = {};
var rootByKey = {};
// Use non-numeric keys to prevent V8 performance issues:
// https://github.com/facebook/react/pull/7232
var getKeyFromID = function (id) {
return '.' + id;
};
var getIDFromKey = function (key) {
return parseInt(key.substr(1), 10);
};
setItem = function (id, item) {
var key = getKeyFromID(id);
itemByKey[key] = item;
};
getItem = function (id) {
var key = getKeyFromID(id);
return itemByKey[key];
};
removeItem = function (id) {
var key = getKeyFromID(id);
delete itemByKey[key];
};
getItemIDs = function () {
return Object.keys(itemByKey).map(getIDFromKey);
};
addRoot = function (id) {
var key = getKeyFromID(id);
rootByKey[key] = true;
};
removeRoot = function (id) {
var key = getKeyFromID(id);
delete rootByKey[key];
};
getRootIDs = function () {
return Object.keys(rootByKey).map(getIDFromKey);
};
}
var unmountedIDs = [];
function purgeDeep(id) {
var item = getItem(id);
if (item) {
var childIDs = item.childIDs;
removeItem(id);
childIDs.forEach(purgeDeep);
}
}
function getDisplayName$1(element) {
if (element == null) {
return '#empty';
} else if (typeof element === 'string' || typeof element === 'number') {
return '#text';
} else if (typeof element.type === 'string') {
return element.type;
} else {
return element.type.displayName || element.type.name || 'Unknown';
}
}
function describeID(id) {
var name = ReactComponentTreeHook.getDisplayName(id);
var element = ReactComponentTreeHook.getElement(id);
var ownerID = ReactComponentTreeHook.getOwnerID(id);
var ownerName = void 0;
if (ownerID) {
ownerName = ReactComponentTreeHook.getDisplayName(ownerID);
}
warning$4(element, 'ReactComponentTreeHook: Missing React element for debugID %s when ' + 'building stack', id);
return describeComponentFrame$1(name || '', element && element._source, ownerName || '');
}
var ReactComponentTreeHook = {
onSetChildren: function (id, nextChildIDs) {
var item = getItem(id);
!item ? invariant(false, 'Item must have been set') : void 0;
item.childIDs = nextChildIDs;
for (var i = 0; i < nextChildIDs.length; i++) {
var nextChildID = nextChildIDs[i];
var nextChild = getItem(nextChildID);
!nextChild ? invariant(false, 'Expected hook events to fire for the child before its parent includes it in onSetChildren().') : void 0;
!(nextChild.childIDs != null || typeof nextChild.element !== 'object' || nextChild.element == null) ? invariant(false, 'Expected onSetChildren() to fire for a container child before its parent includes it in onSetChildren().') : void 0;
!nextChild.isMounted ? invariant(false, 'Expected onMountComponent() to fire for the child before its parent includes it in onSetChildren().') : void 0;
if (nextChild.parentID == null) {
nextChild.parentID = id;
// TODO: This shouldn't be necessary but mounting a new root during in
// componentWillMount currently causes not-yet-mounted components to
// be purged from our tree data so their parent id is missing.
}
!(nextChild.parentID === id) ? invariant(false, 'Expected onBeforeMountComponent() parent and onSetChildren() to be consistent (%s has parents %s and %s).', nextChildID, nextChild.parentID, id) : void 0;
}
},
onBeforeMountComponent: function (id, element, parentID) {
var item = {
element: element,
parentID: parentID,
text: null,
childIDs: [],
isMounted: false,
updateCount: 0
};
setItem(id, item);
},
onBeforeUpdateComponent: function (id, element) {
var item = getItem(id);
if (!item || !item.isMounted) {
// We may end up here as a result of setState() in componentWillUnmount().
// In this case, ignore the element.
return;
}
item.element = element;
},
onMountComponent: function (id) {
var item = getItem(id);
!item ? invariant(false, 'Item must have been set') : void 0;
item.isMounted = true;
var isRoot = item.parentID === 0;
if (isRoot) {
addRoot(id);
}
},
onUpdateComponent: function (id) {
var item = getItem(id);
if (!item || !item.isMounted) {
// We may end up here as a result of setState() in componentWillUnmount().
// In this case, ignore the element.
return;
}
item.updateCount++;
},
onUnmountComponent: function (id) {
var item = getItem(id);
if (item) {
// We need to check if it exists.
// `item` might not exist if it is inside an error boundary, and a sibling
// error boundary child threw while mounting. Then this instance never
// got a chance to mount, but it still gets an unmounting event during
// the error boundary cleanup.
item.isMounted = false;
var isRoot = item.parentID === 0;
if (isRoot) {
removeRoot(id);
}
}
unmountedIDs.push(id);
},
purgeUnmountedComponents: function () {
if (ReactComponentTreeHook._preventPurging) {
// Should only be used for testing.
return;
}
for (var i = 0; i < unmountedIDs.length; i++) {
var id = unmountedIDs[i];
purgeDeep(id);
}
unmountedIDs.length = 0;
},
isMounted: function (id) {
var item = getItem(id);
return item ? item.isMounted : false;
},
getCurrentStackAddendum: function () {
var info = '';
var currentOwner = ReactCurrentOwner_1.current;
if (currentOwner) {
!(typeof currentOwner.tag !== 'number') ? invariant(false, 'Fiber owners should not show up in Stack stack traces.') : void 0;
if (typeof currentOwner._debugID === 'number') {
info += ReactComponentTreeHook.getStackAddendumByID(currentOwner._debugID);
}
}
return info;
},
getStackAddendumByID: function (id) {
var info = '';
while (id) {
info += describeID(id);
id = ReactComponentTreeHook.getParentID(id);
}
return info;
},
getChildIDs: function (id) {
var item = getItem(id);
return item ? item.childIDs : [];
},
getDisplayName: function (id) {
var element = ReactComponentTreeHook.getElement(id);
if (!element) {
return null;
}
return getDisplayName$1(element);
},
getElement: function (id) {
var item = getItem(id);
return item ? item.element : null;
},
getOwnerID: function (id) {
var element = ReactComponentTreeHook.getElement(id);
if (!element || !element._owner) {
return null;
}
return element._owner._debugID;
},
getParentID: function (id) {
var item = getItem(id);
return item ? item.parentID : null;
},
getSource: function (id) {
var item = getItem(id);
var element = item ? item.element : null;
var source = element != null ? element._source : null;
return source;
},
getText: function (id) {
var element = ReactComponentTreeHook.getElement(id);
if (typeof element === 'string') {
return element;
} else if (typeof element === 'number') {
return '' + element;
} else {
return null;
}
},
getUpdateCount: function (id) {
var item = getItem(id);
return item ? item.updateCount : 0;
},
getRootIDs: getRootIDs,
getRegisteredIDs: getItemIDs
};
var ReactComponentTreeHook_1 = ReactComponentTreeHook;
var createElement = ReactElement_1.createElement;
var createFactory = ReactElement_1.createFactory;
var cloneElement = ReactElement_1.cloneElement;
{
var ReactElementValidator = ReactElementValidator_1;
createElement = ReactElementValidator.createElement;
createFactory = ReactElementValidator.createFactory;
cloneElement = ReactElementValidator.cloneElement;
}
var React = {
Children: {
map: ReactChildren_1.map,
forEach: ReactChildren_1.forEach,
count: ReactChildren_1.count,
toArray: ReactChildren_1.toArray,
only: onlyChild_1
},
Component: ReactBaseClasses.Component,
PureComponent: ReactBaseClasses.PureComponent,
unstable_AsyncComponent: ReactBaseClasses.AsyncComponent,
createElement: createElement,
cloneElement: cloneElement,
isValidElement: ReactElement_1.isValidElement,
createFactory: createFactory,
version: ReactVersion,
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
ReactCurrentOwner: ReactCurrentOwner_1,
// Used by renderers to avoid bundling object-assign twice in UMD bundles:
assign: objectAssign$1
}
};
{
objectAssign$1(React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, {
// These should not be included in production.
ReactComponentTreeHook: ReactComponentTreeHook_1,
ReactDebugCurrentFrame: ReactDebugCurrentFrame_1
});
}
var ReactEntry = React;
module.exports = ReactEntry;
})();
}
/***/ }),
/* 16 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
var emptyObject = {};
if (true) {
Object.freeze(emptyObject);
}
module.exports = emptyObject;
/***/ }),
/* 17 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
if (true) {
var invariant = __webpack_require__(1);
var warning = __webpack_require__(0);
var ReactPropTypesSecret = __webpack_require__(18);
var loggedTypeFailures = {};
}
/**
* Assert that the values match with the type specs.
* Error messages are memorized and will only be shown once.
*
* @param {object} typeSpecs Map of name to a ReactPropType
* @param {object} values Runtime values that need to be type-checked
* @param {string} location e.g. "prop", "context", "child context"
* @param {string} componentName Name of the component for error messages.
* @param {?Function} getStack Returns the component stack.
* @private
*/
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
if (true) {
for (var typeSpecName in typeSpecs) {
if (typeSpecs.hasOwnProperty(typeSpecName)) {
var error;
// Prop type validation may throw. In case they do, we don't want to
// fail the render phase where it didn't fail before. So we log it.
// After these have been cleaned up, we'll let them throw.
try {
// This is intentionally an invariant that gets caught. It's the same
// behavior as without this statement except with a better message.
invariant(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'the `prop-types` package, but received `%s`.', componentName || 'React class', location, typeSpecName, typeof typeSpecs[typeSpecName]);
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
} catch (ex) {
error = ex;
}
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);
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
// Only monitor this failure once because there tends to be a lot of the
// same error.
loggedTypeFailures[error.message] = true;
var stack = getStack ? getStack() : '';
warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : '');
}
}
}
}
}
module.exports = checkPropTypes;
/***/ }),
/* 18 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
module.exports = ReactPropTypesSecret;
/***/ }),
/* 19 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var emptyFunction = __webpack_require__(3);
var invariant = __webpack_require__(1);
var warning = __webpack_require__(0);
var assign = __webpack_require__(7);
var ReactPropTypesSecret = __webpack_require__(9);
var checkPropTypes = __webpack_require__(20);
module.exports = function(isValidElement, throwOnDirectAccess) {
/* global Symbol */
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
/**
* Returns the iterator method function contained on the iterable object.
*
* Be sure to invoke the function with the iterable as context:
*
* var iteratorFn = getIteratorFn(myIterable);
* if (iteratorFn) {
* var iterator = iteratorFn.call(myIterable);
* ...
* }
*
* @param {?object} maybeIterable
* @return {?function}
*/
function getIteratorFn(maybeIterable) {
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
if (typeof iteratorFn === 'function') {
return iteratorFn;
}
}
/**
* Collection of methods that allow declaration and validation of props that are
* supplied to React components. Example usage:
*
* var Props = require('ReactPropTypes');
* var MyArticle = React.createClass({
* propTypes: {
* // An optional string prop named "description".
* description: Props.string,
*
* // A required enum prop named "category".
* category: Props.oneOf(['News','Photos']).isRequired,
*
* // A prop named "dialog" that requires an instance of Dialog.
* dialog: Props.instanceOf(Dialog).isRequired
* },
* render: function() { ... }
* });
*
* A more formal specification of how these methods are used:
*
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
* decl := ReactPropTypes.{type}(.isRequired)?
*
* Each and every declaration produces a function with the same signature. This
* allows the creation of custom validation functions. For example:
*
* var MyLink = React.createClass({
* propTypes: {
* // An optional string or URI prop named "href".
* href: function(props, propName, componentName) {
* var propValue = props[propName];
* if (propValue != null && typeof propValue !== 'string' &&
* !(propValue instanceof URI)) {
* return new Error(
* 'Expected a string or an URI for ' + propName + ' in ' +
* componentName
* );
* }
* }
* },
* render: function() {...}
* });
*
* @internal
*/
var ANONYMOUS = '<<anonymous>>';
// Important!
// Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
var ReactPropTypes = {
array: createPrimitiveTypeChecker('array'),
bool: createPrimitiveTypeChecker('boolean'),
func: createPrimitiveTypeChecker('function'),
number: createPrimitiveTypeChecker('number'),
object: createPrimitiveTypeChecker('object'),
string: createPrimitiveTypeChecker('string'),
symbol: createPrimitiveTypeChecker('symbol'),
any: createAnyTypeChecker(),
arrayOf: createArrayOfTypeChecker,
element: createElementTypeChecker(),
instanceOf: createInstanceTypeChecker,
node: createNodeChecker(),
objectOf: createObjectOfTypeChecker,
oneOf: createEnumTypeChecker,
oneOfType: createUnionTypeChecker,
shape: createShapeTypeChecker,
exact: createStrictShapeTypeChecker,
};
/**
* inlined Object.is polyfill to avoid requiring consumers ship their own
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
*/
/*eslint-disable no-self-compare*/
function is(x, y) {
// SameValue algorithm
if (x === y) {
// Steps 1-5, 7-10
// Steps 6.b-6.e: +0 != -0
return x !== 0 || 1 / x === 1 / y;
} else {
// Step 6.a: NaN == NaN
return x !== x && y !== y;
}
}
/*eslint-enable no-self-compare*/
/**
* We use an Error-like object for backward compatibility as people may call
* PropTypes directly and inspect their output. However, we don't use real
* Errors anymore. We don't inspect their stack anyway, and creating them
* is prohibitively expensive if they are created too often, such as what
* happens in oneOfType() for any type before the one that matched.
*/
function PropTypeError(message) {
this.message = message;
this.stack = '';
}
// Make `instanceof Error` still work for returned errors.
PropTypeError.prototype = Error.prototype;
function createChainableTypeChecker(validate) {
if (true) {
var manualPropTypeCallCache = {};
var manualPropTypeWarningCount = 0;
}
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
componentName = componentName || ANONYMOUS;
propFullName = propFullName || propName;
if (secret !== ReactPropTypesSecret) {
if (throwOnDirectAccess) {
// New behavior only for users of `prop-types` package
invariant(
false,
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
'Use `PropTypes.checkPropTypes()` to call them. ' +
'Read more at http://fb.me/use-check-prop-types'
);
} else if ("development" !== 'production' && typeof console !== 'undefined') {
// Old behavior for people using React.PropTypes
var cacheKey = componentName + ':' + propName;
if (
!manualPropTypeCallCache[cacheKey] &&
// Avoid spamming the console because they are often not actionable except for lib authors
manualPropTypeWarningCount < 3
) {
warning(
false,
'You are manually calling a React.PropTypes validation ' +
'function for the `%s` prop on `%s`. This is deprecated ' +
'and will throw in the standalone `prop-types` package. ' +
'You may be seeing this warning due to a third-party PropTypes ' +
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.',
propFullName,
componentName
);
manualPropTypeCallCache[cacheKey] = true;
manualPropTypeWarningCount++;
}
}
}
if (props[propName] == null) {
if (isRequired) {
if (props[propName] === null) {
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
}
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
}
return null;
} else {
return validate(props, propName, componentName, location, propFullName);
}
}
var chainedCheckType = checkType.bind(null, false);
chainedCheckType.isRequired = checkType.bind(null, true);
return chainedCheckType;
}
function createPrimitiveTypeChecker(expectedType) {
function validate(props, propName, componentName, location, propFullName, secret) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== expectedType) {
// `propValue` being instance of, say, date/regexp, pass the 'object'
// check, but we can offer a more precise error message here rather than
// 'of type `object`'.
var preciseType = getPreciseType(propValue);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createAnyTypeChecker() {
return createChainableTypeChecker(emptyFunction.thatReturnsNull);
}
function createArrayOfTypeChecker(typeChecker) {
function validate(props, propName, componentName, location, propFullName) {
if (typeof typeChecker !== 'function') {
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
}
var propValue = props[propName];
if (!Array.isArray(propValue)) {
var propType = getPropType(propValue);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
}
for (var i = 0; i < propValue.length; i++) {
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
if (error instanceof Error) {
return error;
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function createElementTypeChecker() {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
if (!isValidElement(propValue)) {
var propType = getPropType(propValue);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createInstanceTypeChecker(expectedClass) {
function validate(props, propName, componentName, location, propFullName) {
if (!(props[propName] instanceof expectedClass)) {
var expectedClassName = expectedClass.name || ANONYMOUS;
var actualClassName = getClassName(props[propName]);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createEnumTypeChecker(expectedValues) {
if (!Array.isArray(expectedValues)) {
true ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0;
return emptyFunction.thatReturnsNull;
}
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
for (var i = 0; i < expectedValues.length; i++) {
if (is(propValue, expectedValues[i])) {
return null;
}
}
var valuesString = JSON.stringify(expectedValues);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
}
return createChainableTypeChecker(validate);
}
function createObjectOfTypeChecker(typeChecker) {
function validate(props, propName, componentName, location, propFullName) {
if (typeof typeChecker !== 'function') {
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
}
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
}
for (var key in propValue) {
if (propValue.hasOwnProperty(key)) {
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
if (error instanceof Error) {
return error;
}
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function createUnionTypeChecker(arrayOfTypeCheckers) {
if (!Array.isArray(arrayOfTypeCheckers)) {
true ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
return emptyFunction.thatReturnsNull;
}
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
var checker = arrayOfTypeCheckers[i];
if (typeof checker !== 'function') {
warning(
false,
'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
'received %s at index %s.',
getPostfixForTypeWarning(checker),
i
);
return emptyFunction.thatReturnsNull;
}
}
function validate(props, propName, componentName, location, propFullName) {
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
var checker = arrayOfTypeCheckers[i];
if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {
return null;
}
}
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
}
return createChainableTypeChecker(validate);
}
function createNodeChecker() {
function validate(props, propName, componentName, location, propFullName) {
if (!isNode(props[propName])) {
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createShapeTypeChecker(shapeTypes) {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
}
for (var key in shapeTypes) {
var checker = shapeTypes[key];
if (!checker) {
continue;
}
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
if (error) {
return error;
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function createStrictShapeTypeChecker(shapeTypes) {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
}
// We need to check all keys in case some are required but missing from
// props.
var allKeys = assign({}, props[propName], shapeTypes);
for (var key in allKeys) {
var checker = shapeTypes[key];
if (!checker) {
return new PropTypeError(
'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
'\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
);
}
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
if (error) {
return error;
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function isNode(propValue) {
switch (typeof propValue) {
case 'number':
case 'string':
case 'undefined':
return true;
case 'boolean':
return !propValue;
case 'object':
if (Array.isArray(propValue)) {
return propValue.every(isNode);
}
if (propValue === null || isValidElement(propValue)) {
return true;
}
var iteratorFn = getIteratorFn(propValue);
if (iteratorFn) {
var iterator = iteratorFn.call(propValue);
var step;
if (iteratorFn !== propValue.entries) {
while (!(step = iterator.next()).done) {
if (!isNode(step.value)) {
return false;
}
}
} else {
// Iterator will provide entry [k,v] tuples rather than values.
while (!(step = iterator.next()).done) {
var entry = step.value;
if (entry) {
if (!isNode(entry[1])) {
return false;
}
}
}
}
} else {
return false;
}
return true;
default:
return false;
}
}
function isSymbol(propType, propValue) {
// Native Symbol.
if (propType === 'symbol') {
return true;
}
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
if (propValue['@@toStringTag'] === 'Symbol') {
return true;
}
// Fallback for non-spec compliant Symbols which are polyfilled.
if (typeof Symbol === 'function' && propValue instanceof Symbol) {
return true;
}
return false;
}
// Equivalent of `typeof` but with special handling for array and regexp.
function getPropType(propValue) {
var propType = typeof propValue;
if (Array.isArray(propValue)) {
return 'array';
}
if (propValue instanceof RegExp) {
// Old webkits (at least until Android 4.0) return 'function' rather than
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
// passes PropTypes.object.
return 'object';
}
if (isSymbol(propType, propValue)) {
return 'symbol';
}
return propType;
}
// This handles more types than `getPropType`. Only used for error messages.
// See `createPrimitiveTypeChecker`.
function getPreciseType(propValue) {
if (typeof propValue === 'undefined' || propValue === null) {
return '' + propValue;
}
var propType = getPropType(propValue);
if (propType === 'object') {
if (propValue instanceof Date) {
return 'date';
} else if (propValue instanceof RegExp) {
return 'regexp';
}
}
return propType;
}
// Returns a string that is postfixed to a warning about an invalid type.
// For example, "undefined" or "of type array"
function getPostfixForTypeWarning(value) {
var type = getPreciseType(value);
switch (type) {
case 'array':
case 'object':
return 'an ' + type;
case 'boolean':
case 'date':
case 'regexp':
return 'a ' + type;
default:
return type;
}
}
// Returns class name of the object, if any.
function getClassName(propValue) {
if (!propValue.constructor || !propValue.constructor.name) {
return ANONYMOUS;
}
return propValue.constructor.name;
}
ReactPropTypes.checkPropTypes = checkPropTypes;
ReactPropTypes.PropTypes = ReactPropTypes;
return ReactPropTypes;
};
/***/ }),
/* 20 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
if (true) {
var invariant = __webpack_require__(1);
var warning = __webpack_require__(0);
var ReactPropTypesSecret = __webpack_require__(9);
var loggedTypeFailures = {};
}
/**
* Assert that the values match with the type specs.
* Error messages are memorized and will only be shown once.
*
* @param {object} typeSpecs Map of name to a ReactPropType
* @param {object} values Runtime values that need to be type-checked
* @param {string} location e.g. "prop", "context", "child context"
* @param {string} componentName Name of the component for error messages.
* @param {?Function} getStack Returns the component stack.
* @private
*/
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
if (true) {
for (var typeSpecName in typeSpecs) {
if (typeSpecs.hasOwnProperty(typeSpecName)) {
var error;
// Prop type validation may throw. In case they do, we don't want to
// fail the render phase where it didn't fail before. So we log it.
// After these have been cleaned up, we'll let them throw.
try {
// This is intentionally an invariant that gets caught. It's the same
// behavior as without this statement except with a better message.
invariant(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'the `prop-types` package, but received `%s`.', componentName || 'React class', location, typeSpecName, typeof typeSpecs[typeSpecName]);
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
} catch (ex) {
error = ex;
}
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);
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
// Only monitor this failure once because there tends to be a lot of the
// same error.
loggedTypeFailures[error.message] = true;
var stack = getStack ? getStack() : '';
warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : '');
}
}
}
}
}
module.exports = checkPropTypes;
/***/ }),
/* 21 */
/***/ (function(module, exports) {
module.exports = function(module) {
if(!module.webpackPolyfill) {
module.deprecate = function() {};
module.paths = [];
// module.parent = undefined by default
if(!module.children) module.children = [];
Object.defineProperty(module, "loaded", {
enumerable: true,
get: function() {
return module.l;
}
});
Object.defineProperty(module, "id", {
enumerable: true,
get: function() {
return module.i;
}
});
module.webpackPolyfill = 1;
}
return module;
};
/***/ }),
/* 22 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _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 _brace = __webpack_require__(4);
var _brace2 = _interopRequireDefault(_brace);
var _react = __webpack_require__(6);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(8);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _lodash = __webpack_require__(10);
var _lodash2 = _interopRequireDefault(_lodash);
var _lodash3 = __webpack_require__(23);
var _lodash4 = _interopRequireDefault(_lodash3);
var _editorOptions = __webpack_require__(11);
__webpack_require__(24);
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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var _ace$acequire = _brace2.default.acequire('ace/range'),
Range = _ace$acequire.Range;
var _ace$acequire2 = _brace2.default.acequire('ace/split'),
Split = _ace$acequire2.Split;
var SplitComponent = function (_Component) {
_inherits(SplitComponent, _Component);
function SplitComponent(props) {
_classCallCheck(this, SplitComponent);
var _this = _possibleConstructorReturn(this, (SplitComponent.__proto__ || Object.getPrototypeOf(SplitComponent)).call(this, props));
_editorOptions.editorEvents.forEach(function (method) {
_this[method] = _this[method].bind(_this);
});
return _this;
}
_createClass(SplitComponent, [{
key: 'componentDidMount',
value: function componentDidMount() {
var _this2 = this;
var _props = this.props,
className = _props.className,
onBeforeLoad = _props.onBeforeLoad,
mode = _props.mode,
focus = _props.focus,
theme = _props.theme,
fontSize = _props.fontSize,
value = _props.value,
defaultValue = _props.defaultValue,
cursorStart = _props.cursorStart,
showGutter = _props.showGutter,
wrapEnabled = _props.wrapEnabled,
showPrintMargin = _props.showPrintMargin,
_props$scrollMargin = _props.scrollMargin,
scrollMargin = _props$scrollMargin === undefined ? [0, 0, 0, 0] : _props$scrollMargin,
keyboardHandler = _props.keyboardHandler,
onLoad = _props.onLoad,
commands = _props.commands,
annotations = _props.annotations,
markers = _props.markers,
splits = _props.splits;
this.editor = _brace2.default.edit(this.refEditor);
if (onBeforeLoad) {
onBeforeLoad(_brace2.default);
}
var editorProps = Object.keys(this.props.editorProps);
var split = new Split(this.editor.container, 'ace/theme/' + theme, splits);
this.editor.env.split = split;
this.splitEditor = split.getEditor(0);
this.split = split;
// in a split scenario we don't want a print margin for the entire application
this.editor.setShowPrintMargin(false);
this.editor.renderer.setShowGutter(false);
// get a list of possible options to avoid 'misspelled option errors'
var availableOptions = this.splitEditor.$options;
split.forEach(function (editor, index) {
for (var i = 0; i < editorProps.length; i++) {
editor[editorProps[i]] = _this2.props.editorProps[editorProps[i]];
}
var defaultValueForEditor = (0, _lodash4.default)(defaultValue, index);
var valueForEditor = (0, _lodash4.default)(value, index, '');
editor.setTheme('ace/theme/' + theme);
editor.renderer.setScrollMargin(scrollMargin[0], scrollMargin[1], scrollMargin[2], scrollMargin[3]);
editor.getSession().setMode('ace/mode/' + mode);
editor.setFontSize(fontSize);
editor.renderer.setShowGutter(showGutter);
editor.getSession().setUseWrapMode(wrapEnabled);
editor.setShowPrintMargin(showPrintMargin);
editor.on('focus', _this2.onFocus);
editor.on('blur', _this2.onBlur);
editor.on('input', _this2.onInput);
editor.on('copy', _this2.onCopy);
editor.on('paste', _this2.onPaste);
editor.on('change', _this2.onChange);
editor.getSession().selection.on('changeSelection', _this2.onSelectionChange);
editor.session.on('changeScrollTop', _this2.onScroll);
editor.setValue(defaultValueForEditor === undefined ? valueForEditor : defaultValueForEditor, cursorStart);
var newAnnotations = (0, _lodash4.default)(annotations, index, []);
var newMarkers = (0, _lodash4.default)(markers, index, []);
editor.getSession().setAnnotations(newAnnotations);
if (newMarkers && newMarkers.length > 0) {
_this2.handleMarkers(newMarkers, editor);
}
for (var _i = 0; _i < _editorOptions.editorOptions.length; _i++) {
var option = _editorOptions.editorOptions[_i];
if (availableOptions.hasOwnProperty(option)) {
editor.setOption(option, _this2.props[option]);
} else if (_this2.props[option]) {
console.warn('ReaceAce: editor option ' + option + ' was activated but not found. Did you need to import a related tool or did you possibly mispell the option?');
}
}
_this2.handleOptions(_this2.props, editor);
if (Array.isArray(commands)) {
commands.forEach(function (command) {
if (typeof command.exec == 'string') {
editor.commands.bindKey(command.bindKey, command.exec);
} else {
editor.commands.addCommand(command);
}
});
}
if (keyboardHandler) {
editor.setKeyboardHandler('ace/keyboard/' + keyboardHandler);
}
});
if (className) {
this.refEditor.className += ' ' + className;
}
if (focus) {
this.splitEditor.focus();
}
var sp = this.editor.env.split;
sp.setOrientation(this.props.orientation === 'below' ? sp.BELOW : sp.BESIDE);
sp.resize(true);
if (onLoad) {
onLoad(sp);
}
}
}, {
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
var _this3 = this;
var oldProps = this.props;
var split = this.editor.env.split;
if (nextProps.splits !== oldProps.splits) {
split.setSplits(nextProps.splits);
}
if (nextProps.orientation !== oldProps.orientation) {
split.setOrientation(nextProps.orientation === 'below' ? split.BELOW : split.BESIDE);
}
split.forEach(function (editor, index) {
if (nextProps.mode !== oldProps.mode) {
editor.getSession().setMode('ace/mode/' + nextProps.mode);
}
if (nextProps.keyboardHandler !== oldProps.keyboardHandler) {
if (nextProps.keyboardHandler) {
editor.setKeyboardHandler('ace/keyboard/' + nextProps.keyboardHandler);
} else {
editor.setKeyboardHandler(null);
}
}
if (nextProps.fontSize !== oldProps.fontSize) {
editor.setFontSize(nextProps.fontSize);
}
if (nextProps.wrapEnabled !== oldProps.wrapEnabled) {
editor.getSession().setUseWrapMode(nextProps.wrapEnabled);
}
if (nextProps.showPrintMargin !== oldProps.showPrintMargin) {
editor.setShowPrintMargin(nextProps.showPrintMargin);
}
if (nextProps.showGutter !== oldProps.showGutter) {
editor.renderer.setShowGutter(nextProps.showGutter);
}
for (var i = 0; i < _editorOptions.editorOptions.length; i++) {
var option = _editorOptions.editorOptions[i];
if (nextProps[option] !== oldProps[option]) {
editor.setOption(option, nextProps[option]);
}
}
if (!(0, _lodash2.default)(nextProps.setOptions, oldProps.setOptions)) {
_this3.handleOptions(nextProps, editor);
}
var nextValue = (0, _lodash4.default)(nextProps.value, index, '');
if (editor.getValue() !== nextValue) {
// editor.setValue is a synchronous function call, change event is emitted before setValue return.
_this3.silent = true;
var pos = editor.session.selection.toJSON();
editor.setValue(nextValue, nextProps.cursorStart);
editor.session.selection.fromJSON(pos);
_this3.silent = false;
}
var newAnnotations = (0, _lodash4.default)(nextProps.annotations, index, []);
var oldAnnotations = (0, _lodash4.default)(oldProps.annotations, index, []);
if (!(0, _lodash2.default)(newAnnotations, oldAnnotations)) {
editor.getSession().setAnnotations(newAnnotations);
}
var newMarkers = (0, _lodash4.default)(nextProps.markers, index, []);
var oldMarkers = (0, _lodash4.default)(oldProps.markers, index, []);
if (!(0, _lodash2.default)(newMarkers, oldMarkers) && Array.isArray(newMarkers)) {
_this3.handleMarkers(newMarkers, editor);
}
});
if (nextProps.className !== oldProps.className) {
var appliedClasses = this.refEditor.className;
var appliedClassesArray = appliedClasses.trim().split(' ');
var oldClassesArray = oldProps.className.trim().split(' ');
oldClassesArray.forEach(function (oldClass) {
var index = appliedClassesArray.indexOf(oldClass);
appliedClassesArray.splice(index, 1);
});
this.refEditor.className = ' ' + nextProps.className + ' ' + appliedClassesArray.join(' ');
}
if (nextProps.theme !== oldProps.theme) {
split.setTheme('ace/theme/' + nextProps.theme);
}
if (nextProps.focus && !oldProps.focus) {
this.splitEditor.focus();
}
if (nextProps.height !== this.props.height || nextProps.width !== this.props.width) {
this.editor.resize();
}
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
this.editor.destroy();
this.editor = null;
}
}, {
key: 'onChange',
value: function onChange(event) {
if (this.props.onChange && !this.silent) {
var value = [];
this.editor.env.split.forEach(function (editor) {
value.push(editor.getValue());
});
this.props.onChange(value, event);
}
}
}, {
key: 'onSelectionChange',
value: function onSelectionChange(event) {
if (this.props.onSelectionChange) {
var value = [];
this.editor.env.split.forEach(function (editor) {
value.push(editor.getSelection());
});
this.props.onSelectionChange(value, event);
}
}
}, {
key: 'onFocus',
value: function onFocus(event) {
if (this.props.onFocus) {
this.props.onFocus(event);
}
}
}, {
key: 'onInput',
value: function onInput(event) {
if (this.props.onInput) {
this.props.onInput(event);
}
}
}, {
key: 'onBlur',
value: function onBlur(event) {
if (this.props.onBlur) {
this.props.onBlur(event);
}
}
}, {
key: 'onCopy',
value: function onCopy(text) {
if (this.props.onCopy) {
this.props.onCopy(text);
}
}
}, {
key: 'onPaste',
value: function onPaste(text) {
if (this.props.onPaste) {
this.props.onPaste(text);
}
}
}, {
key: 'onScroll',
value: function onScroll() {
if (this.props.onScroll) {
this.props.onScroll(this.editor);
}
}
}, {
key: 'handleOptions',
value: function handleOptions(props, editor) {
var setOptions = Object.keys(props.setOptions);
for (var y = 0; y < setOptions.length; y++) {
editor.setOption(setOptions[y], props.setOptions[setOptions[y]]);
}
}
}, {
key: 'handleMarkers',
value: function handleMarkers(markers, editor) {
// remove foreground markers
var currentMarkers = editor.getSession().getMarkers(true);
for (var i in currentMarkers) {
if (currentMarkers.hasOwnProperty(i)) {
editor.getSession().removeMarker(currentMarkers[i].id);
}
}
// remove background markers
currentMarkers = editor.getSession().getMarkers(false);
for (var _i2 in currentMarkers) {
if (currentMarkers.hasOwnProperty(_i2)) {
editor.getSession().removeMarker(currentMarkers[_i2].id);
}
}
// add new markers
markers.forEach(function (_ref) {
var startRow = _ref.startRow,
startCol = _ref.startCol,
endRow = _ref.endRow,
endCol = _ref.endCol,
className = _ref.className,
type = _ref.type,
_ref$inFront = _ref.inFront,
inFront = _ref$inFront === undefined ? false : _ref$inFront;
var range = new Range(startRow, startCol, endRow, endCol);
editor.getSession().addMarker(range, className, type, inFront);
});
}
}, {
key: 'updateRef',
value: function updateRef(item) {
this.refEditor = item;
}
}, {
key: 'render',
value: function render() {
var _props2 = this.props,
name = _props2.name,
width = _props2.width,
height = _props2.height,
style = _props2.style;
var divStyle = _extends({ width: width, height: height }, style);
return _react2.default.createElement('div', { ref: this.updateRef,
id: name,
style: divStyle
});
}
}]);
return SplitComponent;
}(_react.Component);
exports.default = SplitComponent;
SplitComponent.propTypes = {
mode: _propTypes2.default.string,
splits: _propTypes2.default.number,
orientation: _propTypes2.default.string,
focus: _propTypes2.default.bool,
theme: _propTypes2.default.string,
name: _propTypes2.default.string,
className: _propTypes2.default.string,
height: _propTypes2.default.string,
width: _propTypes2.default.string,
fontSize: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string]),
showGutter: _propTypes2.default.bool,
onChange: _propTypes2.default.func,
onCopy: _propTypes2.default.func,
onPaste: _propTypes2.default.func,
onFocus: _propTypes2.default.func,
onInput: _propTypes2.default.func,
onBlur: _propTypes2.default.func,
onScroll: _propTypes2.default.func,
value: _propTypes2.default.arrayOf(_propTypes2.default.string),
defaultValue: _propTypes2.default.arrayOf(_propTypes2.default.string),
onLoad: _propTypes2.default.func,
onSelectionChange: _propTypes2.default.func,
onBeforeLoad: _propTypes2.default.func,
minLines: _propTypes2.default.number,
maxLines: _propTypes2.default.number,
readOnly: _propTypes2.default.bool,
highlightActiveLine: _propTypes2.default.bool,
tabSize: _propTypes2.default.number,
showPrintMargin: _propTypes2.default.bool,
cursorStart: _propTypes2.default.number,
editorProps: _propTypes2.default.object,
setOptions: _propTypes2.default.object,
style: _propTypes2.default.object,
scrollMargin: _propTypes2.default.array,
annotations: _propTypes2.default.array,
markers: _propTypes2.default.array,
keyboardHandler: _propTypes2.default.string,
wrapEnabled: _propTypes2.default.bool,
enableBasicAutocompletion: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.array]),
enableLiveAutocompletion: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.array]),
commands: _propTypes2.default.array
};
SplitComponent.defaultProps = {
name: 'brace-editor',
focus: false,
orientation: 'beside',
splits: 2,
mode: '',
theme: '',
height: '500px',
width: '500px',
value: [],
fontSize: 12,
showGutter: true,
onChange: null,
onPaste: null,
onLoad: null,
onScroll: null,
minLines: null,
maxLines: null,
readOnly: false,
highlightActiveLine: true,
showPrintMargin: true,
tabSize: 4,
cursorStart: 1,
editorProps: {},
style: {},
scrollMargin: [0, 0, 0, 0],
setOptions: {},
wrapEnabled: false,
enableBasicAutocompletion: false,
enableLiveAutocompletion: false
};
/***/ }),
/* 23 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global) {/**
* lodash (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="npm" -o ./`
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/
/** Used as the `TypeError` message for "Functions" methods. */
var FUNC_ERROR_TEXT = 'Expected a function';
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED = '__lodash_hash_undefined__';
/** Used as references for various `Number` constants. */
var INFINITY = 1 / 0;
/** `Object#toString` result references. */
var funcTag = '[object Function]',
genTag = '[object GeneratorFunction]',
symbolTag = '[object Symbol]';
/** Used to match property names within property paths. */
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
reIsPlainProp = /^\w*$/,
reLeadingDot = /^\./,
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
/**
* Used to match `RegExp`
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
*/
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
/** Used to match backslashes in property paths. */
var reEscapeChar = /\\(\\)?/g;
/** Used to detect host constructors (Safari). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;
/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root = freeGlobal || freeSelf || Function('return this')();
/**
* Gets the value at `key` of `object`.
*
* @private
* @param {Object} [object] The object to query.
* @param {string} key The key of the property to get.
* @returns {*} Returns the property value.
*/
function getValue(object, key) {
return object == null ? undefined : object[key];
}
/**
* Checks if `value` is a host object in IE < 9.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a host object, else `false`.
*/
function isHostObject(value) {
// Many host objects are `Object` objects that can coerce to strings
// despite having improperly defined `toString` methods.
var result = false;
if (value != null && typeof value.toString != 'function') {
try {
result = !!(value + '');
} catch (e) {}
}
return result;
}
/** Used for built-in method references. */
var arrayProto = Array.prototype,
funcProto = Function.prototype,
objectProto = Object.prototype;
/** Used to detect overreaching core-js shims. */
var coreJsData = root['__core-js_shared__'];
/** Used to detect methods masquerading as native. */
var maskSrcKey = (function() {
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
return uid ? ('Symbol(src)_1.' + uid) : '';
}());
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/** Used to detect if a method is native. */
var reIsNative = RegExp('^' +
funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
);
/** Built-in value references. */
var Symbol = root.Symbol,
splice = arrayProto.splice;
/* Built-in method references that are verified to be native. */
var Map = getNative(root, 'Map'),
nativeCreate = getNative(Object, 'create');
/** Used to convert symbols to primitives and strings. */
var symbolProto = Symbol ? Symbol.prototype : undefined,
symbolToString = symbolProto ? symbolProto.toString : undefined;
/**
* Creates a hash object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Hash(entries) {
var index = -1,
length = entries ? entries.length : 0;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
/**
* Removes all key-value entries from the hash.
*
* @private
* @name clear
* @memberOf Hash
*/
function hashClear() {
this.__data__ = nativeCreate ? nativeCreate(null) : {};
}
/**
* Removes `key` and its value from the hash.
*
* @private
* @name delete
* @memberOf Hash
* @param {Object} hash The hash to modify.
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function hashDelete(key) {
return this.has(key) && delete this.__data__[key];
}
/**
* Gets the hash value for `key`.
*
* @private
* @name get
* @memberOf Hash
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function hashGet(key) {
var data = this.__data__;
if (nativeCreate) {
var result = data[key];
return result === HASH_UNDEFINED ? undefined : result;
}
return hasOwnProperty.call(data, key) ? data[key] : undefined;
}
/**
* Checks if a hash value for `key` exists.
*
* @private
* @name has
* @memberOf Hash
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function hashHas(key) {
var data = this.__data__;
return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
}
/**
* Sets the hash `key` to `value`.
*
* @private
* @name set
* @memberOf Hash
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the hash instance.
*/
function hashSet(key, value) {
var data = this.__data__;
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
return this;
}
// Add methods to `Hash`.
Hash.prototype.clear = hashClear;
Hash.prototype['delete'] = hashDelete;
Hash.prototype.get = hashGet;
Hash.prototype.has = hashHas;
Hash.prototype.set = hashSet;
/**
* Creates an list cache object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function ListCache(entries) {
var index = -1,
length = entries ? entries.length : 0;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
/**
* Removes all key-value entries from the list cache.
*
* @private
* @name clear
* @memberOf ListCache
*/
function listCacheClear() {
this.__data__ = [];
}
/**
* Removes `key` and its value from the list cache.
*
* @private
* @name delete
* @memberOf ListCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function listCacheDelete(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
if (index < 0) {
return false;
}
var lastIndex = data.length - 1;
if (index == lastIndex) {
data.pop();
} else {
splice.call(data, index, 1);
}
return true;
}
/**
* Gets the list cache value for `key`.
*
* @private
* @name get
* @memberOf ListCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function listCacheGet(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
return index < 0 ? undefined : data[index][1];
}
/**
* Checks if a list cache value for `key` exists.
*
* @private
* @name has
* @memberOf ListCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function listCacheHas(key) {
return assocIndexOf(this.__data__, key) > -1;
}
/**
* Sets the list cache `key` to `value`.
*
* @private
* @name set
* @memberOf ListCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the list cache instance.
*/
function listCacheSet(key, value) {
var data = this.__data__,
index = assocIndexOf(data, key);
if (index < 0) {
data.push([key, value]);
} else {
data[index][1] = value;
}
return this;
}
// Add methods to `ListCache`.
ListCache.prototype.clear = listCacheClear;
ListCache.prototype['delete'] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;
/**
* Creates a map cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function MapCache(entries) {
var index = -1,
length = entries ? entries.length : 0;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
/**
* Removes all key-value entries from the map.
*
* @private
* @name clear
* @memberOf MapCache
*/
function mapCacheClear() {
this.__data__ = {
'hash': new Hash,
'map': new (Map || ListCache),
'string': new Hash
};
}
/**
* Removes `key` and its value from the map.
*
* @private
* @name delete
* @memberOf MapCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function mapCacheDelete(key) {
return getMapData(this, key)['delete'](key);
}
/**
* Gets the map value for `key`.
*
* @private
* @name get
* @memberOf MapCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function mapCacheGet(key) {
return getMapData(this, key).get(key);
}
/**
* Checks if a map value for `key` exists.
*
* @private
* @name has
* @memberOf MapCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function mapCacheHas(key) {
return getMapData(this, key).has(key);
}
/**
* Sets the map `key` to `value`.
*
* @private
* @name set
* @memberOf MapCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the map cache instance.
*/
function mapCacheSet(key, value) {
getMapData(this, key).set(key, value);
return this;
}
// Add methods to `MapCache`.
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype['delete'] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;
/**
* Gets the index at which the `key` is found in `array` of key-value pairs.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} key The key to search for.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function assocIndexOf(array, key) {
var length = array.length;
while (length--) {
if (eq(array[length][0], key)) {
return length;
}
}
return -1;
}
/**
* The base implementation of `_.get` without support for default values.
*
* @private
* @param {Object} object The object to query.
* @param {Array|string} path The path of the property to get.
* @returns {*} Returns the resolved value.
*/
function baseGet(object, path) {
path = isKey(path, object) ? [path] : castPath(path);
var index = 0,
length = path.length;
while (object != null && index < length) {
object = object[toKey(path[index++])];
}
return (index && index == length) ? object : undefined;
}
/**
* The base implementation of `_.isNative` without bad shim checks.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a native function,
* else `false`.
*/
function baseIsNative(value) {
if (!isObject(value) || isMasked(value)) {
return false;
}
var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
return pattern.test(toSource(value));
}
/**
* The base implementation of `_.toString` which doesn't convert nullish
* values to empty strings.
*
* @private
* @param {*} value The value to process.
* @returns {string} Returns the string.
*/
function baseToString(value) {
// Exit early for strings to avoid a performance hit in some environments.
if (typeof value == 'string') {
return value;
}
if (isSymbol(value)) {
return symbolToString ? symbolToString.call(value) : '';
}
var result = (value + '');
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
}
/**
* Casts `value` to a path array if it's not one.
*
* @private
* @param {*} value The value to inspect.
* @returns {Array} Returns the cast property path array.
*/
function castPath(value) {
return isArray(value) ? value : stringToPath(value);
}
/**
* Gets the data for `map`.
*
* @private
* @param {Object} map The map to query.
* @param {string} key The reference key.
* @returns {*} Returns the map data.
*/
function getMapData(map, key) {
var data = map.__data__;
return isKeyable(key)
? data[typeof key == 'string' ? 'string' : 'hash']
: data.map;
}
/**
* Gets the native function at `key` of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {string} key The key of the method to get.
* @returns {*} Returns the function if it's native, else `undefined`.
*/
function getNative(object, key) {
var value = getValue(object, key);
return baseIsNative(value) ? value : undefined;
}
/**
* Checks if `value` is a property name and not a property path.
*
* @private
* @param {*} value The value to check.
* @param {Object} [object] The object to query keys on.
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
*/
function isKey(value, object) {
if (isArray(value)) {
return false;
}
var type = typeof value;
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
value == null || isSymbol(value)) {
return true;
}
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
(object != null && value in Object(object));
}
/**
* Checks if `value` is suitable for use as unique object key.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
*/
function isKeyable(value) {
var type = typeof value;
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
? (value !== '__proto__')
: (value === null);
}
/**
* Checks if `func` has its source masked.
*
* @private
* @param {Function} func The function to check.
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
*/
function isMasked(func) {
return !!maskSrcKey && (maskSrcKey in func);
}
/**
* Converts `string` to a property path array.
*
* @private
* @param {string} string The string to convert.
* @returns {Array} Returns the property path array.
*/
var stringToPath = memoize(function(string) {
string = toString(string);
var result = [];
if (reLeadingDot.test(string)) {
result.push('');
}
string.replace(rePropName, function(match, number, quote, string) {
result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
});
return result;
});
/**
* Converts `value` to a string key if it's not a string or symbol.
*
* @private
* @param {*} value The value to inspect.
* @returns {string|symbol} Returns the key.
*/
function toKey(value) {
if (typeof value == 'string' || isSymbol(value)) {
return value;
}
var result = (value + '');
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
}
/**
* Converts `func` to its source code.
*
* @private
* @param {Function} func The function to process.
* @returns {string} Returns the source code.
*/
function toSource(func) {
if (func != null) {
try {
return funcToString.call(func);
} catch (e) {}
try {
return (func + '');
} catch (e) {}
}
return '';
}
/**
* Creates a function that memoizes the result of `func`. If `resolver` is
* provided, it determines the cache key for storing the result based on the
* arguments provided to the memoized function. By default, the first argument
* provided to the memoized function is used as the map cache key. The `func`
* is invoked with the `this` binding of the memoized function.
*
* **Note:** The cache is exposed as the `cache` property on the memoized
* function. Its creation may be customized by replacing the `_.memoize.Cache`
* constructor with one whose instances implement the
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
* method interface of `delete`, `get`, `has`, and `set`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Function
* @param {Function} func The function to have its output memoized.
* @param {Function} [resolver] The function to resolve the cache key.
* @returns {Function} Returns the new memoized function.
* @example
*
* var object = { 'a': 1, 'b': 2 };
* var other = { 'c': 3, 'd': 4 };
*
* var values = _.memoize(_.values);
* values(object);
* // => [1, 2]
*
* values(other);
* // => [3, 4]
*
* object.a = 2;
* values(object);
* // => [1, 2]
*
* // Modify the result cache.
* values.cache.set(object, ['a', 'b']);
* values(object);
* // => ['a', 'b']
*
* // Replace `_.memoize.Cache`.
* _.memoize.Cache = WeakMap;
*/
function memoize(func, resolver) {
if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
throw new TypeError(FUNC_ERROR_TEXT);
}
var memoized = function() {
var args = arguments,
key = resolver ? resolver.apply(this, args) : args[0],
cache = memoized.cache;
if (cache.has(key)) {
return cache.get(key);
}
var result = func.apply(this, args);
memoized.cache = cache.set(key, result);
return result;
};
memoized.cache = new (memoize.Cache || MapCache);
return memoized;
}
// Assign cache to `_.memoize`.
memoize.Cache = MapCache;
/**
* Performs a
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* comparison between two values to determine if they are equivalent.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* var object = { 'a': 1 };
* var other = { 'a': 1 };
*
* _.eq(object, object);
* // => true
*
* _.eq(object, other);
* // => false
*
* _.eq('a', 'a');
* // => true
*
* _.eq('a', Object('a'));
* // => false
*
* _.eq(NaN, NaN);
* // => true
*/
function eq(value, other) {
return value === other || (value !== value && other !== other);
}
/**
* Checks if `value` is classified as an `Array` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
* @example
*
* _.isArray([1, 2, 3]);
* // => true
*
* _.isArray(document.body.children);
* // => false
*
* _.isArray('abc');
* // => false
*
* _.isArray(_.noop);
* // => false
*/
var isArray = Array.isArray;
/**
* Checks if `value` is classified as a `Function` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
* @example
*
* _.isFunction(_);
* // => true
*
* _.isFunction(/abc/);
* // => false
*/
function isFunction(value) {
// The use of `Object#toString` avoids issues with the `typeof` operator
// in Safari 8-9 which returns 'object' for typed array and other constructors.
var tag = isObject(value) ? objectToString.call(value) : '';
return tag == funcTag || tag == genTag;
}
/**
* Checks if `value` is the
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(_.noop);
* // => true
*
* _.isObject(null);
* // => false
*/
function isObject(value) {
var type = typeof value;
return !!value && (type == 'object' || type == 'function');
}
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike(value) {
return !!value && typeof value == 'object';
}
/**
* Checks if `value` is classified as a `Symbol` primitive or object.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
* @example
*
* _.isSymbol(Symbol.iterator);
* // => true
*
* _.isSymbol('abc');
* // => false
*/
function isSymbol(value) {
return typeof value == 'symbol' ||
(isObjectLike(value) && objectToString.call(value) == symbolTag);
}
/**
* Converts `value` to a string. An empty string is returned for `null`
* and `undefined` values. The sign of `-0` is preserved.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to process.
* @returns {string} Returns the string.
* @example
*
* _.toString(null);
* // => ''
*
* _.toString(-0);
* // => '-0'
*
* _.toString([1, 2, 3]);
* // => '1,2,3'
*/
function toString(value) {
return value == null ? '' : baseToString(value);
}
/**
* Gets the value at `path` of `object`. If the resolved value is
* `undefined`, the `defaultValue` is returned in its place.
*
* @static
* @memberOf _
* @since 3.7.0
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path of the property to get.
* @param {*} [defaultValue] The value returned for `undefined` resolved values.
* @returns {*} Returns the resolved value.
* @example
*
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
*
* _.get(object, 'a[0].b.c');
* // => 3
*
* _.get(object, ['a', '0', 'b', 'c']);
* // => 3
*
* _.get(object, 'a.b.c', 'default');
* // => 'default'
*/
function get(object, path, defaultValue) {
var result = object == null ? undefined : baseGet(object, path);
return result === undefined ? defaultValue : result;
}
module.exports = get;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
/***/ }),
/* 24 */
/***/ (function(module, exports) {
ace.define("ace/split",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/editor","ace/virtual_renderer","ace/edit_session"], function(acequire, exports, module) {
"use strict";
var oop = acequire("./lib/oop");
var lang = acequire("./lib/lang");
var EventEmitter = acequire("./lib/event_emitter").EventEmitter;
var Editor = acequire("./editor").Editor;
var Renderer = acequire("./virtual_renderer").VirtualRenderer;
var EditSession = acequire("./edit_session").EditSession;
var Split = function(container, theme, splits) {
this.BELOW = 1;
this.BESIDE = 0;
this.$container = container;
this.$theme = theme;
this.$splits = 0;
this.$editorCSS = "";
this.$editors = [];
this.$orientation = this.BESIDE;
this.setSplits(splits || 1);
this.$cEditor = this.$editors[0];
this.on("focus", function(editor) {
this.$cEditor = editor;
}.bind(this));
};
(function(){
oop.implement(this, EventEmitter);
this.$createEditor = function() {
var el = document.createElement("div");
el.className = this.$editorCSS;
el.style.cssText = "position: absolute; top:0px; bottom:0px";
this.$container.appendChild(el);
var editor = new Editor(new Renderer(el, this.$theme));
editor.on("focus", function() {
this._emit("focus", editor);
}.bind(this));
this.$editors.push(editor);
editor.setFontSize(this.$fontSize);
return editor;
};
this.setSplits = function(splits) {
var editor;
if (splits < 1) {
throw "The number of splits have to be > 0!";
}
if (splits == this.$splits) {
return;
} else if (splits > this.$splits) {
while (this.$splits < this.$editors.length && this.$splits < splits) {
editor = this.$editors[this.$splits];
this.$container.appendChild(editor.container);
editor.setFontSize(this.$fontSize);
this.$splits ++;
}
while (this.$splits < splits) {
this.$createEditor();
this.$splits ++;
}
} else {
while (this.$splits > splits) {
editor = this.$editors[this.$splits - 1];
this.$container.removeChild(editor.container);
this.$splits --;
}
}
this.resize();
};
this.getSplits = function() {
return this.$splits;
};
this.getEditor = function(idx) {
return this.$editors[idx];
};
this.getCurrentEditor = function() {
return this.$cEditor;
};
this.focus = function() {
this.$cEditor.focus();
};
this.blur = function() {
this.$cEditor.blur();
};
this.setTheme = function(theme) {
this.$editors.forEach(function(editor) {
editor.setTheme(theme);
});
};
this.setKeyboardHandler = function(keybinding) {
this.$editors.forEach(function(editor) {
editor.setKeyboardHandler(keybinding);
});
};
this.forEach = function(callback, scope) {
this.$editors.forEach(callback, scope);
};
this.$fontSize = "";
this.setFontSize = function(size) {
this.$fontSize = size;
this.forEach(function(editor) {
editor.setFontSize(size);
});
};
this.$cloneSession = function(session) {
var s = new EditSession(session.getDocument(), session.getMode());
var undoManager = session.getUndoManager();
if (undoManager) {
var undoManagerProxy = new UndoManagerProxy(undoManager, s);
s.setUndoManager(undoManagerProxy);
}
s.$informUndoManager = lang.delayedCall(function() { s.$deltas = []; });
s.setTabSize(session.getTabSize());
s.setUseSoftTabs(session.getUseSoftTabs());
s.setOverwrite(session.getOverwrite());
s.setBreakpoints(session.getBreakpoints());
s.setUseWrapMode(session.getUseWrapMode());
s.setUseWorker(session.getUseWorker());
s.setWrapLimitRange(session.$wrapLimitRange.min,
session.$wrapLimitRange.max);
s.$foldData = session.$cloneFoldData();
return s;
};
this.setSession = function(session, idx) {
var editor;
if (idx == null) {
editor = this.$cEditor;
} else {
editor = this.$editors[idx];
}
var isUsed = this.$editors.some(function(editor) {
return editor.session === session;
});
if (isUsed) {
session = this.$cloneSession(session);
}
editor.setSession(session);
return session;
};
this.getOrientation = function() {
return this.$orientation;
};
this.setOrientation = function(orientation) {
if (this.$orientation == orientation) {
return;
}
this.$orientation = orientation;
this.resize();
};
this.resize = function() {
var width = this.$container.clientWidth;
var height = this.$container.clientHeight;
var editor;
if (this.$orientation == this.BESIDE) {
var editorWidth = width / this.$splits;
for (var i = 0; i < this.$splits; i++) {
editor = this.$editors[i];
editor.container.style.width = editorWidth + "px";
editor.container.style.top = "0px";
editor.container.style.left = i * editorWidth + "px";
editor.container.style.height = height + "px";
editor.resize();
}
} else {
var editorHeight = height / this.$splits;
for (var i = 0; i < this.$splits; i++) {
editor = this.$editors[i];
editor.container.style.width = width + "px";
editor.container.style.top = i * editorHeight + "px";
editor.container.style.left = "0px";
editor.container.style.height = editorHeight + "px";
editor.resize();
}
}
};
}).call(Split.prototype);
function UndoManagerProxy(undoManager, session) {
this.$u = undoManager;
this.$doc = session;
}
(function() {
this.execute = function(options) {
this.$u.execute(options);
};
this.undo = function() {
var selectionRange = this.$u.undo(true);
if (selectionRange) {
this.$doc.selection.setSelectionRange(selectionRange);
}
};
this.redo = function() {
var selectionRange = this.$u.redo(true);
if (selectionRange) {
this.$doc.selection.setSelectionRange(selectionRange);
}
};
this.reset = function() {
this.$u.reset();
};
this.hasUndo = function() {
return this.$u.hasUndo();
};
this.hasRedo = function() {
return this.$u.hasRedo();
};
}).call(UndoManagerProxy.prototype);
exports.Split = Split;
});
ace.define("ace/ext/split",["require","exports","module","ace/split"], function(acequire, exports, module) {
"use strict";
module.exports = acequire("../split");
});
(function() {
ace.acequire(["ace/ext/split"], function() {});
})();
/***/ })
/******/ ]);
});
|
src/parser/priest/holy/modules/talents/30/Perseverance.js
|
fyruna/WoWAnalyzer
|
import React from 'react';
import SPELLS from 'common/SPELLS/index';
import Analyzer from 'parser/core/Analyzer';
import TalentStatisticBox, { STATISTIC_ORDER } from 'interface/others/TalentStatisticBox';
import ItemHealingDone from 'interface/others/ItemHealingDone';
import { formatPercentage, formatThousands } from 'common/format';
// Example Log: /report/aBxvzDZJQP7431Nt/21-Normal+G'huun+-+Kill+(7:11)/15-Liarine
class Perseverance extends Analyzer {
totalDamageReduced = 0;
perseveranceActive = false;
constructor(...args) {
super(...args);
this.active = this.selectedCombatant.hasTalent(SPELLS.PERSEVERANCE_TALENT.id);
}
get uptime() {
return this.selectedCombatant.getBuffUptime(SPELLS.RENEW.id) / this.owner.fightDuration;
}
on_byPlayer_applybuff(event) {
const spellId = event.ability.guid;
if (spellId === SPELLS.RENEW.id && event.targetID === this.selectedCombatant._combatantInfo.sourceID) {
this.perseveranceActive = true;
}
}
on_byPlayer_removebuff(event) {
const spellId = event.ability.guid;
if (spellId === SPELLS.RENEW.id && event.targetID === this.selectedCombatant._combatantInfo.sourceID) {
this.perseveranceActive = false;
}
}
on_toPlayer_damage(event) {
if (this.perseveranceActive) {
this.totalDamageReduced += event.amount * .1;
}
}
statistic() {
return (
<TalentStatisticBox
talent={SPELLS.PERSEVERANCE_TALENT.id}
value={<ItemHealingDone amount={this.totalDamageReduced} />}
tooltip={(
<>
Perseverance Uptime: {formatPercentage(this.uptime)}%<br />
Damage Reduced: {formatThousands(this.totalDamageReduced)}
</>
)}
position={STATISTIC_ORDER.CORE(2)}
/>
);
}
}
export default Perseverance;
|
__tests__/index.android.js
|
Mrsunsunshine/wetland
|
import 'react-native';
import React from 'react';
import Index from '../index.android.js';
// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';
it('renders correctly', () => {
const tree = renderer.create(
<Index />
);
});
|
frontend/src/Movie/Index/Table/MovieIndexTable.js
|
geogolem/Radarr
|
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import VirtualTable from 'Components/Table/VirtualTable';
import VirtualTableRow from 'Components/Table/VirtualTableRow';
import { sortDirections } from 'Helpers/Props';
import MovieIndexItemConnector from 'Movie/Index/MovieIndexItemConnector';
import getIndexOfFirstCharacter from 'Utilities/Array/getIndexOfFirstCharacter';
import MovieIndexHeaderConnector from './MovieIndexHeaderConnector';
import MovieIndexRow from './MovieIndexRow';
import styles from './MovieIndexTable.css';
class MovieIndexTable extends Component {
//
// Lifecycle
constructor(props, context) {
super(props, context);
this.state = {
scrollIndex: null
};
}
componentDidUpdate(prevProps) {
const {
items,
jumpToCharacter
} = this.props;
if (jumpToCharacter != null && jumpToCharacter !== prevProps.jumpToCharacter) {
const scrollIndex = getIndexOfFirstCharacter(items, jumpToCharacter);
if (scrollIndex != null) {
this.setState({ scrollIndex });
}
} else if (jumpToCharacter == null && prevProps.jumpToCharacter != null) {
this.setState({ scrollIndex: null });
}
}
//
// Control
rowRenderer = ({ key, rowIndex, style }) => {
const {
items,
columns,
selectedState,
onSelectedChange,
isMovieEditorActive,
movieRuntimeFormat
} = this.props;
const movie = items[rowIndex];
return (
<VirtualTableRow
key={key}
style={style}
>
<MovieIndexItemConnector
key={movie.id}
component={MovieIndexRow}
columns={columns}
movieId={movie.id}
qualityProfileId={movie.qualityProfileId}
isSelected={selectedState[movie.id]}
onSelectedChange={onSelectedChange}
isMovieEditorActive={isMovieEditorActive}
movieRuntimeFormat={movieRuntimeFormat}
/>
</VirtualTableRow>
);
}
//
// Render
render() {
const {
items,
columns,
sortKey,
sortDirection,
isSmallScreen,
onSortPress,
scroller,
scrollTop,
allSelected,
allUnselected,
onSelectAllChange,
isMovieEditorActive,
selectedState
} = this.props;
return (
<VirtualTable
className={styles.tableContainer}
items={items}
scrollIndex={this.state.scrollIndex}
isSmallScreen={isSmallScreen}
scrollTop={scrollTop}
scroller={scroller}
rowHeight={38}
overscanRowCount={2}
rowRenderer={this.rowRenderer}
header={
<MovieIndexHeaderConnector
columns={columns}
sortKey={sortKey}
sortDirection={sortDirection}
onSortPress={onSortPress}
allSelected={allSelected}
allUnselected={allUnselected}
onSelectAllChange={onSelectAllChange}
isMovieEditorActive={isMovieEditorActive}
/>
}
selectedState={selectedState}
columns={columns}
/>
);
}
}
MovieIndexTable.propTypes = {
items: PropTypes.arrayOf(PropTypes.object).isRequired,
columns: PropTypes.arrayOf(PropTypes.object).isRequired,
sortKey: PropTypes.string,
sortDirection: PropTypes.oneOf(sortDirections.all),
jumpToCharacter: PropTypes.string,
isSmallScreen: PropTypes.bool.isRequired,
scrollTop: PropTypes.number,
scroller: PropTypes.instanceOf(Element).isRequired,
onSortPress: PropTypes.func.isRequired,
allSelected: PropTypes.bool.isRequired,
allUnselected: PropTypes.bool.isRequired,
selectedState: PropTypes.object.isRequired,
onSelectedChange: PropTypes.func.isRequired,
onSelectAllChange: PropTypes.func.isRequired,
isMovieEditorActive: PropTypes.bool.isRequired,
movieRuntimeFormat: PropTypes.string.isRequired
};
export default MovieIndexTable;
|
app/common/components/ToolbarTitle/index.js
|
cerebral/cerebral-reference-app
|
import React from 'react';
import styles from './styles.css';
function ToolbarTitle(props) {
return (
<span className={styles.title}>
{props.title}
</span>
);
}
export default ToolbarTitle;
|
lib/components/WeatherHourly/WeatherHourly.js
|
the-oem/weathrly
|
import React, { Component } from 'react';
import WeatherCard from '../WeatherCard/WeatherCard';
import './WeatherHourly.css';
const WeatherHourly = ({ hourly }) => {
hourly.splice(7);
return (
<div className='weather-hourly'>
{ hourly.map((hour, i) => <WeatherCard key={i} data={hour} />) }
</div>
);
};
export default WeatherHourly;
|
src/components/Chats.js
|
phoenixbox/react-redux-router-webpackhot
|
import React from 'react'
export default function Chats() {
return <div>I am Chats!</div>
}
|
src/screens/Admin/screens/Bookshelf/screens/AddBook/components/AddBookForm.js
|
nadavspi/react-bookshelf
|
import React from 'react';
import slug from 'slug';
import { connect } from 'react-redux';
import { addBook } from 'actions/BookActions';
// TODO: Move redux stuff up to parent so this can be dumb
const AddBookForm = React.createClass({
propTypes: {
dispatch: React.PropTypes.func.isRequired
},
getInitialState () {
return {
title: '',
author: ''
};
},
handleChange (field, event) {
const { value } = event.target;
this.setState({
[field]: value
});
},
handleSubmit (event) {
// will need some validation
event.preventDefault();
const data = {
id: slug(this.state.title, { lower: true }),
...this.state
};
this.props.dispatch(addBook(data));
},
renderErrorMessage() {
if (!this.props.errorMessage) {
return null;
}
return (
<h2 className="error">Error: {this.props.errorMessage}</h2>
);
},
render () {
const { title, author } = this.state;
return (
<form onSubmit={this.handleSubmit}>
{this.renderErrorMessage()}
<fieldset>
<legend>Book info</legend>
<div>
<label htmlFor="title">Title</label>
<input
id="title"
name="title"
type="text"
value={title}
required
onChange={this.handleChange.bind(this, 'title')}
/>
</div>
<div>
<label htmlFor="author">Author</label>
<input
id="author"
name="author"
type="text"
value={author}
required
onChange={this.handleChange.bind(this, 'author')}
/>
</div>
</fieldset>
<input type="submit" value="Save"/>
</form>
);
}
});
function mapStateToProps(state) {
return {
errorMessage: state.errorMessage
};
}
export default connect(mapStateToProps)(AddBookForm);
|
src/modules/__specs__/AppView.spec.js
|
justinhaaheim/empower-app
|
/* eslint-disable max-nested-callbacks*/
import React from 'react';
import { shallow } from 'enzyme';
import { ActivityIndicator } from 'react-native';
import AppView from '../AppView';
describe('<AppView />', () => {
describe('isReady', () => {
it('should render a <ActivityIndicator /> if not ready', () => {
const fn = () => {};
const wrapper = shallow(<AppView isReady={false} isLoggedIn={false} dispatch={fn} />);
expect(wrapper.find(ActivityIndicator).length).toBe(1);
});
it('should not render a <ActivityIndicator /> if ready', () => {
const fn = () => {};
const wrapper = shallow(<AppView isReady isLoggedIn={false} dispatch={fn} />);
expect(wrapper.find(ActivityIndicator).length).toBe(0);
});
});
});
|
packages/react-scripts/fixtures/kitchensink/src/features/syntax/ClassProperties.js
|
sThig/jabbascrypt
|
/**
* 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.
*/
import React, { Component } from 'react';
import PropTypes from 'prop-types';
export default class extends Component {
static propTypes = {
onReady: PropTypes.func.isRequired,
};
users = [
{ id: 1, name: '1' },
{ id: 2, name: '2' },
{ id: 3, name: '3' },
{ id: 4, name: '4' },
];
componentDidMount() {
this.props.onReady();
}
render() {
return (
<div id="feature-class-properties">
{this.users.map(user => <div key={user.id}>{user.name}</div>)}
</div>
);
}
}
|
test/performance/comparisons/jquery-latest.js
|
marshall007/rethinkdb
|
/*! 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);
|
examples/00 Chessboard/Tutorial App/index.js
|
globexdesigns/react-dnd
|
import React, { Component } from 'react';
import Board from './Board';
import { observe } from './Game';
/**
* Unlike the tutorial, export a component so it can be used on the website.
*/
export default class ChessboardTutorialApp extends Component {
constructor(props) {
super(props);
this.unobserve = observe(this.handleChange.bind(this));
}
handleChange(knightPosition) {
const nextState = { knightPosition };
if (this.state) {
this.setState(nextState);
} else {
this.state = nextState;
}
}
componentWillUnmount() {
this.unobserve();
}
render() {
const { knightPosition } = this.state;
return (
<div>
<p>
<b><a href='https://github.com/gaearon/react-dnd/tree/master/examples/00%20Chessboard/Tutorial%20App'>Browse the Source</a></b>
</p>
<p>
This is a sample app you'll build as you work through the <a href='docs-tutorial.html'>tutorial</a>.
</p>
<p>
It illustrates creating the drag sources and the drop targets, using the monitors to query the current drag state, and customizing the drag previews.
</p>
<div style={{
width: 500,
height: 500,
border: '1px solid gray'
}}>
<Board knightPosition={knightPosition} />
</div>
<p>
Make sure to check out the <a href='docs-tutorial.html'>tutorial</a> for step-by-step instructions on building it!
</p>
</div>
);
}
}
|
src/error/NoPageFound.js
|
deibeljc/react-talk
|
import React from 'react';
import './NoPageFound.scss';
export default class NoPageFound extends React.Component {
render() {
return (
<div className="no-page">
<h1>
No Page Found.
</h1>
Instead try one of these demos!
<ul className="example-list">
<li><a href="/basic">Basic Components</a></li>
<li><a href="/todo">Simple Todo App</a></li>
<li><a href="/chat">Real Time Chat App</a></li>
</ul>
</div>
);
}
}
|
Client/Trunk/js/search-form.js
|
joe62/swzql
|
import React from 'react';
class SearchForm extends React.Component{
static propTypes = {
searchAction: React.PropTypes.func.isRequired
};
handleChange = event =>{
this.props.searchAction(event.target.value);
};
render(){
return (
<form className="navbar-form" role="search">
<input type="text" className="form-control"
placeholder="搜索..."
onChange={this.handleChange} />
</form>
)
}
}
export default SearchForm;
|
app/screens/settings/notification_settings_mentions/notification_settings_mentions.android.js
|
mattermost/mattermost-mobile
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React from 'react';
import {injectIntl} from 'react-intl';
import {
Modal,
ScrollView,
Text,
TouchableOpacity,
View,
} from 'react-native';
import FormattedText from '@components/formatted_text';
import RadioButtonGroup from '@components/radio_button';
import StatusBar from '@components/status_bar';
import TextInputWithLocalizedPlaceholder from '@components/text_input_with_localized_placeholder';
import SectionItem from '@screens/settings/section_item';
import {t} from '@utils/i18n';
import {
changeOpacity,
makeStyleSheetFromTheme,
getKeyboardAppearanceFromTheme,
} from '@utils/theme';
import NotificationSettingsMentionsBase from './notification_settings_mention_base';
class NotificationSettingsMentionsAndroid extends NotificationSettingsMentionsBase {
cancelMentionKeys = () => {
this.setState({
androidKeywords: this.state.mention_keys,
showKeywordsModal: false,
});
};
cancelReplyNotification = () => {
this.setState({
newReplyValue: this.state.comments,
showReplyModal: false,
});
};
onKeywordsChangeText = (androidKeywords) => {
this.setState({androidKeywords});
};
onReplyChanged = (value) => {
this.setState({newReplyValue: value});
};
renderKeywordsModal(style) {
const {theme} = this.props;
return (
<Modal
animationType='slide'
transparent={true}
visible={this.state.showKeywordsModal}
onRequestClose={this.cancelMentionKeys}
>
<View style={style.modalOverlay}>
<View style={style.modal}>
<View style={style.modalBody}>
<View style={style.modalTitleContainer}>
<FormattedText
id='mobile.notification_settings_mentions.keywords'
defaultMessage='Keywords'
style={style.modalTitle}
/>
</View>
<TextInputWithLocalizedPlaceholder
allowFontScaling={true}
autoFocus={true}
value={this.state.androidKeywords}
blurOnSubmit={true}
onChangeText={this.onKeywordsChangeText}
onSubmitEditing={this.saveMentionKeys}
multiline={false}
style={style.input}
autoCapitalize='none'
autoCorrect={false}
placeholder={{id: 'mobile.notification_settings_mentions.keywordsDescription', defaultMessage: 'Other words that trigger a mention'}}
placeholderTextColor={changeOpacity(theme.centerChannelColor, 0.4)}
returnKeyType='done'
returnKeyLabel={this.props.intl.formatMessage({id: 'mobile.notification_settings.modal_save'})}
underlineColorAndroid={theme.linkColor}
keyboardAppearance={getKeyboardAppearanceFromTheme(theme)}
/>
<FormattedText
id='mobile.notification_settings_mentions.keywordsHelp'
defaultMessage='Keywords are non-case sensitive and should be separated by a comma.'
style={style.modalHelpText}
/>
</View>
<View style={style.modalFooter}>
<View style={style.separator}/>
<View style={style.modalFooterContainer}>
<TouchableOpacity
style={style.modalFooterOptionContainer}
onPress={this.cancelMentionKeys}
>
<FormattedText
id='mobile.notification_settings.modal_cancel'
defaultMessage='CANCEL'
style={style.modalFooterOption}
/>
</TouchableOpacity>
<View style={{marginRight: 10}}/>
<TouchableOpacity
style={style.modalFooterOptionContainer}
onPress={this.saveMentionKeys}
>
<FormattedText
id='mobile.notification_settings.modal_save'
defaultMessage='SAVE'
style={style.modalFooterOption}
/>
</TouchableOpacity>
</View>
</View>
</View>
</View>
</Modal>
);
}
renderReplyModal(style) {
const {intl} = this.props;
const {newReplyValue} = this.state;
const options = [{
label: intl.formatMessage({
id: 'mobile.account_notifications.threads_start_participate',
defaultMessage: 'Threads that I start or participate in',
}),
value: 'any',
checked: newReplyValue === 'any',
}, {
label: intl.formatMessage({
id: 'mobile.account_notifications.threads_start',
defaultMessage: 'Threads that I start',
}),
value: 'root',
checked: newReplyValue === 'root',
}, {
label: intl.formatMessage({
id: 'mobile.account_notifications.threads_mentions',
defaultMessage: 'Mentions in threads',
}),
value: 'never',
checked: newReplyValue === 'never',
}];
return (
<Modal
animationType='slide'
transparent={true}
visible={this.state.showReplyModal}
onRequestClose={this.cancelReplyNotification}
>
<View style={style.modalOverlay}>
<View style={style.modal}>
<View style={style.modalBody}>
<View style={style.modalTitleContainer}>
<FormattedText
id='mobile.notification_settings.mentions.reply_title'
defaultMessage='Send Reply notifications for'
style={style.modalTitle}
/>
</View>
<RadioButtonGroup
name='replySettings'
onSelect={this.onReplyChanged}
options={options}
/>
</View>
<View style={style.modalFooter}>
<View style={style.separator}/>
<View style={style.modalFooterContainer}>
<TouchableOpacity
style={style.modalFooterOptionContainer}
onPress={this.cancelReplyNotification}
>
<FormattedText
id='mobile.notification_settings.modal_cancel'
defaultMessage='CANCEL'
style={style.modalFooterOption}
/>
</TouchableOpacity>
<View>
<View style={{marginRight: 10}}/>
<TouchableOpacity
style={style.modalFooterOptionContainer}
onPress={this.saveReplyNotification}
>
<FormattedText
id='mobile.notification_settings.modal_save'
defaultMessage='SAVE'
style={style.modalFooterOption}
/>
</TouchableOpacity>
</View>
</View>
</View>
</View>
</View>
</Modal>
);
}
renderReplySection() {
const {theme} = this.props;
let i18nId;
let i18nMessage;
switch (this.state.comments) {
case 'root':
i18nId = t('mobile.account_notifications.threads_start');
i18nMessage = 'Threads that I start';
break;
case 'never':
i18nId = t('mobile.account_notifications.threads_mentions');
i18nMessage = 'Mentions in threads';
break;
case 'any':
default:
i18nId = t('mobile.account_notifications.threads_start_participate');
i18nMessage = 'Threads that I start or participate in';
break;
}
return (
<SectionItem
description={(
<FormattedText
id={i18nId}
defaultMessage={i18nMessage}
/>
)}
label={(
<FormattedText
id='user.settings.notifications.comments'
defaultMessage='Reply notifications'
/>
)}
action={this.showReplyModal}
actionType='default'
theme={theme}
/>
);
}
saveMentionKeys = () => {
this.updateMentionKeys(this.state.androidKeywords);
};
saveReplyNotification = () => {
this.setState({showReplyModal: false});
this.setReplyNotifications(this.state.newReplyValue);
};
showKeywordsModal = () => {
this.setState({showKeywordsModal: true});
};
showReplyModal = () => {
this.setState({showReplyModal: true});
};
render() {
const {currentUser, theme} = this.props;
const style = getStyleSheet(theme);
let mentionKeysComponent;
if (this.state.mention_keys) {
mentionKeysComponent = (<Text>{this.state.mention_keys}</Text>);
} else {
mentionKeysComponent = (
<FormattedText
id='mobile.notification_settings_mentions.keywordsDescription'
defaultMessage='Other words that trigger a mention'
/>
);
}
return (
<View style={style.container}>
<StatusBar/>
<ScrollView
style={style.scrollView}
contentContainerStyle={style.scrollViewContent}
>
{currentUser.first_name?.length > 0 &&
<View>
<SectionItem
label={(
<Text>
{currentUser.first_name}
</Text>
)}
description={(
<FormattedText
id='mobile.notification_settings.mentions.sensitiveName'
defaultMessage='Your case sensitive first name'
/>
)}
action={this.toggleFirstNameMention}
actionType='toggle'
selected={this.state.first_name === 'true'}
theme={theme}
/>
<View style={style.separator}/>
</View>
}
<SectionItem
label={(
<Text>
{currentUser.username}
</Text>
)}
description={(
<FormattedText
id='mobile.notification_settings.mentions.sensitiveUsername'
defaultMessage='Your non-case sensitive username'
/>
)}
selected={this.state.usernameMention}
action={this.toggleUsernameMention}
actionType='toggle'
theme={theme}
/>
<View style={style.separator}/>
<SectionItem
label={(
<Text>
{'@channel, @all, @here'}
</Text>
)}
description={(
<FormattedText
id='mobile.notification_settings.mentions.channelWide'
defaultMessage='Channel-wide mentions'
/>
)}
action={this.toggleChannelMentions}
actionType='toggle'
selected={this.state.channel === 'true'}
theme={theme}
/>
<View style={style.separator}/>
<SectionItem
label={(
<FormattedText
id='mobile.notification_settings_mentions.keywords'
defaultMessage='Keywords'
/>
)}
description={mentionKeysComponent}
action={this.showKeywordsModal}
actionType='default'
theme={theme}
/>
<View style={style.separator}/>
{!this.props.isCollapsedThreadsEnabled && (
<>
{this.renderReplySection()}
<View style={style.separator}/>
</>
)}
</ScrollView>
{this.renderKeywordsModal(style)}
{this.renderReplyModal(style)}
</View>
);
}
}
const getStyleSheet = makeStyleSheetFromTheme((theme) => {
return {
container: {
flex: 1,
},
input: {
color: theme.centerChannelColor,
fontSize: 12,
height: 40,
},
separator: {
backgroundColor: changeOpacity(theme.centerChannelColor, 0.1),
height: 1,
width: '100%',
},
scrollView: {
flex: 1,
backgroundColor: changeOpacity(theme.centerChannelColor, 0.06),
},
scrollViewContent: {
paddingVertical: 0,
},
modalOverlay: {
backgroundColor: changeOpacity('#000000', 0.6),
alignItems: 'center',
flex: 1,
},
modal: {
backgroundColor: theme.centerChannelBg,
borderRadius: 4,
marginTop: 20,
width: '95%',
},
modalBody: {
paddingHorizontal: 24,
},
modalTitleContainer: {
marginBottom: 30,
marginTop: 20,
},
modalTitle: {
color: theme.centerChannelColor,
fontSize: 19,
},
modalOptionDisabled: {
color: changeOpacity(theme.centerChannelColor, 0.5),
fontSize: 17,
},
modalInput: {
color: theme.centerChannelColor,
fontSize: 19,
},
modalHelpText: {
color: changeOpacity(theme.centerChannelColor, 0.5),
fontSize: 13,
marginTop: 20,
},
modalFooter: {
alignItems: 'flex-end',
height: 58,
marginTop: 40,
width: '100%',
},
modalFooterContainer: {
alignItems: 'center',
flex: 1,
flexDirection: 'row',
paddingRight: 24,
},
modalFooterOptionContainer: {
alignItems: 'center',
height: 40,
justifyContent: 'center',
paddingHorizontal: 10,
paddingVertical: 5,
},
modalFooterOption: {
color: theme.linkColor,
fontSize: 14,
},
};
});
export default injectIntl(NotificationSettingsMentionsAndroid);
|
app/javascript/mastodon/features/compose/components/search.js
|
honpya/taketodon
|
import React from 'react';
import PropTypes from 'prop-types';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import Overlay from 'react-overlays/lib/Overlay';
import Motion from '../../ui/util/optional_motion';
import spring from 'react-motion/lib/spring';
import { searchEnabled } from '../../../initial_state';
const messages = defineMessages({
placeholder: { id: 'search.placeholder', defaultMessage: 'Search' },
});
class SearchPopout extends React.PureComponent {
static propTypes = {
style: PropTypes.object,
};
render () {
const { style } = this.props;
const extraInformation = searchEnabled ? <FormattedMessage id='search_popout.tips.full_text' defaultMessage='Simple text returns statuses you have written, favourited, boosted, or have been mentioned in, as well as matching usernames, display names, and hashtags.' /> : <FormattedMessage id='search_popout.tips.text' defaultMessage='Simple text returns matching display names, usernames and hashtags' />;
return (
<div style={{ ...style, position: 'absolute', width: 285 }}>
<Motion defaultStyle={{ opacity: 0, scaleX: 0.85, scaleY: 0.75 }} style={{ opacity: spring(1, { damping: 35, stiffness: 400 }), scaleX: spring(1, { damping: 35, stiffness: 400 }), scaleY: spring(1, { damping: 35, stiffness: 400 }) }}>
{({ opacity, scaleX, scaleY }) => (
<div className='search-popout' style={{ opacity: opacity, transform: `scale(${scaleX}, ${scaleY})` }}>
<h4><FormattedMessage id='search_popout.search_format' defaultMessage='Advanced search format' /></h4>
<ul>
<li><em>#example</em> <FormattedMessage id='search_popout.tips.hashtag' defaultMessage='hashtag' /></li>
<li><em>@username@domain</em> <FormattedMessage id='search_popout.tips.user' defaultMessage='user' /></li>
<li><em>URL</em> <FormattedMessage id='search_popout.tips.user' defaultMessage='user' /></li>
<li><em>URL</em> <FormattedMessage id='search_popout.tips.status' defaultMessage='status' /></li>
</ul>
{extraInformation}
</div>
)}
</Motion>
</div>
);
}
}
@injectIntl
export default class Search extends React.PureComponent {
static propTypes = {
value: PropTypes.string.isRequired,
submitted: PropTypes.bool,
onChange: PropTypes.func.isRequired,
onSubmit: PropTypes.func.isRequired,
onClear: PropTypes.func.isRequired,
onShow: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
};
state = {
expanded: false,
};
handleChange = (e) => {
this.props.onChange(e.target.value);
}
handleClear = (e) => {
e.preventDefault();
if (this.props.value.length > 0 || this.props.submitted) {
this.props.onClear();
}
}
handleKeyDown = (e) => {
if (e.key === 'Enter') {
e.preventDefault();
this.props.onSubmit();
} else if (e.key === 'Escape') {
document.querySelector('.ui').parentElement.focus();
}
}
noop () {
}
handleFocus = () => {
this.setState({ expanded: true });
this.props.onShow();
}
handleBlur = () => {
this.setState({ expanded: false });
}
render () {
const { intl, value, submitted } = this.props;
const { expanded } = this.state;
const hasValue = value.length > 0 || submitted;
return (
<div className='search'>
<label>
<span style={{ display: 'none' }}>{intl.formatMessage(messages.placeholder)}</span>
<input
className='search__input'
type='text'
placeholder={intl.formatMessage(messages.placeholder)}
value={value}
onChange={this.handleChange}
onKeyUp={this.handleKeyDown}
onFocus={this.handleFocus}
onBlur={this.handleBlur}
/>
</label>
<div role='button' tabIndex='0' className='search__icon' onClick={this.handleClear}>
<i className={`fa fa-search ${hasValue ? '' : 'active'}`} />
<i aria-label={intl.formatMessage(messages.placeholder)} className={`fa fa-times-circle ${hasValue ? 'active' : ''}`} />
</div>
<Overlay show={expanded && !hasValue} placement='bottom' target={this}>
<SearchPopout />
</Overlay>
</div>
);
}
}
|
src/svg-icons/action/invert-colors.js
|
pomerantsev/material-ui
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionInvertColors = (props) => (
<SvgIcon {...props}>
<path d="M17.66 7.93L12 2.27 6.34 7.93c-3.12 3.12-3.12 8.19 0 11.31C7.9 20.8 9.95 21.58 12 21.58c2.05 0 4.1-.78 5.66-2.34 3.12-3.12 3.12-8.19 0-11.31zM12 19.59c-1.6 0-3.11-.62-4.24-1.76C6.62 16.69 6 15.19 6 13.59s.62-3.11 1.76-4.24L12 5.1v14.49z"/>
</SvgIcon>
);
ActionInvertColors = pure(ActionInvertColors);
ActionInvertColors.displayName = 'ActionInvertColors';
ActionInvertColors.muiName = 'SvgIcon';
export default ActionInvertColors;
|
src/dumb/buttons/IconButton.js
|
jeckhummer/wf-constructor
|
import React from 'react';
import {Icon, Popup} from "semantic-ui-react";
export class IconButton extends React.Component{
render() {
const icon = (
<Icon
circular
inverted
disabled={this.props.disabled}
name={this.props.name}
link={!this.props.disabled}
color={this.props.color}
onClick={this.props.onClick}
/>
);
return (
<Popup
trigger={icon}
content={this.props.tooltip}
size="tiny"
inverted
/>
);
}
}
|
ajax/libs/extjs/4.2.1/src/data/NodeStore.js
|
crccheck/cdnjs
|
/*
This file is part of Ext JS 4.2
Copyright (c) 2011-2013 Sencha Inc
Contact: http://www.sencha.com/contact
GNU General Public License Usage
This file may be used under the terms of the GNU General Public License version 3.0 as
published by the Free Software Foundation and appearing in the file LICENSE included in the
packaging of this file.
Please review the following information to ensure the GNU General Public License version 3.0
requirements will be met: http://www.gnu.org/copyleft/gpl.html.
If you are unsure which license is appropriate for your use, please contact the sales department
at http://www.sencha.com/contact.
Build date: 2013-05-16 14:36:50 (f9be68accb407158ba2b1be2c226a6ce1f649314)
*/
/**
* Node Store
* @private
*/
Ext.define('Ext.data.NodeStore', {
extend: 'Ext.data.Store',
alias: 'store.node',
requires: ['Ext.data.NodeInterface'],
/**
* @property {Boolean} isNodeStore
* `true` in this class to identify an object as an instantiated NodeStore, or subclass thereof.
*/
isNodeStore: true,
/**
* @cfg {Ext.data.Model} node
* The Record you want to bind this Store to. Note that
* this record will be decorated with the Ext.data.NodeInterface if this is not the
* case yet.
*/
node: null,
/**
* @cfg {Boolean} recursive
* Set this to true if you want this NodeStore to represent
* all the descendents of the node in its flat data collection. This is useful for
* rendering a tree structure to a DataView and is being used internally by
* the TreeView. Any records that are moved, removed, inserted or appended to the
* node at any depth below the node this store is bound to will be automatically
* updated in this Store's internal flat data structure.
*/
recursive: false,
/**
* @cfg {Boolean} rootVisible
* False to not include the root node in this Stores collection.
*/
rootVisible: false,
/**
* @cfg {Ext.data.TreeStore} treeStore
* The TreeStore that is used by this NodeStore's Ext.tree.View.
*/
/**
* @protected
* Recursion level counter. Incremented when expansion or collaping of a node is initiated,
* including when nested nodes below the expanding/collapsing root begin expanding or collapsing.
*
* This ensures that collapsestart, collapsecomplete, expandstart and expandcomplete only
* fire on the top level node being collapsed/expanded.
*
* Also, allows listeners to the `add` and `remove` events to know whether a collapse of expand is in progress.
*/
isExpandingOrCollapsing: 0,
constructor: function(config) {
var me = this,
node;
config = config || {};
Ext.apply(me, config);
//<debug>
if (Ext.isDefined(me.proxy)) {
Ext.Error.raise("A NodeStore cannot be bound to a proxy. Instead bind it to a record " +
"decorated with the NodeInterface by setting the node config.");
}
me.useModelWarning = false;
//</debug>
config.proxy = {type: 'proxy'};
me.callParent([config]);
node = me.node;
if (node) {
me.node = null;
me.setNode(node);
}
},
// NodeStores are never buffered or paged. They are loaded from the TreeStore to reflect all visible
// nodes.
// BufferedRenderer always asks for the *total* count, so this must return the count.
getTotalCount: function() {
return this.getCount();
},
setNode: function(node) {
var me = this;
if (me.node && me.node != node) {
// We want to unbind our listeners on the old node
me.mun(me.node, {
expand: me.onNodeExpand,
collapse: me.onNodeCollapse,
append: me.onNodeAppend,
insert: me.onNodeInsert,
bulkremove: me.onBulkRemove,
remove: me.onNodeRemove,
sort: me.onNodeSort,
scope: me
});
me.node = null;
}
if (node) {
Ext.data.NodeInterface.decorate(node.self);
me.removeAll();
if (me.rootVisible) {
me.add(node);
} else if (!node.isExpanded() && me.treeStore.autoLoad !== false) {
node.expand();
}
me.mon(node, {
expand: me.onNodeExpand,
collapse: me.onNodeCollapse,
append: me.onNodeAppend,
insert: me.onNodeInsert,
bulkremove: me.onBulkRemove,
remove: me.onNodeRemove,
sort: me.onNodeSort,
scope: me
});
me.node = node;
if (node.isExpanded() && node.isLoaded()) {
me.onNodeExpand(node, node.childNodes, true);
}
}
},
onNodeSort: function(node, childNodes) {
var me = this;
if ((me.indexOf(node) !== -1 || (node === me.node && !me.rootVisible) && node.isExpanded())) {
Ext.suspendLayouts();
me.onNodeCollapse(node, childNodes, true);
me.onNodeExpand(node, childNodes, true);
Ext.resumeLayouts(true);
}
},
// Triggered by a NodeInterface's bubbled "expand" event.
onNodeExpand: function(parent, records, suppressEvent) {
var me = this,
insertIndex = me.indexOf(parent) + 1,
toAdd = [];
// Used by the TreeView to bracket recursive expand & collapse ops
// and refresh the size. This is most effective when folder nodes are loaded,
// and this method is able to recurse.
if (!suppressEvent) {
me.fireEvent('beforeexpand', parent, records, insertIndex);
}
me.handleNodeExpand(parent, records, toAdd);
// The add event from this insertion is handled by TreeView.onAdd.
// That implementation calls parent and then ensures the previous sibling's joining lines are correct.
// The datachanged event is relayed by the TreeStore. Internally, that's not used.
me.insert(insertIndex, toAdd);
// Triggers the TreeView's onExpand method which calls refreshSize,
// and fires its afteritemexpand event
if (!suppressEvent) {
me.fireEvent('expand', parent, records);
}
},
// Collects child nodes to remove into the passed toRemove array.
// When available, all descendant nodes are pushed into that array using recursion.
handleNodeExpand: function(parent, records, toAdd) {
var me = this,
ln = records ? records.length : 0,
i, record;
// recursive is hardcoded to true in TreeView.
if (!me.recursive && parent !== me.node) {
return;
}
if (parent !== this.node && !me.isVisible(parent)) {
return;
}
if (ln) {
// The view items corresponding to these are rendered.
// Loop through and expand any of the non-leaf nodes which are expanded
for (i = 0; i < ln; i++) {
record = records[i];
// Add to array being collected by recursion when child nodes are loaded.
// Must be done here in loop so that child nodes are inserted into the stream in place
// in recursive calls.
toAdd.push(record);
if (record.isExpanded()) {
if (record.isLoaded()) {
// Take a shortcut - appends to toAdd array
me.handleNodeExpand(record, record.childNodes, toAdd);
}
else {
// Might be asynchronous if child nodes are not immediately available
record.set('expanded', false);
record.expand();
}
}
}
}
},
// Triggered by NodeInterface's bubbled bulkremove event
onBulkRemove: function(parent, childNodes, isMove) {
this.onNodeCollapse(parent, childNodes, true);
},
// Triggered by a NodeInterface's bubbled "collapse" event.
onNodeCollapse: function(parent, records, suppressEvent, callback, scope) {
var me = this,
collapseIndex = me.indexOf(parent) + 1,
node, lastNodeIndexPlus, sibling, found;
if (!me.recursive && parent !== me.node) {
return;
}
// Used by the TreeView to bracket recursive expand & collapse ops.
// The TreeViewsets up the animWrap object if we are animating.
// It also caches the collapse callback to call when it receives the
// end collapse event. See below.
if (!suppressEvent) {
me.fireEvent('beforecollapse', parent, records, collapseIndex, callback, scope);
}
// Only attempt to remove the records if they are there.
// Collapsing an ancestor node *immediately removes from the view, ALL its descendant nodes at all levels*.
// But if the collapse was recursive, all descendant root nodes will still fire their
// events. But we must ignore those events here - we have nothing to do.
if (records.length && me.data.contains(records[0])) {
// Calculate the index *one beyond* the last node we are going to remove
// Need to loop up the tree to find the nearest view sibling, since it could
// exist at some level above the current node.
node = parent;
while (node.parentNode) {
sibling = node.nextSibling;
if (sibling) {
found = true;
lastNodeIndexPlus = me.indexOf(sibling);
break;
} else {
node = node.parentNode;
}
}
if (!found) {
lastNodeIndexPlus = me.getCount();
}
// Remove the whole collapsed node set.
me.removeAt(collapseIndex, lastNodeIndexPlus - collapseIndex);
}
// Triggers the TreeView's onCollapse method which calls refreshSize,
// and fires its afteritecollapse event
if (!suppressEvent) {
me.fireEvent('collapse', parent, records, collapseIndex);
}
},
onNodeAppend: function(parent, node, index) {
var me = this,
refNode, sibling;
// Only react to a node append if it is to a node which is expanded, and is part of a tree
if (me.isVisible(node)) {
if (index === 0) {
refNode = parent;
} else {
sibling = node.previousSibling;
while (sibling.isExpanded() && sibling.lastChild) {
sibling = sibling.lastChild;
}
refNode = sibling;
}
me.insert(me.indexOf(refNode) + 1, node);
if (!node.isLeaf() && node.isExpanded()) {
if (node.isLoaded()) {
// Take a shortcut
me.onNodeExpand(node, node.childNodes, true);
} else if (!me.treeStore.fillCount ) {
// If the node has been marked as expanded, it means the children
// should be provided as part of the raw data. If we're filling the nodes,
// the children may not have been loaded yet, so only do this if we're
// not in the middle of populating the nodes.
node.set('expanded', false);
node.expand();
}
}
}
},
onNodeInsert: function(parent, node, refNode) {
var me = this,
index = this.indexOf(refNode);
if (index != -1 && me.isVisible(node)) {
me.insert(index, node);
if (!node.isLeaf() && node.isExpanded()) {
if (node.isLoaded()) {
// Take a shortcut
me.onNodeExpand(node, node.childNodes, true);
}
else {
node.set('expanded', false);
node.expand();
}
}
}
},
onNodeRemove: function(parent, node, isMove) {
var me = this;
if (me.indexOf(node) != -1) {
// If the removed node is a non-leaf and is expanded, use the onCollapse method to get rid
// of all descendants at any level.
if (!node.isLeaf() && node.isExpanded()) {
// onCollapse expects to be able to use the "collapsing" node's parentNode
// and nextSibling pointers so temporarily reinstate them.
// Reinstating them is safe because we pass the suppressEvents flag, and no user code
// is executed.
node.parentNode = node.removeContext.parentNode;
node.nextSibling = node.removeContext.nextSibling;
me.onNodeCollapse(node, node.childNodes, true);
node.parentNode = node.nextSibling = null;
}
me.remove(node);
}
},
isVisible: function(node) {
var parent = node.parentNode;
while (parent) {
// Hit root and it is expanded, the node is visible
if (parent === this.node && parent.data.expanded) {
return true;
}
// Hit a collapsed ancestor, the node is not visible
if (!parent.data.expanded) {
return false;
}
parent = parent.parentNode;
}
// Walked off the top - the node is not part of the tree structure
return false;
}
});
|
src/components/Quiz.js
|
lukaszmakuch/quiz
|
import React, { Component } from 'react';
import Grid from 'material-ui/Grid';
import QuizMenu from './QuizMenu';
export default class Quiz extends Component {
constructor(props) {
super(props);
this.containerRef = React.createRef();
this.state = {
currentQuestion: props.currentQuestion(),
checkingAnswer: false,
givenAnswer: undefined,
result: undefined,
};
}
handleAnswerChange = givenAnswer => {
this.setState({givenAnswer});
};
handleNextQuestion = () => {
if (this.props.finished) {
this.setState({
checkingAnswer: false,
result: false,
givenAnswer: undefined,
})
this.props.onLeaveLast();
} else {
this.setState({
checkingAnswer: false,
result: false,
givenAnswer: undefined,
currentQuestion: this.props.currentQuestion()
});
}
}
levelSelected = level => level === this.state.currentQuestion.level;
handleCheckAnswer = () => {
if (this.state.givenAnswer) {
const result = this.props.giveAnswer(this.state.givenAnswer);
this.setState({result, checkingAnswer: true}, () => {
this.containerRef.current.focus();
});
}
}
handleDifficultyLevel = level => {
this.props.difficultyLevel(
this.state.currentQuestion.id,
level
);
this.setState((prevState) => {
return {
currentQuestion: {...prevState.currentQuestion, level}
};
});
}
handleKeyboard = e => {
const key = e.key;
if (key === "Enter") {
if (this.state.checkingAnswer) {
this.handleNextQuestion();
} else {
this.handleCheckAnswer();
}
}
if (["1", "2", "3"].includes(key)) {
this.handleDifficultyLevel(parseInt(key) - 1);
}
}
render() {
if (!this.state.currentQuestion) {
return <div>no questions...</div>
}
const question = this.state.currentQuestion;
const QuestionUI = this.props.questionUI();
return <div
style={({
flex: 1,
display: 'flex',
maxWidth: "100%",
flexDirection: 'column'
})}
tabIndex="0"
ref={this.containerRef}
onKeyDown={this.handleKeyboard}
>
<Grid
container
style={({
flex: 1,
})}
direction="row"
align="center"
justify="center"
>
<Grid>
<QuestionUI
question={question}
givenAnswer={this.state.givenAnswer}
result={this.state.result}
onAnswerChange={this.handleAnswerChange}
/>
</Grid>
</Grid>
<Grid
container
justify="center"
align="center"
>
<Grid>
<QuizMenu
levelSelected={this.levelSelected}
onCheckAnswer={this.handleCheckAnswer}
onDifficultyLevel={this.handleDifficultyLevel}
onNextQuestion={this.handleNextQuestion}
checkingAnswer={this.state.checkingAnswer}
/>
</Grid>
</Grid>
</div>
};
}
|
app/components/LoadingIndicator/index.js
|
aditigoel23/React-Car-App
|
import React from 'react';
import Circle from './Circle';
import Wrapper from './Wrapper';
const LoadingIndicator = () => (
<Wrapper>
<Circle />
<Circle rotate={30} delay={-1.1} />
<Circle rotate={60} delay={-1} />
<Circle rotate={90} delay={-0.9} />
<Circle rotate={120} delay={-0.8} />
<Circle rotate={150} delay={-0.7} />
<Circle rotate={180} delay={-0.6} />
<Circle rotate={210} delay={-0.5} />
<Circle rotate={240} delay={-0.4} />
<Circle rotate={270} delay={-0.3} />
<Circle rotate={300} delay={-0.2} />
<Circle rotate={330} delay={-0.1} />
</Wrapper>
);
export default LoadingIndicator;
|
src/Button.js
|
lo1tuma/react-bootstrap
|
import React from 'react';
import classNames from 'classnames';
import BootstrapMixin from './BootstrapMixin';
const Button = React.createClass({
mixins: [BootstrapMixin],
propTypes: {
active: React.PropTypes.bool,
disabled: React.PropTypes.bool,
block: React.PropTypes.bool,
navItem: React.PropTypes.bool,
navDropdown: React.PropTypes.bool,
componentClass: React.PropTypes.node,
href: React.PropTypes.string,
target: React.PropTypes.string
},
getDefaultProps() {
return {
bsClass: 'button',
bsStyle: 'default',
type: 'button'
};
},
render() {
let classes = this.props.navDropdown ? {} : this.getBsClassSet();
let renderFuncName;
classes = {
active: this.props.active,
'btn-block': this.props.block,
...classes
};
if (this.props.navItem) {
return this.renderNavItem(classes);
}
renderFuncName = this.props.href || this.props.target || this.props.navDropdown ?
'renderAnchor' : 'renderButton';
return this[renderFuncName](classes);
},
renderAnchor(classes) {
let Component = this.props.componentClass || 'a';
let href = this.props.href || '#';
classes.disabled = this.props.disabled;
return (
<Component
{...this.props}
href={href}
className={classNames(this.props.className, classes)}
role="button">
{this.props.children}
</Component>
);
},
renderButton(classes) {
let Component = this.props.componentClass || 'button';
return (
<Component
{...this.props}
className={classNames(this.props.className, classes)}>
{this.props.children}
</Component>
);
},
renderNavItem(classes) {
let liClasses = {
active: this.props.active
};
return (
<li className={classNames(liClasses)}>
{this.renderAnchor(classes)}
</li>
);
}
});
export default Button;
|
ajax/libs/forerunnerdb/1.3.8/fdb-all.min.js
|
sajochiu/cdnjs
|
/*
MIT License (c) copyright 2010-2014 original author or authors MIT License (c) copyright 2010-2014 original author or authors MIT License (c) copyright 2010-2014 original author or authors MIT License (c) copyright 2010-2014 original author or authors MIT License (c) copyright 2010-2014 original author or authors MIT License (c) copyright 2010-2014 original author or authors MIT License (c) copyright 2010-2014 original author or authors MIT License (c) copyright 2010-2014 original author or authors MIT License (c) copyright 2010-2014 original author or authors MIT License (c) copyright 2010-2014 original author or authors MIT License (c) copyright 2010-2014 original author or authors MIT License (c) copyright 2010-2014 original author or authors MIT License (c) copyright 2010-2014 original author or authors MIT License (c) copyright 2010-2014 original author or authors MIT License (c) copyright 2010-2014 original author or authors MIT License (c) copyright 2010-2014 original author or authors MIT License (c) copyright 2010-2014 original author or authors MIT License (c) copyright 2010-2014 original author or authors */
(function(H){"object"===typeof exports&&"undefined"!==typeof module?module.exports=H():"function"===typeof define&&define.amd?define([],H):("undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:this).ForerunnerDB=H()})(function(){return function g(k,h,f){function b(a,m){if(!h[a]){if(!k[a]){var e="function"==typeof require&&require;if(!m&&e)return e(a,!0);if(d)return d(a,!0);e=Error("Cannot find module '"+a+"'");throw e.code="MODULE_NOT_FOUND",e;}e=h[a]=
{exports:{}};k[a][0].call(e.exports,function(n){var e=k[a][1][n];return b(e?e:n)},e,e.exports,g,k,h,f)}return h[a].exports}for(var d="function"==typeof require&&require,a=0;a<f.length;a++)b(f[a]);return b}({1:[function(g,k,h){h=g("./core");g("../lib/CollectionGroup");g("../lib/View");g("../lib/Highchart");g("../lib/Persist");g("../lib/Document");g("../lib/Overview");g("../lib/Grid");g("../lib/Rest");k.exports=h},{"../lib/CollectionGroup":5,"../lib/Document":8,"../lib/Grid":9,"../lib/Highchart":10,
"../lib/Overview":25,"../lib/Persist":27,"../lib/Rest":29,"../lib/View":32,"./core":2}],2:[function(g,k,h){h=g("../lib/Core");g("../lib/Shim.IE8");k.exports=h},{"../lib/Core":6,"../lib/Shim.IE8":31}],3:[function(g,k,h){h=g("./Shared");g("./Path");g=function(f){var b;this._primaryKey="_id";this._keyArr=[];this._data=[];this._objLookup={};this._count=0;for(b in f)f.hasOwnProperty(b)&&this._keyArr.push({key:b,dir:f[b]})};h.addModule("ActiveBucket",g);h.synthesize(g.prototype,"primaryKey");h.mixin(g.prototype,
"Mixin.Sorting");g.prototype.qs=function(f,b,d,a){if(!b.length)return 0;for(var c=-1,m,e,n=0,y=b.length-1;y>=n;){m=Math.floor((n+y)/2);if(c===m)break;c=b[m];void 0!==c&&(e=a(this,f,d,c),0<e&&(n=m+1),0>e&&(y=m-1));c=m}return 0<e?m+1:m};g.prototype._sortFunc=function(f,b,d,a){d=d.split(".:.");a=a.split(".:.");var c=f._keyArr,m=c.length,e,n,y;for(e=0;e<m;e++)if(n=c[e],y=typeof b[n.key],"number"===y&&(d[e]=Number(d[e]),a[e]=Number(a[e])),d[e]!==a[e]){if(1===n.dir)return f.sortAsc(d[e],a[e]);if(-1===n.dir)return f.sortDesc(d[e],
a[e])}};g.prototype.insert=function(f){var b,d;b=this.documentKey(f);d=this._data.indexOf(b);-1===d&&(d=this.qs(f,this._data,b,this._sortFunc));this._data.splice(d,0,b);this._objLookup[f[this._primaryKey]]=b;this._count++;return d};g.prototype.remove=function(f){var b;if(b=this._objLookup[f[this._primaryKey]])if(b=this._data.indexOf(b),-1<b)return this._data.splice(b,1),delete this._objLookup[f[this._primaryKey]],this._count--,!0;return!1};g.prototype.index=function(f){var b,d;b=this.documentKey(f);
d=this._data.indexOf(b);-1===d&&(d=this.qs(f,this._data,b,this._sortFunc));return d};g.prototype.documentKey=function(f){var b="",d=this._keyArr,a=d.length,c,m;for(c=0;c<a;c++)m=d[c],b&&(b+=".:."),b+=f[m.key];return b+=".:."+f[this._primaryKey]};g.prototype.count=function(){return this._count};h.finishModule("ActiveBucket");k.exports=g},{"./Path":26,"./Shared":30}],4:[function(g,k,h){var f,b,d,a,c,m;h=g("./Shared");var e=function(a){this.init.apply(this,arguments)};e.prototype.init=function(a){this._primaryKey=
"_id";this._primaryIndex=new b("primary");this._primaryCrc=new b("primaryCrc");this._crcLookup=new b("crcLookup");this._name=a;this._data=[];this._groups=[];this._metrics=new f;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)};h.addModule("Collection",e);h.mixin(e.prototype,"Mixin.Common");h.mixin(e.prototype,"Mixin.Events");h.mixin(e.prototype,"Mixin.ChainReactor");
h.mixin(e.prototype,"Mixin.CRUD");h.mixin(e.prototype,"Mixin.Constants");h.mixin(e.prototype,"Mixin.Triggers");h.mixin(e.prototype,"Mixin.Sorting");h.mixin(e.prototype,"Mixin.Matching");f=g("./Metrics");b=g("./KeyValueStore");d=g("./Path");a=g("./IndexHashMap");c=g("./IndexBinaryTree");m=g("./Crc");g=h.modules.Core;e.prototype.crc=m;h.synthesize(e.prototype,"state");h.synthesize(e.prototype,"name");e.prototype.data=function(){return this._data};e.prototype.drop=function(){if("dropped"!==this._state){if(this._db&&
this._db._collection&&this._name){this.debug()&&console.log("Dropping collection "+this._name);this._state="dropped";this.emit("drop",this);delete this._db._collection[this._name];if(this._groups&&this._groups.length){var a=[],c;for(c=0;c<this._groups.length;c++)a.push(this._groups[c]);for(c=0;c<a.length;c++)this._groups[c].removeCollection(this)}delete this._primaryKey;delete this._primaryIndex;delete this._primaryCrc;delete this._crcLookup;delete this._name;delete this._data;delete this._groups;
delete this._metrics;return!0}}else return!0;return!1};e.prototype.primaryKey=function(a){return void 0!==a?(this._primaryKey!==a&&(this._primaryKey=a,this._primaryIndex.primaryKey(a),this.rebuildPrimaryKeyIndex()),this):this._primaryKey};e.prototype._onInsert=function(a,c){this.emit("insert",a,c)};e.prototype._onUpdate=function(a){this.emit("update",a)};e.prototype._onRemove=function(a){this.emit("remove",a)};h.synthesize(e.prototype,"db",function(a){a&&"_id"===this.primaryKey()&&this.primaryKey(a.primaryKey());
return this.$super.apply(this,arguments)});e.prototype.setData=function(a,c,b){if(a){var e=this._metrics.create("setData");e.start();c=this.options(c);this.preSetData(a,c,b);c.$decouple&&(a=this.decouple(a));a instanceof Array||(a=[a]);e.time("transformIn");a=this.transformIn(a);e.time("transformIn");var d=[].concat(this._data);this._dataReplace(a);e.time("Rebuild Primary Key Index");this.rebuildPrimaryKeyIndex(c);e.time("Rebuild Primary Key Index");e.time("Rebuild All Other Indexes");this._rebuildIndexes();
e.time("Rebuild All Other Indexes");e.time("Resolve chains");this.chainSend("setData",a,{oldData:d});e.time("Resolve chains");e.stop();this.emit("setData",this._data,d)}b&&b(!1);return this};e.prototype.rebuildPrimaryKeyIndex=function(a){var c=a&&void 0!==a.$ensureKeys?a.$ensureKeys:!0;a=a&&void 0!==a.$violationCheck?a.$violationCheck:!0;var b,e,d,f=this._primaryIndex,m=this._primaryCrc,g=this._crcLookup,h=this._primaryKey,k;f.truncate();m.truncate();g.truncate();b=this._data;for(e=b.length;e--;){d=
b[e];c&&this.ensurePrimaryKey(d);if(a){if(!f.uniqueSet(d[h],d))throw'ForerunnerDB.Collection "'+this.name()+'": 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 f.set(d[h],d);k=JSON.stringify(d);m.set(d[h],k);g.set(k,d)}};e.prototype.ensurePrimaryKey=function(a){void 0===a[this._primaryKey]&&(a[this._primaryKey]=this.objectId())};e.prototype.truncate=function(){this.emit("truncate",
this._data);this._data.length=0;this._primaryIndex=new b("primary");this._primaryCrc=new b("primaryCrc");this._crcLookup=new b("crcLookup");this.deferEmit("change",{type:"truncate"});return this};e.prototype.upsert=function(a,c){if(a){var b=this._deferQueue.upsert,e=this._deferThreshold.upsert,d={},f;if(a instanceof Array){if(a.length>e)return this._deferQueue.upsert=b.concat(a),this.processQueue("upsert",c),{};d=[];for(b=0;b<a.length;b++)d.push(this.upsert(a[b]));c&&c();return d}a[this._primaryKey]?
(f={},f[this._primaryKey]=a[this._primaryKey],this._primaryIndex.lookup(f)[0]?d.op="update":d.op="insert"):d.op="insert";switch(d.op){case "insert":d.result=this.insert(a);break;case "update":d.result=this.update(f,a)}return d}c&&c();return{}};e.prototype.update=function(a,c,b){c=this.decouple(c);c=this.transformIn(c);this.debug()&&console.log('Updating some collection data for collection "'+this.name()+'"');var e=this,d=this._metrics.create("update"),f,m,g=function(f){var m=e.decouple(f),g,l;if(e.willTrigger(e.TYPE_UPDATE,
e.PHASE_BEFORE)||e.willTrigger(e.TYPE_UPDATE,e.PHASE_AFTER)){g={type:"update",query:e.decouple(a),update:e.decouple(c),options:e.decouple(b),op:d};if(!1===e.processTrigger(g,e.TYPE_UPDATE,e.PHASE_BEFORE,m)||e.willTrigger(e.TYPE_UPDATE,e.PHASE_BEFORE)&&(l=e.updateObject(m,g.update,g.query,g.options,""))&&!1===e.processTrigger(g,e.TYPE_UPDATE,e.PHASE_AFTER,f,m))return!1;l=e.updateObject(f,g.update,g.query,g.options,"")}else l=e.updateObject(f,c,a,b,"");return l};d.start();d.time("Retrieve documents to update");
f=this.find(a,{$decouple:!1});d.time("Retrieve documents to update");f.length&&(d.time("Update documents"),m=f.filter(g),d.time("Update documents"),m.length&&(d.time("Resolve chains"),this.chainSend("update",{query:a,update:c,dataSet:f},b),d.time("Resolve chains"),this._onUpdate(m),this.deferEmit("change",{type:"update",data:m})));d.stop();return m||[]};e.prototype._replaceObj=function(a,c){var e;this._removeFromIndexes(a);for(e in a)a.hasOwnProperty(e)&&delete a[e];for(e in c)c.hasOwnProperty(e)&&
(a[e]=c[e]);if(!this._insertIntoIndexes(a))throw'ForerunnerDB.Collection "'+this.name()+'": Primary key violation in update! Key violated: '+a[this._primaryKey];return!0};e.prototype.updateById=function(a,c){var e={};e[this._primaryKey]=a;return this.update(e,c)};e.prototype.updateObject=function(a,c,e,b,f,m){c=this.decouple(c);f=f||"";"."===f.substr(0,1)&&(f=f.substr(1,f.length-1));this.decouple(a);var g=!1,s=!1,h,k,r,l;for(l in c)if(c.hasOwnProperty(l)){h=!1;if("$"===l.substr(0,1))switch(l){case "$key":case "$index":h=
!0;break;default:h=!0,s=this.updateObject(a,c[l],e,b,f,l),g=g||s}if(this._isPositionalKey(l)&&(h=!0,l=l.substr(0,l.length-2),s=new d(f+"."+l),a[l]&&a[l]instanceof Array&&a[l].length)){k=[];for(r=0;r<a[l].length;r++)this._match(a[l][r],s.value(e)[0])&&k.push(r);for(r=0;r<k.length;r++)s=this.updateObject(a[l][k[r]],c[l+".$"],e,b,f+"."+l,m),g=g||s}if(!h)if(m||"object"!==typeof c[l])switch(m){case "$inc":this._updateIncrement(a,l,c[l]);g=!0;break;case "$push":void 0===a[l]&&this._updateProperty(a,l,[]);
if(a[l]instanceof Array){if(void 0!==c[l].$position&&c[l].$each instanceof Array)for(s=c[l].$position,h=c[l].$each.length,r=0;r<h;r++)this._updateSplicePush(a[l],s+r,c[l].$each[r]);else if(c[l].$each instanceof Array)for(h=c[l].$each.length,r=0;r<h;r++)this._updatePush(a[l],c[l].$each[r]);else this._updatePush(a[l],c[l]);g=!0}else throw'ForerunnerDB.Collection "'+this.name()+'": Cannot push to a key that is not an array! ('+l+")";break;case "$pull":if(a[l]instanceof Array){k=[];for(r=0;r<a[l].length;r++)this._match(a[l][r],
c[l])&&k.push(r);for(h=k.length;h--;)this._updatePull(a[l],k[h]),g=!0}break;case "$pullAll":if(a[l]instanceof Array)if(c[l]instanceof Array){if(k=a[l],h=k.length,0<h)for(;h--;){for(s=0;s<c[l].length;s++)k[h]===c[l][s]&&(this._updatePull(a[l],h),h--,g=!0);if(0>h)break}}else throw'ForerunnerDB.Collection "'+this.name()+'": Cannot pullAll without being given an array of values to pull! ('+l+")";break;case "$addToSet":void 0===a[l]&&this._updateProperty(a,l,[]);if(a[l]instanceof Array){r=a[l];var x;k=
r.length;var B;h=!0;x=b&&b.$addToSet;var A;c[l].$key?(s=!1,A=new d(c[l].$key),B=A.value(c[l])[0],delete c[l].$key):x&&x.key?(s=!1,A=new d(x.key),B=A.value(c[l])[0]):(B=JSON.stringify(c[l]),s=!0);for(x=0;x<k;x++)if(s){if(JSON.stringify(r[x])===B){h=!1;break}}else if(B===A.value(r[x])[0]){h=!1;break}h&&(this._updatePush(a[l],c[l]),g=!0)}else throw'ForerunnerDB.Collection "'+this.name()+'": Cannot addToSet on a key that is not an array! (undefined)';break;case "$splicePush":void 0===a[l]&&this._updateProperty(a,
l,[]);if(a[l]instanceof Array)if(s=c.$index,void 0!==s)delete c.$index,s>a[l].length&&(s=a[l].length),this._updateSplicePush(a[l],s,c[l]),g=!0;else throw'ForerunnerDB.Collection "'+this.name()+'": Cannot splicePush without a $index integer value!';else throw'ForerunnerDB.Collection "'+this.name()+'": Cannot splicePush with a key that is not an array! ('+l+")";break;case "$move":if(a[l]instanceof Array)for(r=0;r<a[l].length;r++){if(this._match(a[l][r],c[l])){g=c.$index;if(void 0!==g)delete c.$index,
this._updateSpliceMove(a[l],r,g),g=!0;else throw'ForerunnerDB.Collection "'+this.name()+'": Cannot move without a $index integer value!';break}}else throw'ForerunnerDB.Collection "'+this.name()+'": Cannot move on a key that is not an array! ('+l+")";break;case "$mul":this._updateMultiply(a,l,c[l]);g=!0;break;case "$rename":this._updateRename(a,l,c[l]);g=!0;break;case "$unset":this._updateUnset(a,l);g=!0;break;case "$pop":if(a[l]instanceof Array)this._updatePop(a[l],c[l])&&(g=!0);else throw'ForerunnerDB.Collection "'+
this.name()+'": Cannot pop from a key that is not an array! ('+l+")";break;default:a[l]!==c[l]&&(this._updateProperty(a,l,c[l]),g=!0)}else if(null!==a[l]&&"object"===typeof a[l])if(r=a[l]instanceof Array,k=c[l]instanceof Array,r||k)if(!k&&r)for(r=0;r<a[l].length;r++)s=this.updateObject(a[l][r],c[l],e,b,f+"."+l,m),g=g||s;else a[l]!==c[l]&&(this._updateProperty(a,l,c[l]),g=!0);else s=this.updateObject(a[l],c[l],e,b,f+"."+l,m),g=g||s;else a[l]!==c[l]&&(this._updateProperty(a,l,c[l]),g=!0)}return g};
e.prototype._isPositionalKey=function(a){return".$"===a.substr(a.length-2,2)};e.prototype._updateProperty=function(a,c,e){a[c]=e;this.debug()&&console.log('ForerunnerDB.Collection: Setting non-data-bound document property "'+c+'" for collection "'+this.name()+'"')};e.prototype._updateIncrement=function(a,c,e){a[c]+=e};e.prototype._updateSpliceMove=function(a,c,e){a.splice(e,0,a.splice(c,1)[0]);this.debug()&&console.log('ForerunnerDB.Collection: Moving non-data-bound document array index from "'+c+
'" to "'+e+'" for collection "'+this.name()+'"')};e.prototype._updateSplicePush=function(a,c,e){a.length>c?a.splice(c,0,e):a.push(e)};e.prototype._updatePush=function(a,c){a.push(c)};e.prototype._updatePull=function(a,c){a.splice(c,1)};e.prototype._updateMultiply=function(a,c,e){a[c]*=e};e.prototype._updateRename=function(a,c,e){a[e]=a[c];delete a[c]};e.prototype._updateUnset=function(a,c){delete a[c]};e.prototype._updatePop=function(a,c){var e=!1;0<a.length&&(1===c?(a.pop(),e=!0):-1===c&&(a.shift(),
e=!0));return e};e.prototype.remove=function(a,c,e){var b,d;if(a instanceof Array){b=[];for(e=0;e<a.length;e++)b.push(this.remove(a[e],{noEmit:!0}));(!c||c&&!c.noEmit)&&this._onRemove(b);return b}e=this.find(a,{$decouple:!1});if(e.length){for(var f=0;f<e.length;f++)d=e[f],this._removeFromIndexes(d),b=this._data.indexOf(d),this._dataRemoveAtIndex(b),this.processTrigger(this.TYPE_REMOVE,this.PHASE_AFTER,d,{});this.chainSend("remove",{query:a,dataSet:e},c);(!c||c&&!c.noEmit)&&this._onRemove(e);this.deferEmit("change",
{type:"remove",data:e})}return e};e.prototype.removeById=function(a){var c={};c[this._primaryKey]=a;return this.remove(c)};e.prototype.deferEmit=function(){var a=this,c;this._noEmitDefer||this._db&&(!this._db||this._db._noEmitDefer)?this.emit.apply(this,arguments):(c=arguments,this._changeTimeout&&clearTimeout(this._changeTimeout),this._changeTimeout=setTimeout(function(){a.debug()&&console.log("ForerunnerDB.Collection: Emitting "+c[0]);a.emit.apply(a,c)},100))};e.prototype.processQueue=function(a,
c){var e=this._deferQueue[a],b=this._deferThreshold[a],d=this._deferTime[a];if(e.length){var f=this;e.length&&(e=e.length>b?e.splice(0,b):e.splice(0,e.length),this[a](e));setTimeout(function(){f.processQueue(a,c)},d)}else c&&c()};e.prototype.insert=function(a,c,e){"function"===typeof c?(e=c,c=this._data.length):void 0===c&&(c=this._data.length);a=this.transformIn(a);return this._insertHandle(a,c,e)};e.prototype._insertHandle=function(a,c,e){var b=this._deferQueue.insert,d=this._deferThreshold.insert,
f=[],m=[];if(a instanceof Array){if(a.length>d){this._deferQueue.insert=b.concat(a);this.processQueue("insert",e);return}for(d=0;d<a.length;d++)b=this._insert(a[d],c+d),!0===b?f.push(a[d]):m.push({doc:a[d],reason:b})}else b=this._insert(a,c),!0===b?f.push(a):m.push({doc:a,reason:b});this.chainSend("insert",a,{index:c});this._onInsert(f,m);e&&e();this.deferEmit("change",{type:"insert",data:f});return{inserted:f,failed:m}};e.prototype._insert=function(a,c){if(a){var e;this.ensurePrimaryKey(a);if(e=
this.insertIndexViolation(a))return"Index violation in index: "+e;this._insertIntoIndexes(a);c>this._data.length&&(c=this._data.length);this._dataInsertAtIndex(c,a);this.processTrigger(this.TYPE_INSERT,this.PHASE_AFTER,{},a);return!0}return"No document passed to insert"};e.prototype._dataInsertAtIndex=function(a,c){this._data.splice(a,0,c)};e.prototype._dataRemoveAtIndex=function(a){this._data.splice(a,1)};e.prototype._dataReplace=function(a){for(;this._data.length;)this._data.pop();this._data=this._data.concat(a)};
e.prototype._insertIntoIndexes=function(a){var c=this._indexByName,e,b,d=JSON.stringify(a);b=this._primaryIndex.uniqueSet(a[this._primaryKey],a);this._primaryCrc.uniqueSet(a[this._primaryKey],d);this._crcLookup.uniqueSet(d,a);for(e in c)c.hasOwnProperty(e)&&c[e].insert(a);return b};e.prototype._removeFromIndexes=function(a){var c=this._indexByName,e,b=JSON.stringify(a);this._primaryIndex.unSet(a[this._primaryKey]);this._primaryCrc.unSet(a[this._primaryKey]);this._crcLookup.unSet(b);for(e in c)c.hasOwnProperty(e)&&
c[e].remove(a)};e.prototype._rebuildIndexes=function(){var a=this._indexByName,c;for(c in a)a.hasOwnProperty(c)&&a[c].rebuild()};e.prototype.indexOfDocById=function(a){return this._data.indexOf(this._primaryIndex.get(a[this._primaryKey]))};e.prototype.subset=function(a,c){var b=this.find(a,c);return(new e)._subsetOf(this).primaryKey(this._primaryKey).setData(b)};e.prototype.subsetOf=function(){return this.__subsetOf};e.prototype._subsetOf=function(a){this.__subsetOf=a;return this};e.prototype.distinct=
function(a,c,e){c=this.find(c,e);a=new d(a);e={};var b=[],f,m;for(m=0;m<c.length;m++)(f=a.value(c[m])[0])&&!e[f]&&(e[f]=!0,b.push(f));return b};e.prototype.findById=function(a,c){var e={};e[this._primaryKey]=a;return this.find(e,c)[0]};e.prototype.peek=function(a,c){var b=this._data,d=b.length,f,m,g=new e;if("string"===typeof a){for(f=0;f<d;f++)m=JSON.stringify(b[f]),-1<m.indexOf(a)&&g.insert(b[f]);return g.find({},c)}return this.find(a,c)};e.prototype.explain=function(a,c){return this.find(a,c).__fdbOp._data};
e.prototype.options=function(a){a=a||{};a.$decouple=void 0!==a.$decouple?a.$decouple:!0;a.$explain=void 0!==a.$explain?a.$explain:!1;return a};e.prototype.find=function(a,c){a=a||{};c=this.options(c);var e=this._metrics.create("find"),b=this,f,m=!0,g,h,k,u,r,l,x,B,A,C=[];h=function(c){return b._match(c,a,"and")};e.start();if(a){e.time("analyseQuery");f=this._analyseQuery(a,c,e);e.time("analyseQuery");e.data("analysis",f);if(f.hasJoin&&f.queriesJoin){e.time("joinReferences");for(k=0;k<f.joinsOn.length;k++)r=
f.joinsOn[k],u=new d(f.joinQueries[r]),u=u.value(a)[0],this._db.collection(f.joinsOn[k]).subset(u);e.time("joinReferences")}f.indexMatch.length&&(!c||c&&!c.$skipIndex)?(e.data("index.potential",f.indexMatch),e.data("index.used",f.indexMatch[0].index),e.time("indexLookup"),g=f.indexMatch[0].lookup,e.time("indexLookup"),f.indexMatch[0].keyData.totalKeyCount===f.indexMatch[0].keyData.score&&(m=!1)):e.flag("usedIndex",!1);m&&(g&&g.length?(f=g.length,e.time("tableScan: "+f),g=g.filter(h)):(f=this._data.length,
e.time("tableScan: "+f),g=this._data.filter(h)),c.$orderBy&&(e.time("sort"),g=this.sort(c.$orderBy,g),e.time("sort")),e.time("tableScan: "+f));c.limit&&g&&g.length>c.limit&&(g.length=c.limit,e.data("limit",c.limit));c.$decouple&&(e.time("decouple"),g=this.decouple(g),e.time("decouple"),e.data("flag.decouple",!0));if(c.join){for(h=0;h<c.join.length;h++)for(r in c.join[h])if(c.join[h].hasOwnProperty(r))for(B=r,f=this._db.collection(r),m=c.join[h][r],A=0;A<g.length;A++){x={};u=k=!1;for(l in m)if(m.hasOwnProperty(l))if("$"===
l.substr(0,1))switch(l){case "$as":B=m[l];break;case "$multi":k=m[l];break;case "$require":u=m[l];break;default:l.substr(0,3)}else x[l]=(new d(m[l])).value(g[A])[0];x=f.find(x);!u||u&&x[0]?g[A][B]=!1===k?x[0]:x:C.push(g[A])}e.data("flag.join",!0)}if(C.length){e.time("removalQueue");for(l=0;l<C.length;l++)r=g.indexOf(C[l]),-1<r&&g.splice(r,1);e.time("removalQueue")}if(c.transform){e.time("transform");for(l=0;l<g.length;l++)g.splice(l,1,c.transform(g[l]));e.time("transform");e.data("flag.transform",
!0)}this._transformEnabled&&this._transformOut&&(e.time("transformOut"),g=this.transformOut(g),e.time("transformOut"));e.data("results",g.length);e.stop()}else e.stop(),g=[];g.__fdbOp=e;return g};e.prototype.indexOf=function(a){if(a=this.find(a,{$decouple:!1})[0])return this._data.indexOf(a)};e.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=!1!==a,this):{enabled:this._transformEnabled,dataIn:this._transformIn,dataOut:this._transformOut}};e.prototype.transformIn=function(a){if(this._transformEnabled&&this._transformIn){if(a instanceof Array){var c=[],e;for(e=0;e<a.length;e++)c[e]=this._transformIn(a[e]);return c}return this._transformIn(a)}return a};e.prototype.transformOut=function(a){if(this._transformEnabled&&this._transformOut){if(a instanceof Array){var c=[],e;for(e=0;e<a.length;e++)c[e]=this._transformOut(a[e]);
return c}return this._transformOut(a)}return a};e.prototype.sort=function(a,c){c=c||[];var e=[],b,d;for(b in a)a.hasOwnProperty(b)&&(d={},d[b]=a[b],d.___fdbKey=b,e.push(d));return 2>e.length?this._sort(a,c):this._bucketSort(e,c)};e.prototype._bucketSort=function(a,c){var e=a.shift(),b,d,f=[];if(0<a.length){c=this._sort(e,c);b=this.bucket(e.___fdbKey,c);for(d in b)b.hasOwnProperty(d)&&(e=[].concat(a),f=f.concat(this._bucketSort(e,b[d])));return f}return this._sort(e,c)};e.prototype._sort=function(a,
c){var e=this,b,f=new d;b=f.parse(a,!0)[0];f.path(b.path);if(1===b.value)b=function(a,c){var b=f.value(a)[0],d=f.value(c)[0];return e.sortAsc(b,d)};else if(-1===b.value)b=function(a,c){var b=f.value(a)[0],d=f.value(c)[0];return e.sortDesc(b,d)};else throw'ForerunnerDB.Collection "'+this.name()+'": $orderBy clause has invalid direction: '+b.value+", accepted values are 1 or -1 for ascending or descending!";return c.sort(b)};e.prototype.bucket=function(a,c){var e,b={};for(e=0;e<c.length;e++)b[c[e][a]]=
b[c[e][a]]||[],b[c[e][a]].push(c[e]);return b};e.prototype._analyseQuery=function(a,c,e){var b={queriesOn:[this._name],indexMatch:[],hasJoin:!1,queriesJoin:!1,joinQueries:{},query:a,options:c},f,m=[],g=[],h,k,u,r,l,x;e.time("checkIndexes");if(l=(new d).countKeys(a)){void 0!==a[this._primaryKey]&&(e.time("checkIndexMatch: Primary Key"),b.indexMatch.push({lookup:this._primaryIndex.lookup(a,c),keyData:{matchedKeys:[this._primaryKey],totalKeyCount:l,score:1},index:this._primaryIndex}),e.time("checkIndexMatch: Primary Key"));
for(x in this._indexById)if(this._indexById.hasOwnProperty(x)&&(k=this._indexById[x],u=k.name(),e.time("checkIndexMatch: "+u),h=k.match(a,c),0<h.score&&(r=k.lookup(a,c),b.indexMatch.push({lookup:r,keyData:h,index:k})),e.time("checkIndexMatch: "+u),h.score===l))break;e.time("checkIndexes");1<b.indexMatch.length&&(e.time("findOptimalIndex"),b.indexMatch.sort(function(a,c){if(a.keyData.score>c.keyData.score)return-1;if(a.keyData.score<c.keyData.score)return 1;if(a.keyData.score===c.keyData.score)return a.lookup.length-
c.lookup.length}),e.time("findOptimalIndex"))}if(c.join){b.hasJoin=!0;for(e=0;e<c.join.length;e++)for(f in c.join[e])c.join[e].hasOwnProperty(f)&&(m.push(f),"$as"in c.join[e][f]?g.push(c.join[e][f].$as):g.push(f));for(f=0;f<g.length;f++)if(c=this._queryReferencesCollection(a,g[f],""))b.joinQueries[m[f]]=c,b.queriesJoin=!0;b.joinsOn=m;b.queriesOn=b.queriesOn.concat(m)}return b};e.prototype._queryReferencesCollection=function(a,c,e){for(var b in a)if(a.hasOwnProperty(b)){if(b===c)return e&&(e+="."),
e+b;if("object"===typeof a[b])return e&&(e+="."),e+=b,this._queryReferencesCollection(a[b],c,e)}return!1};e.prototype.count=function(a,c){return a?this.find(a,c).length:this._data.length};e.prototype.findSub=function(a,c,e,b){var f=new d(c);a=this.find(a);var m=a.length,g,h,k=this._db.collection("__FDB_temp_"+this.objectId()),u={parents:m,subDocTotal:0,subDocs:[],pathFound:!1,err:""};for(g=0;g<m;g++)if(h=f.value(a[g])[0]){k.setData(h);h=k.find(e,b);if(b.returnFirst&&h.length)return h[0];u.subDocs.push(h);
u.subDocTotal+=h.length;u.pathFound=!0}k.drop();if(b.noStats)return u.subDocs;u.pathFound||(u.err="No objects found in the parent documents with a matching path of: "+c);return u};e.prototype.insertIndexViolation=function(a){var c,e=this._indexByName,b,d;if(this._primaryIndex.get(a[this._primaryKey]))c=this._primaryIndex;else for(b in e)if(e.hasOwnProperty(b)&&(d=e[b],d.unique()&&d.violation(a))){c=d;break}return c?c.name():!1};e.prototype.ensureIndex=function(e,b){this._indexByName=this._indexByName||
{};this._indexById=this._indexById||{};var d,f={start:(new Date).getTime()};if(b)switch(b.type){case "hashed":d=new a(e,b,this);break;case "btree":d=new c(e,b,this);break;default:d=new a(e,b,this)}else d=new a(e,b,this);if(this._indexByName[d.name()])return{err:"Index with that name already exists"};if(this._indexById[d.id()])return{err:"Index with those keys already exists"};d.rebuild();this._indexByName[d.name()]=d;this._indexById[d.id()]=d;f.end=(new Date).getTime();f.total=f.end-f.start;this._lastOp=
{type:"ensureIndex",stats:{time:f}};return{index:d,id:d.id(),name:d.name(),state:d.state()}};e.prototype.index=function(a){if(this._indexByName)return this._indexByName[a]};e.prototype.lastOp=function(){return this._metrics.list()};e.prototype.diff=function(a){var c={insert:[],update:[],remove:[]},e=this.primaryKey(),b,d,f,m;if(e===a.primaryKey()){for(b=a._data;b&&!(b instanceof Array);)a=b,b=a._data;m=b.length;for(d=0;d<m;d++)f=b[d],this._primaryIndex.get(f[e])?this._primaryCrc.get(f[e])!==a._primaryCrc.get(f[e])&&
c.update.push(f):c.insert.push(f);b=this._data;m=b.length;for(d=0;d<m;d++)f=b[d],a._primaryIndex.get(f[e])||c.remove.push(f)}else throw'ForerunnerDB.Collection "'+this.name()+'": Collection diffing requires that both collections have the same primary key!';return c};g.prototype.collection=function(a,c){if(a)return this._collection[a]||this.debug()&&console.log("Creating collection "+a),this._collection[a]=this._collection[a]||(new e(a)).db(this),void 0!==c&&this._collection[a].primaryKey(c),this._collection[a];
throw'ForerunnerDB.Core "'+this.name()+'": Cannot get collection with undefined name!';};g.prototype.collectionExists=function(a){return Boolean(this._collection[a])};g.prototype.collections=function(a){var c=[],e;a&&(a instanceof RegExp||(a=RegExp(a)));for(e in this._collection)this._collection.hasOwnProperty(e)&&(a?a.exec(e)&&c.push({name:e,count:this._collection[e].count()}):c.push({name:e,count:this._collection[e].count()}));return c};h.finishModule("Collection");k.exports=e},{"./Crc":7,"./IndexBinaryTree":11,
"./IndexHashMap":12,"./KeyValueStore":13,"./Metrics":14,"./Path":26,"./Shared":30}],5:[function(g,k,h){var f,b;h=g("./Shared");var d=function(){this.init.apply(this,arguments)};d.prototype.init=function(a){this._name=a;this._data=new b("__FDB__cg_data_"+this._name);this._collections=[];this._view=[]};h.addModule("CollectionGroup",d);h.mixin(d.prototype,"Mixin.Common");h.mixin(d.prototype,"Mixin.ChainReactor");h.mixin(d.prototype,"Mixin.Constants");h.mixin(d.prototype,"Mixin.Triggers");b=g("./Collection");
g=h.modules.Core;f=h.modules.Core.prototype.init;d.prototype.on=function(){this._data.on.apply(this._data,arguments)};d.prototype.off=function(){this._data.off.apply(this._data,arguments)};d.prototype.emit=function(){this._data.emit.apply(this._data,arguments)};d.prototype.primaryKey=function(a){return void 0!==a?(this._primaryKey=a,this):this._primaryKey};h.synthesize(d.prototype,"state");h.synthesize(d.prototype,"db");d.prototype.addCollection=function(a){if(a&&-1===this._collections.indexOf(a)){if(this._collections.length){if(this._primaryKey!==
a.primaryKey())throw'ForerunnerDB.CollectionGroup "'+this.name()+'": All collections in a collection group must have the same primary key!';}else this.primaryKey(a.primaryKey());this._collections.push(a);a._groups.push(this);a.chain(this);this._data.insert(a.find())}return this};d.prototype.removeCollection=function(a){if(a){var c=this._collections.indexOf(a);-1!==c&&(a.unChain(this),this._collections.splice(c,1),c=a._groups.indexOf(this),-1!==c&&a._groups.splice(c,1));0===this._collections.length&&
delete this._primaryKey}return this};d.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)}};d.prototype.insert=function(){this._collectionsRun("insert",arguments)};d.prototype.update=
function(){this._collectionsRun("update",arguments)};d.prototype.updateById=function(){this._collectionsRun("updateById",arguments)};d.prototype.remove=function(){this._collectionsRun("remove",arguments)};d.prototype._collectionsRun=function(a,c){for(var b=0;b<this._collections.length;b++)this._collections[b][a].apply(this._collections[b],c)};d.prototype.find=function(a,c){return this._data.find(a,c)};d.prototype.removeById=function(a){for(var c=0;c<this._collections.length;c++)this._collections[c].removeById(a)};
d.prototype.subset=function(a,c){var d=this.find(a,c);return(new b)._subsetOf(this).primaryKey(this._primaryKey).setData(d)};d.prototype.drop=function(){if("dropped"!==this._state){var a,c;this._debug&&console.log("Dropping collection group "+this._name);this._state="dropped";if(this._collections&&this._collections.length)for(c=[].concat(this._collections),a=0;a<c.length;a++)this.removeCollection(c[a]);if(this._view&&this._view.length)for(c=[].concat(this._view),a=0;a<c.length;a++)this._removeView(c[a]);
this.emit("drop",this)}return!0};g.prototype.init=function(){this._collectionGroup={};f.apply(this,arguments)};g.prototype.collectionGroup=function(a){return a?(this._collectionGroup[a]=this._collectionGroup[a]||(new d(a)).db(this),this._collectionGroup[a]):this._collectionGroup};g.prototype.collectionGroups=function(){var a=[],c;for(c in this._collectionGroup)this._collectionGroup.hasOwnProperty(c)&&a.push({name:c});return a};k.exports=d},{"./Collection":4,"./Shared":30}],6:[function(g,k,h){var f,
b,d;f=g("./Shared");d=g("./Overload");h=function(a){this.init.apply(this,arguments)};h.prototype.init=function(a){this._primaryKey="_id";this._name=a;this._collection={};this._debug={}};h.prototype.moduleLoaded=d({string:function(a){if(void 0!==a){a=a.replace(/ /g,"");a=a.split(",");var c;for(c=0;c<a.length;c++)if(!f.modules[a[c]])return!1;return!0}return!1},"string, function":function(a,c){if(void 0!==a){a=a.replace(/ /g,"");var b=a.split(","),e;for(e=0;e<b.length;e++)if(!f.modules[b[e]])return!1;
c()}},"string, function, function":function(a,c,b){if(void 0!==a){a=a.replace(/ /g,"");a=a.split(",");var e;for(e=0;e<a.length;e++)if(!f.modules[a[e]])return b(),!1;c()}}});h.prototype.version=function(a,c){return void 0!==a?0===f.version.indexOf(a)?(c&&c(),!0):!1:f.version};h.moduleLoaded=h.prototype.moduleLoaded;h.version=h.prototype.version;h.shared=f;h.prototype.shared=f;f.addModule("Core",h);f.mixin(h.prototype,"Mixin.Common");f.mixin(h.prototype,"Mixin.ChainReactor");f.mixin(h.prototype,"Mixin.Constants");
b=g("./Collection.js");g("./Metrics.js");g=g("./Crc.js");h.prototype._isServer=!1;f.synthesize(h.prototype,"primaryKey");f.synthesize(h.prototype,"state");f.synthesize(h.prototype,"name");h.prototype.isClient=function(){return!this._isServer};h.prototype.isServer=function(){return this._isServer};h.prototype.crc=g;h.prototype.isClient=function(){return!this._isServer};h.prototype.isServer=function(){return this._isServer};h.prototype.arrayToCollection=function(a){return(new b).setData(a)};h.prototype.on=
function(a,c){this._listeners=this._listeners||{};this._listeners[a]=this._listeners[a]||[];this._listeners[a].push(c);return this};h.prototype.off=function(a,c){if(a in this._listeners){var b=this._listeners[a],e=b.indexOf(c);-1<e&&b.splice(e,1)}return this};h.prototype.emit=function(a,c){this._listeners=this._listeners||{};if(a in this._listeners){var b=this._listeners[a],e=b.length,d;for(d=0;d<e;d++)b[d].apply(this,Array.prototype.slice.call(arguments,1))}return this};h.prototype.peek=function(a){var c,
b,e=[],d=typeof a;for(c in this._collection)this._collection.hasOwnProperty(c)&&(b=this._collection[c],e="string"===d?e.concat(b.peek(a)):e.concat(b.find(a)));return e};h.prototype.peekCat=function(a){var c,b,e={},d,f=typeof a;for(c in this._collection)this._collection.hasOwnProperty(c)&&(b=this._collection[c],(d="string"===f?b.peek(a):b.find(a))&&d.length&&(e[b.name()]=d));return e};h.prototype.drop=function(a){if("dropped"!==this._state){var c=this.collections(),b=c.length,e,d=0,f=function(){d++;
d===b&&a&&a()};this._state="dropped";for(e=0;e<b;e++)this.collection(c[e].name).drop(f),delete this._collection[c[e].name];this.emit("drop",this)}return!0};k.exports=h},{"./Collection.js":4,"./Crc.js":7,"./Metrics.js":14,"./Overload":24,"./Shared":30}],7:[function(g,k,h){var f=function(){var b=[],d,a,c;for(a=0;256>a;a++){d=a;for(c=0;8>c;c++)d=d&1?3988292384^d>>>1:d>>>1;b[a]=d}return b}();k.exports=function(b){var d=-1,a;for(a=0;a<b.length;a++)d=d>>>8^f[(d^b.charCodeAt(a))&255];return(d^-1)>>>0}},
{}],8:[function(g,k,h){var f,b;h=g("./Shared");var d=function(){this.init.apply(this,arguments)};d.prototype.init=function(a){this._name=a;this._data={}};h.addModule("Document",d);h.mixin(d.prototype,"Mixin.Common");h.mixin(d.prototype,"Mixin.Events");h.mixin(d.prototype,"Mixin.ChainReactor");h.mixin(d.prototype,"Mixin.Constants");h.mixin(d.prototype,"Mixin.Triggers");g=g("./Collection");f=h.modules.Core;b=h.modules.Core.prototype.init;h.synthesize(d.prototype,"state");h.synthesize(d.prototype,"db");
h.synthesize(d.prototype,"name");d.prototype.setData=function(a){var c,b;if(a)if(a=this.decouple(a),this._linked){b={};for(c in this._data)"jQuery"!==c.substr(0,6)&&this._data.hasOwnProperty(c)&&void 0===a[c]&&(b[c]=1);a.$unset=b;this.updateObject(this._data,a,{})}else this._data=a;return this};d.prototype.update=function(a,c,b){this.updateObject(this._data,c,a,b)};d.prototype.updateObject=g.prototype.updateObject;d.prototype._isPositionalKey=function(a){return".$"===a.substr(a.length-2,2)};d.prototype._updateProperty=
function(a,c,b){this._linked?(jQuery.observable(a).setProperty(c,b),this.debug()&&console.log('ForerunnerDB.Document: Setting data-bound document property "'+c+'" for collection "'+this.name()+'"')):(a[c]=b,this.debug()&&console.log('ForerunnerDB.Document: Setting non-data-bound document property "'+c+'" for collection "'+this.name()+'"'))};d.prototype._updateIncrement=function(a,c,b){this._linked?jQuery.observable(a).setProperty(c,a[c]+b):a[c]+=b};d.prototype._updateSpliceMove=function(a,c,b){this._linked?
(jQuery.observable(a).move(c,b),this.debug()&&console.log('ForerunnerDB.Document: Moving data-bound document array index from "'+c+'" to "'+b+'" for collection "'+this.name()+'"')):(a.splice(b,0,a.splice(c,1)[0]),this.debug()&&console.log('ForerunnerDB.Document: Moving non-data-bound document array index from "'+c+'" to "'+b+'" for collection "'+this.name()+'"'))};d.prototype._updateSplicePush=function(a,c,b){a.length>c?this._linked?jQuery.observable(a).insert(c,b):a.splice(c,0,b):this._linked?jQuery.observable(a).insert(b):
a.push(b)};d.prototype._updatePush=function(a,c){this._linked?jQuery.observable(a).insert(c):a.push(c)};d.prototype._updatePull=function(a,c){this._linked?jQuery.observable(a).remove(c):a.splice(c,1)};d.prototype._updateMultiply=function(a,c,b){this._linked?jQuery.observable(a).setProperty(c,a[c]*b):a[c]*=b};d.prototype._updateRename=function(a,c,b){var e=a[c];this._linked?(jQuery.observable(a).setProperty(b,e),jQuery.observable(a).removeProperty(c)):(a[b]=e,delete a[c])};d.prototype._updateUnset=
function(a,c){this._linked?jQuery.observable(a).removeProperty(c):delete a[c]};d.prototype._updatePop=function(a,c){var b,e=!1;0<a.length&&(this._linked?(1===c?b=a.length-1:-1===c&&(b=0),-1<b&&(jQuery.observable(arr).remove(b),e=!0)):1===c?(a.pop(),e=!0):-1===c&&(a.shift(),e=!0));return e};d.prototype.drop=function(){if("dropped"!==this._state){if(this._db&&this._name&&this._db&&this._db._document&&this._db._document[this._name])return this._state="dropped",delete this._db._document[this._name],delete this._data,
this.emit("drop",this),!0}else return!0;return!1};f.prototype.init=function(){b.apply(this,arguments)};f.prototype.document=function(a){return a?(this._document=this._document||{},this._document[a]=this._document[a]||(new d(a)).db(this),this._document[a]):this._document};f.prototype.documents=function(){var a=[],c;for(c in this._document)this._document.hasOwnProperty(c)&&a.push({name:c});return a};h.finishModule("Document");k.exports=d},{"./Collection":4,"./Shared":30}],9:[function(g,k,h){var f,b,
d,a;h=g("./Shared");var c=function(a,c){this.init.apply(this,arguments)};c.prototype.init=function(a,c,b){var d=this;this._selector=a;this._template=c;this._options=b;this._debug={};this._collectionDroppedWrap=function(){d._collectionDropped.apply(d,arguments)}};h.addModule("Grid",c);h.mixin(c.prototype,"Mixin.Common");h.mixin(c.prototype,"Mixin.ChainReactor");h.mixin(c.prototype,"Mixin.Constants");h.mixin(c.prototype,"Mixin.Triggers");h.mixin(c.prototype,"Mixin.Events");f=g("./Collection");b=g("./CollectionGroup");
d=g("./View");g("./ReactorIO");g=h.modules.Core;a=g.prototype.init;h.synthesize(c.prototype,"state");h.synthesize(c.prototype,"name");c.prototype.insert=function(){this._from.insert.apply(this._from,arguments)};c.prototype.update=function(){this._from.update.apply(this._from,arguments)};c.prototype.updateById=function(){this._from.updateById.apply(this._from,arguments)};c.prototype.remove=function(){this._from.remove.apply(this._from,arguments)};c.prototype.from=function(a){void 0!==a&&(this._from&&
(this._from.off("drop",this._collectionDroppedWrap),this._from._removeGrid(this)),"string"===typeof a&&(a=this._db.collection(a)),this._from=a,this.refresh());return this};c.prototype.db=function(a){return void 0!==a?(this._db=a,this):this._db};c.prototype._collectionDropped=function(a){a&&delete this._from};c.prototype.drop=function(){if("dropped"!==this._state){if(this._from)return this._from.unlink(this._selector,this.template()),this._from.off("drop",this._collectionDroppedWrap),this._from._removeGrid(this),
(this.debug()||this._db&&this._db.debug())&&console.log("ForerunnerDB.Grid: Dropping grid "+this._selector),this._state="dropped",this._db&&this._selector&&delete this._db._grid[this._selector],this.emit("drop",this),delete this._selector,delete this._template,delete this._from,delete this._db,!0}else return!0;return!1};c.prototype.template=function(a){return void 0!==a?(this._template=a,this):this._template};c.prototype._sortGridClick=function(a){a=($(a.currentTarget).attr("data-grid-sort")||"").split(",");
var c={},b;for(b=0;b<a.length;b++)c[a]=1;this._from.orderBy(c)};c.prototype.refresh=function(){if(this._from)if(this._from.link){var a=this,c=$(this._selector),b=function(){a._sortGridClick.apply(a,arguments)};c.html("");this._from.orderBy&&c.off("click","[data-grid-sort]",b);this._from.link(this._selector,this.template(),{wrap:"gridRow"});if(this._from.orderBy)c.on("click","[data-grid-sort]",b)}else throw"Grid requires the AutoBind module in order to operate!";return this};f.prototype.grid=d.prototype.grid=
function(a,e,b){if(this._db&&this._db._grid){if(this._db._grid[a])throw'ForerunnerDB.Collection/View "'+this.name()+'": Cannot create a grid using this collection/view because a grid with this name already exists: '+name;a=(new c(a,e,b)).db(this._db).from(this);this._grid=this._grid||[];this._grid.push(a);return a}};f.prototype._addGrid=b.prototype._addGrid=d.prototype._addGrid=function(a){void 0!==a&&(this._grid=this._grid||[],this._grid.push(a));return this};f.prototype._removeGrid=b.prototype._removeGrid=
d.prototype._removeGrid=function(a){void 0!==a&&this._grid&&(a=this._grid.indexOf(a),-1<a&&this._grid.splice(a,1));return this};g.prototype.init=function(){this._grid={};a.apply(this,arguments)};g.prototype.grid=function(a,e,b){this._grid[a]||(this.debug()||this._db&&this._db.debug())&&console.log("Core.Grid: Creating grid "+a);this._grid[a]=this._grid[a]||(new c(a,e,b)).db(this);return this._grid[a]};g.prototype.gridExists=function(a){return Boolean(this._grid[a])};g.prototype.grids=function(){var a=
[],c;for(c in this._grid)this._grid.hasOwnProperty(c)&&a.push({name:c,count:this._grid[c].count()});return a};h.finishModule("Grid");k.exports=c},{"./Collection":4,"./CollectionGroup":5,"./ReactorIO":28,"./Shared":30,"./View":32}],10:[function(g,k,h){var f,b;h=g("./Shared");b=g("./Overload");var d=function(a,c){this.init.apply(this,arguments)};d.prototype.init=function(a,c){this._options=c;this._selector=jQuery(this._options.selector);if(!this._selector[0])throw'ForerunnerDB.Highchart "'+a.name()+
'": Chart target element does not exist via selector: '+this._options.selector;this._listeners={};this._collection=a;this._options.series=[];c.chartOptions=c.chartOptions||{};c.chartOptions.credits=!1;var b,e;switch(this._options.type){case "pie":this._selector.highcharts(this._options.chartOptions);this._chart=this._selector.highcharts();b=this._collection.find();e={allowPointSelect:!0,cursor:"pointer",dataLabels:{enabled:!0,format:"<b>{point.name}</b>: {y} ({point.percentage:.0f}%)",style:{color:Highcharts.theme&&
Highcharts.theme.contrastTextColor||"black"}}};b=this.pieDataFromCollectionData(b,this._options.keyField,this._options.valField);jQuery.extend(e,this._options.seriesOptions);jQuery.extend(e,{name:this._options.seriesName,data:b});this._chart.addSeries(e,!0,!0);break;case "line":case "area":case "column":case "bar":b=this.seriesDataFromCollectionData(this._options.seriesField,this._options.keyField,this._options.valField,this._options.orderBy);this._options.chartOptions.xAxis=b.xAxis;this._options.chartOptions.series=
b.series;this._selector.highcharts(this._options.chartOptions);this._chart=this._selector.highcharts();break;default:throw'ForerunnerDB.Highchart "'+a.name()+'": Chart type specified is not currently supported by ForerunnerDB: '+this._options.type;}this._hookEvents()};h.addModule("Highchart",d);g=h.modules.Collection;f=g.prototype.init;h.mixin(d.prototype,"Mixin.Events");h.synthesize(d.prototype,"state");d.prototype.pieDataFromCollectionData=function(a,c,b){var e=[],d;for(d=0;d<a.length;d++)e.push([a[d][c],
a[d][b]]);return e};d.prototype.seriesDataFromCollectionData=function(a,c,b,e){var d=this._collection.distinct(a),f=[],g={categories:[]},h,v,k,w,s;for(w=0;w<d.length;w++){h=d[w];v={};v[a]=h;k=[];v=this._collection.find(v,{orderBy:e});for(s=0;s<v.length;s++)g.categories.push(v[s][c]),k.push(v[s][b]);f.push({name:h,data:k})}return{xAxis:g,series:f}};d.prototype._hookEvents=function(){var a=this;a._collection.on("change",function(){a._changeListener.apply(a,arguments)});a._collection.on("drop",function(){a.drop.apply(a,
arguments)})};d.prototype._changeListener=function(){if("undefined"!==typeof this._collection&&this._chart){var a=this._collection.find();switch(this._options.type){case "pie":this._chart.series[0].setData(this.pieDataFromCollectionData(a,this._options.keyField,this._options.valField),!0,!0);break;case "bar":case "line":case "area":case "column":var c=this.seriesDataFromCollectionData(this._options.seriesField,this._options.keyField,this._options.valField,this._options.orderBy);this._chart.xAxis[0].setCategories(c.xAxis.categories);
for(a=0;a<c.series.length;a++)this._chart.series[a]?this._chart.series[a].setData(c.series[a].data,!0,!0):this._chart.addSeries(c.series[a],!0,!0)}}};d.prototype.drop=function(){"dropped"!==this._state&&(this._state="dropped",this._chart&&this._chart.destroy(),this._collection&&(this._collection.off("change",this._changeListener),this._collection.off("drop",this.drop),this._collection._highcharts&&delete this._collection._highcharts[this._options.selector]),delete this._chart,delete this._options,
delete this._collection,this.emit("drop",this));return!0};g.prototype.init=function(){this._highcharts={};f.apply(this,arguments)};g.prototype.pieChart=new b({object:function(a){a.type="pie";a.chartOptions=a.chartOptions||{};a.chartOptions.chart=a.chartOptions.chart||{};a.chartOptions.chart.type="pie";this._highcharts[a.selector]||(this._highcharts[a.selector]=new d(this,a));return this._highcharts[a.selector]},"*, string, string, string, ...":function(a,c,b,e,d){d=d||{};d.selector=a;d.keyField=c;
d.valField=b;d.seriesName=e;this.pieChart(d)}});g.prototype.lineChart=new b({object:function(a){a.type="line";a.chartOptions=a.chartOptions||{};a.chartOptions.chart=a.chartOptions.chart||{};a.chartOptions.chart.type="line";this._highcharts[a.selector]||(this._highcharts[a.selector]=new d(this,a));return this._highcharts[a.selector]},"*, string, string, string, ...":function(a,c,b,e,d){d=d||{};d.seriesField=c;d.selector=a;d.keyField=b;d.valField=e;this.lineChart(d)}});g.prototype.areaChart=new b({object:function(a){a.type=
"area";a.chartOptions=a.chartOptions||{};a.chartOptions.chart=a.chartOptions.chart||{};a.chartOptions.chart.type="area";this._highcharts[a.selector]||(this._highcharts[a.selector]=new d(this,a));return this._highcharts[a.selector]},"*, string, string, string, ...":function(a,c,b,e,d){d=d||{};d.seriesField=c;d.selector=a;d.keyField=b;d.valField=e;this.areaChart(d)}});g.prototype.columnChart=new b({object:function(a){a.type="column";a.chartOptions=a.chartOptions||{};a.chartOptions.chart=a.chartOptions.chart||
{};a.chartOptions.chart.type="column";this._highcharts[a.selector]||(this._highcharts[a.selector]=new d(this,a));return this._highcharts[a.selector]},"*, string, string, string, ...":function(a,c,b,e,d){d=d||{};d.seriesField=c;d.selector=a;d.keyField=b;d.valField=e;this.columnChart(d)}});g.prototype.barChart=new b({object:function(a){a.type="bar";a.chartOptions=a.chartOptions||{};a.chartOptions.chart=a.chartOptions.chart||{};a.chartOptions.chart.type="bar";this._highcharts[a.selector]||(this._highcharts[a.selector]=
new d(this,a));return this._highcharts[a.selector]},"*, string, string, string, ...":function(a,c,b,e,d){d=d||{};d.seriesField=c;d.selector=a;d.keyField=b;d.valField=e;this.barChart(d)}});g.prototype.stackedBarChart=new b({object:function(a){a.type="bar";a.chartOptions=a.chartOptions||{};a.chartOptions.chart=a.chartOptions.chart||{};a.chartOptions.chart.type="bar";a.plotOptions=a.plotOptions||{};a.plotOptions.series=a.plotOptions.series||{};a.plotOptions.series.stacking=a.plotOptions.series.stacking||
"normal";this._highcharts[a.selector]||(this._highcharts[a.selector]=new d(this,a));return this._highcharts[a.selector]},"*, string, string, string, ...":function(a,c,b,e,d){d=d||{};d.seriesField=c;d.selector=a;d.keyField=b;d.valField=e;this.stackedBarChart(d)}});g.prototype.dropChart=function(a){this._highcharts&&this._highcharts[a]&&this._highcharts[a].drop()};h.finishModule("Highchart");k.exports=d},{"./Overload":24,"./Shared":30}],11:[function(g,k,h){h=g("./Shared");var f=g("./Path"),b=function(){};
g=function(){this.init.apply(this,arguments)};g.prototype.init=function(d,a,c){this._btree=new (b.create(2,this.sortAsc));this._size=0;this._id=this._itemKeyHash(d,d);this.unique(a&&a.unique?a.unique:!1);void 0!==d&&this.keys(d);void 0!==c&&this.collection(c);this.name(a&&a.name?a.name:this._id)};h.addModule("IndexBinaryTree",g);h.mixin(g.prototype,"Mixin.ChainReactor");h.mixin(g.prototype,"Mixin.Sorting");g.prototype.id=function(){return this._id};g.prototype.state=function(){return this._state};
g.prototype.size=function(){return this._size};h.synthesize(g.prototype,"data");h.synthesize(g.prototype,"name");h.synthesize(g.prototype,"collection");h.synthesize(g.prototype,"type");h.synthesize(g.prototype,"unique");g.prototype.keys=function(b){return void 0!==b?(this._keys=b,this._keyCount=(new f).parse(this._keys).length,this):this._keys};g.prototype.rebuild=function(){if(this._collection){var d=this._collection.subset({},{$decouple:!1,$orderBy:this._keys}).find(),a,c=d.length;this._btree=new (b.create(2,
this.sortAsc));this._unique&&(this._uniqueLookup={});for(a=0;a<c;a++)this.insert(d[a])}this._state={name:this._name,keys:this._keys,indexSize:this._size,built:new Date,updated:new Date,ok:!0}};g.prototype.insert=function(b,a){var c=this._unique,f=this._itemKeyHash(b,this._keys);c&&(c=this._itemHash(b,this._keys),this._uniqueLookup[c]=b);c=this._btree.get(f);void 0===c&&(c=[],this._btree.put(f,c));c.push(b);this._size++};g.prototype.remove=function(b,a){var c=this._unique,f=this._itemKeyHash(b,this._keys),
e;c&&(c=this._itemHash(b,this._keys),delete this._uniqueLookup[c]);c=this._btree.get(f);void 0!==c&&(e=c.indexOf(b),-1<e&&(1===c.length?this._btree.del(f):c.splice(e,1),this._size--))};g.prototype.violation=function(b){b=this._itemHash(b,this._keys);return Boolean(this._uniqueLookup[b])};g.prototype.hashViolation=function(b){return Boolean(this._uniqueLookup[b])};g.prototype.lookup=function(b){return this._data[this._itemHash(b,this._keys)]||[]};g.prototype.match=function(b,a){var c=new f,g=c.parseArr(this._keys),
c=c.parseArr(b),e=[],n=0,h;for(h=0;h<g.length;h++)if(c[h]===g[h])n++,e.push(c[h]);else return{matchedKeys:[],totalKeyCount:c.length,score:0};return{matchedKeys:e,totalKeyCount:c.length,score:n}};g.prototype._itemHash=function(b,a){var c=new f,g,e="",n;g=c.parse(a);for(n=0;n<g.length;n++)e&&(e+="_"),e+=c.value(b,g[n].path).join(":");return e};g.prototype._itemKeyHash=function(b,a){var c=new f,g,e="",n;g=c.parse(a);for(n=0;n<g.length;n++)e&&(e+="_"),e+=c.keyValue(b,g[n].path);return e};g.prototype._itemHashArr=
function(b,a){var c=new f,g,e=[],n,h,t,q;g=c.parse(a);for(t=0;t<g.length;t++)for(n=c.value(b,g[t].path),h=0;h<n.length;h++)if(0===t)e.push(n[h]);else for(q=0;q<e.length;q++)e[q]=e[q]+"_"+n[h];return e};h.finishModule("IndexBinaryTree");k.exports=g},{"./Path":26,"./Shared":30}],12:[function(g,k,h){h=g("./Shared");var f=g("./Path");g=function(){this.init.apply(this,arguments)};g.prototype.init=function(b,d,a){this._crossRef={};this._size=0;this._id=this._itemKeyHash(b,b);this.data({});this.unique(d&&
d.unique?d.unique:!1);void 0!==b&&this.keys(b);void 0!==a&&this.collection(a);this.name(d&&d.name?d.name:this._id)};h.addModule("IndexHashMap",g);h.mixin(g.prototype,"Mixin.ChainReactor");g.prototype.id=function(){return this._id};g.prototype.state=function(){return this._state};g.prototype.size=function(){return this._size};h.synthesize(g.prototype,"data");h.synthesize(g.prototype,"name");h.synthesize(g.prototype,"collection");h.synthesize(g.prototype,"type");h.synthesize(g.prototype,"unique");g.prototype.keys=
function(b){return void 0!==b?(this._keys=b,this._keyCount=(new f).parse(this._keys).length,this):this._keys};g.prototype.rebuild=function(){if(this._collection){var b=this._collection.subset({},{$decouple:!1,$orderBy:this._keys}).find(),d,a=b.length;this._data={};this._unique&&(this._uniqueLookup={});for(d=0;d<a;d++)this.insert(b[d])}this._state={name:this._name,keys:this._keys,indexSize:this._size,built:new Date,updated:new Date,ok:!0}};g.prototype.insert=function(b,d){var a,c;this._unique&&(a=
this._itemHash(b,this._keys),this._uniqueLookup[a]=b);a=this._itemHashArr(b,this._keys);for(c=0;c<a.length;c++)this.pushToPathValue(a[c],b)};g.prototype.remove=function(b,d){var a,c;this._unique&&(a=this._itemHash(b,this._keys),delete this._uniqueLookup[a]);a=this._itemHashArr(b,this._keys);for(c=0;c<a.length;c++)this.pullFromPathValue(a[c],b)};g.prototype.violation=function(b){b=this._itemHash(b,this._keys);return Boolean(this._uniqueLookup[b])};g.prototype.hashViolation=function(b){return Boolean(this._uniqueLookup[b])};
g.prototype.pushToPathValue=function(b,d){var a=this._data[b]=this._data[b]||[];-1===a.indexOf(d)&&(a.push(d),this._size++,this.pushToCrossRef(d,a))};g.prototype.pullFromPathValue=function(b,d){var a=this._data[b],c;c=a.indexOf(d);-1<c&&(a.splice(c,1),this._size--,this.pullFromCrossRef(d,a));a.length||delete this._data[b]};g.prototype.pull=function(b){var d=b[this._collection.primaryKey()],a=this._crossRef[d],c,f=a.length,e;for(c=0;c<f;c++)e=a[c],this._pullFromArray(e,b);this._size--;delete this._crossRef[d]};
g.prototype._pullFromArray=function(b,d){for(var a=b.length;a--;)b[a]===d&&b.splice(a,1)};g.prototype.pushToCrossRef=function(b,d){var a=b[this._collection.primaryKey()];this._crossRef[a]=this._crossRef[a]||[];a=this._crossRef[a];-1===a.indexOf(d)&&a.push(d)};g.prototype.pullFromCrossRef=function(b,d){var a=b[this._collection.primaryKey()];delete this._crossRef[a]};g.prototype.lookup=function(b){return this._data[this._itemHash(b,this._keys)]||[]};g.prototype.match=function(b,d){var a=new f,c=a.parseArr(this._keys),
a=a.parseArr(b),g=[],e=0,n;for(n=0;n<c.length;n++)if(a[n]===c[n])e++,g.push(a[n]);else return{matchedKeys:[],totalKeyCount:a.length,score:0};return{matchedKeys:g,totalKeyCount:a.length,score:e}};g.prototype._itemHash=function(b,d){var a=new f,c,g="",e;c=a.parse(d);for(e=0;e<c.length;e++)g&&(g+="_"),g+=a.value(b,c[e].path).join(":");return g};g.prototype._itemKeyHash=function(b,d){var a=new f,c,g="",e;c=a.parse(d);for(e=0;e<c.length;e++)g&&(g+="_"),g+=a.keyValue(b,c[e].path);return g};g.prototype._itemHashArr=
function(b,d){var a=new f,c,g=[],e,n,h,t;c=a.parse(d);for(h=0;h<c.length;h++)for(e=a.value(b,c[h].path),n=0;n<e.length;n++)if(0===h)g.push(e[n]);else for(t=0;t<g.length;t++)g[t]=g[t]+"_"+e[n];return g};h.finishModule("IndexHashMap");k.exports=g},{"./Path":26,"./Shared":30}],13:[function(g,k,h){g=g("./Shared");h=function(f){this.init.apply(this,arguments)};h.prototype.init=function(f){this._name=f;this._data={};this._primaryKey="_id"};g.addModule("KeyValueStore",h);g.mixin(h.prototype,"Mixin.ChainReactor");
g.synthesize(h.prototype,"name");h.prototype.primaryKey=function(f){return void 0!==f?(this._primaryKey=f,this):this._primaryKey};h.prototype.truncate=function(){this._data={};return this};h.prototype.set=function(f,b){this._data[f]=b?b:!0;return this};h.prototype.get=function(f){return this._data[f]};h.prototype.lookup=function(f){f=f[this._primaryKey];var b,d,a,c;if(f instanceof Array){d=f.length;c=[];for(b=0;b<d;b++)(a=this._data[f[b]])&&c.push(a);return c}if(f instanceof RegExp){c=[];for(b in this._data)this._data.hasOwnProperty(b)&&
f.test(b)&&c.push(this._data[b]);return c}if("object"===typeof f){if(f.$ne){c=[];for(b in this._data)this._data.hasOwnProperty(b)&&b!==f.$ne&&c.push(this._data[b]);return c}if(f.$in&&f.$in instanceof Array){c=[];for(b in this._data)this._data.hasOwnProperty(b)&&-1<f.$in.indexOf(b)&&c.push(this._data[b]);return c}if(f.$nin&&f.$nin instanceof Array){c=[];for(b in this._data)this._data.hasOwnProperty(b)&&-1===f.$nin.indexOf(b)&&c.push(this._data[b]);return c}if(f.$or&&f.$or instanceof Array){c=[];for(b=
0;b<f.$or.length;b++)c=c.concat(this.lookup(f.$or[b]));return c}}else return a=this._data[f],void 0!==a?[a]:[]};h.prototype.unSet=function(f){delete this._data[f];return this};h.prototype.uniqueSet=function(f,b){return void 0===this._data[f]?(this._data[f]=b,!0):!1};g.finishModule("KeyValueStore");k.exports=h},{"./Shared":30}],14:[function(g,k,h){h=g("./Shared");var f=g("./Operation");g=function(){this.init.apply(this,arguments)};g.prototype.init=function(){this._data=[]};h.addModule("Metrics",g);
h.mixin(g.prototype,"Mixin.ChainReactor");g.prototype.create=function(b){b=new f(b);this._enabled&&this._data.push(b);return b};g.prototype.start=function(){this._enabled=!0;return this};g.prototype.stop=function(){this._enabled=!1;return this};g.prototype.clear=function(){this._data=[];return this};g.prototype.list=function(){return this._data};h.finishModule("Metrics");k.exports=g},{"./Operation":23,"./Shared":30}],15:[function(g,k,h){k.exports={preSetData:function(){},postSetData:function(){}}},
{}],16:[function(g,k,h){k.exports={chain:function(f){this._chain=this._chain||[];-1===this._chain.indexOf(f)&&this._chain.push(f)},unChain:function(f){this._chain&&(f=this._chain.indexOf(f),-1<f&&this._chain.splice(f,1))},chainSend:function(f,b,d){if(this._chain){var a=this._chain,c=a.length,g;for(g=0;g<c;g++)a[g].chainReceive(this,f,b,d)}},chainReceive:function(f,b,d,a){f={sender:f,type:b,data:d,options:a};(!this._chainHandler||this._chainHandler&&!this._chainHandler(f))&&this.chainSend(f.type,f.data,
f.options)}}},{}],17:[function(g,k,h){var f=0;g={decouple:function(b,d){if(void 0!==b){if(d){var a,c=JSON.stringify(b),f=[];for(a=0;a<d;a++)f.push(JSON.parse(c));return f}return JSON.parse(JSON.stringify(b))}},objectId:function(b){var d=Math.pow(10,17);if(b){var a=0,c=b.length,g;for(g=0;g<c;g++)a+=b.charCodeAt(g)*d;b=a.toString(16)}else f++,b=(f+(Math.random()*d+Math.random()*d+Math.random()*d+Math.random()*d)).toString(16);return b},debug:g("./Overload")([function(){return this._debug&&this._debug.all},
function(b){return void 0!==b?"boolean"===typeof b?(this._debug=this._debug||{},this._debug.all=b,this.chainSend("debug",this._debug),this):this._debug&&this._debug[b]||this._db&&this._db._debug&&this._db._debug[b]||this._debug&&this._debug.all:this._debug&&this._debug.all},function(b,d){return void 0!==b?void 0!==d?(this._debug=this._debug||{},this._debug[b]=d,this.chainSend("debug",this._debug),this):this._debug&&this._debug[d]||this._db&&this._db._debug&&this._db._debug[b]:this._debug&&this._debug.all}])};
k.exports=g},{"./Overload":24}],18:[function(g,k,h){k.exports={TYPE_INSERT:0,TYPE_UPDATE:1,TYPE_REMOVE:2,PHASE_BEFORE:0,PHASE_AFTER:1}},{}],19:[function(g,k,h){g=g("./Overload");g={on:new g({"string, function":function(f,b){this._listeners=this._listeners||{};this._listeners[f]=this._listeners[f]||{};this._listeners[f]["*"]=this._listeners[f]["*"]||[];this._listeners[f]["*"].push(b);return this},"string, *, function":function(f,b,d){this._listeners=this._listeners||{};this._listeners[f]=this._listeners[f]||
{};this._listeners[f][b]=this._listeners[f][b]||[];this._listeners[f][b].push(d);return this}}),off:new g({string:function(f){this._listeners&&this._listeners[f]&&f in this._listeners&&delete this._listeners[f];return this},"string, function":function(f,b){var d,a;"string"===typeof b?this._listeners&&this._listeners[f]&&this._listeners[f][b]&&delete this._listeners[f][b]:f in this._listeners&&(d=this._listeners[f]["*"],a=d.indexOf(b),-1<a&&d.splice(a,1));return this},"string, *, function":function(f,
b,d){this._listeners&&f in this._listeners&&b in this.listeners[f]&&(f=this._listeners[f][b],d=f.indexOf(d),-1<d&&f.splice(d,1))},"string, *":function(f,b){this._listeners&&f in this._listeners&&b in this._listeners[f]&&delete this._listeners[f][b]}}),emit:function(f,b){this._listeners=this._listeners||{};if(f in this._listeners){var d,a;if(this._listeners[f]["*"]){var c=this._listeners[f]["*"];a=c.length;for(d=0;d<a;d++)c[d].apply(this,Array.prototype.slice.call(arguments,1))}if(b instanceof Array&&
b[0]&&b[0][this._primaryKey]){var c=this._listeners[f],g,e;a=b.length;for(d=0;d<a;d++)if(c[b[d][this._primaryKey]])for(g=c[b[d][this._primaryKey]].length,e=0;e<g;e++)c[b[d][this._primaryKey]][e].apply(this,Array.prototype.slice.call(arguments,1))}}return this}};k.exports=g},{"./Overload":24}],20:[function(g,k,h){k.exports={_match:function(f,b,d){var a,c;a=typeof f;c=typeof b;var g=!0,e;if(!("string"!==a&&"number"!==a||"string"!==c&&"number"!==c))"number"===a?f!==b&&(g=!1):f.localeCompare(b)&&(g=!1);
else for(e in b)if(b.hasOwnProperty(e)){a=!1;if("$"===e.substr(0,1)&&(c=this._matchOp(e,f,b[e]),-1<c)){if(c){if("or"===d)return!0}else g=c;a=!0}if(!a&&b[e]instanceof RegExp)if(a=!0,"object"===typeof f&&void 0!==f[e]&&b[e].test(f[e])){if("or"===d)return!0}else g=!1;if(!a)if("object"===typeof b[e])if(void 0!==f[e]){if(f[e]instanceof Array&&!(b[e]instanceof Array))for(a=!1,c=0;c<f[e].length&&!(a=this._match(f[e][c],b[e],void 0));c++);else if(!(f[e]instanceof Array)&&b[e]instanceof Array)for(a=!1,c=0;c<
b[e].length&&!(a=this._match(f[e],b[e][c],void 0));c++);else a="object"===typeof f?this._match(f[e],b[e],void 0):this._match(void 0,b[e],void 0);if(a){if("or"===d)return!0}else g=!1}else if(b[e]&&void 0!==b[e].$exists)if(a=this._match(void 0,b[e],void 0)){if("or"===d)return!0}else g=!1;else g=!1;else if(f&&f[e]===b[e]){if("or"===d)return!0}else if(f&&f[e]&&f[e]instanceof Array&&b[e]&&"object"!==typeof b[e]){a=!1;for(c=0;c<f[e].length&&!(a=this._match(f[e][c],b[e],void 0));c++);if(a){if("or"===d)return!0}else g=
!1}else g=!1;if("and"===d&&!g)return!1}return g},_matchOp:function(f,b,d){switch(f){case "$gt":return b>d;case "$gte":return b>=d;case "$lt":return b<d;case "$lte":return b<=d;case "$exists":return void 0===b!==d;case "$ne":return b!=d;case "$or":for(f=0;f<d.length;f++)if(this._match(b,d[f],"and"))return!0;return!1;case "$and":for(f=0;f<d.length;f++)if(!this._match(b,d[f],"and"))return!1;return!0;case "$in":if(d instanceof Array){f=d.length;var a;for(a=0;a<f;a++)if(d[a]===b)return!0;return!1}throw'ForerunnerDB.Mixin.Matching "'+
this.name()+'": Cannot use an $in operator on a non-array key: '+f;case "$nin":if(d instanceof Array){f=d.length;for(a=0;a<f;a++)if(d[a]===b)return!1;return!0}throw'ForerunnerDB.Mixin.Matching "'+this.name()+'": Cannot use a $nin operator on a non-array key: '+f;}return-1}}},{}],21:[function(g,k,h){k.exports={sortAsc:function(f,b){return"string"===typeof f&&"string"===typeof b?f.localeCompare(b):f>b?1:f<b?-1:0},sortDesc:function(f,b){return"string"===typeof f&&"string"===typeof b?b.localeCompare(f):
f>b?-1:f<b?1:0}}},{}],22:[function(g,k,h){k.exports={addTrigger:function(f,b,d,a){return-1===this._triggerIndex(f,b,d)?(this._trigger=this._trigger||{},this._trigger[b]=this._trigger[b]||{},this._trigger[b][d]=this._trigger[b][d]||[],this._trigger[b][d].push({id:f,method:a}),!0):!1},removeTrigger:function(f,b,d){f=this._triggerIndex(f,b,d);-1<f&&this._trigger[b][d].splice(f,1);return!1},willTrigger:function(f,b){return this._trigger&&this._trigger[f]&&this._trigger[f][b]&&this._trigger[f][b].length},
processTrigger:function(f,b,d,a,c){var g,e;if(this._trigger&&this._trigger[b]&&this._trigger[b][d]){b=this._trigger[b][d];g=b.length;for(d=0;d<g;d++){e=b[d];this.debug();e=e.method.call(this,f,a,c);if(!1===e)return!1;if(void 0!==e&&!0!==e&&!1!==e)throw"ForerunnerDB.Mixin.Triggers: Trigger error: "+e;}return!0}},_triggerIndex:function(f,b,d){var a;if(this._trigger&&this._trigger[b]&&this._trigger[b][d])for(b=this._trigger[b][d],d=b.length,a=0;a<d;a++)if(b[a].id===f)return a;return-1}}},{}],23:[function(g,
k,h){h=g("./Shared");var f=g("./Path");g=function(b){this.pathSolver=new f;this.counter=0;this.init.apply(this,arguments)};g.prototype.init=function(b){this._data={operation:b,index:{potential:[],used:!1},steps:[],time:{startMs:0,stopMs:0,totalMs:0,process:{}},flag:{},log:[]}};h.addModule("Operation",g);h.mixin(g.prototype,"Mixin.ChainReactor");g.prototype.start=function(){this._data.time.startMs=(new Date).getTime()};g.prototype.log=function(b){if(b){var d=0<this._log.length?this._data.log[this._data.log.length-
1].time:0;b={event:b,time:(new Date).getTime(),delta:0};this._data.log.push(b);d&&(b.delta=b.time-d);return this}return this._data.log};g.prototype.time=function(b){if(void 0!==b){var d=this._data.time.process,d=d[b]=d[b]||{};d.startMs?(d.stopMs=(new Date).getTime(),d.totalMs=d.stopMs-d.startMs,d.stepObj.totalMs=d.totalMs,delete d.stepObj):(d.startMs=(new Date).getTime(),d.stepObj={name:b},this._data.steps.push(d.stepObj));return this}return this._data.time};g.prototype.flag=function(b,d){if(void 0!==
b&&void 0!==d)this._data.flag[b]=d;else return void 0!==b?this._data.flag[b]:this._data.flag};g.prototype.data=function(b,d,a){return void 0!==d?(this.pathSolver.set(this._data,b,d),this):this.pathSolver.get(this._data,b)};g.prototype.pushData=function(b,d,a){this.pathSolver.push(this._data,b,d)};g.prototype.stop=function(){this._data.time.stopMs=(new Date).getTime();this._data.time.totalMs=this._data.time.stopMs-this._data.time.startMs};h.finishModule("Operation");k.exports=g},{"./Path":26,"./Shared":30}],
24:[function(g,k,h){Overload=function(f){if(f){var b,d,a,c,g;if(!(f instanceof Array)){a={};for(b in f)if(f.hasOwnProperty(b))if(c=b.replace(/ /g,""),-1===c.indexOf("*"))a[c]=f[b];else for(g=generateSignaturePermutations(c),c=0;c<g.length;c++)a[g[c]]||(a[g[c]]=f[b]);f=a}return function(){var a=[],c;if(f instanceof Array)for(d=f.length,b=0;b<d;b++){if(f[b].length===arguments.length)return f[b].apply(this,arguments)}else{for(b=0;b<arguments.length;b++)c=typeof arguments[b],"object"===c&&arguments[b]instanceof
Array&&(c="array"),a.push(c);c=a.join(",");if(f[c])return f[c].apply(this,arguments);for(b=a.length;0<=b;b--)if(c=a.slice(0,b).join(","),f[c+",..."])return f[c+",..."].apply(this,arguments)}throw'ForerunnerDB.Overload "'+this.name()+'": Overloaded method does not have a matching signature for the passed arguments: '+JSON.stringify(a);}}return function(){}};generateSignaturePermutations=function(f){var b=[],d,a=["string","object","number","function","undefined"],c;if(-1<f.indexOf("*"))for(c=0;c<a.length;c++)d=
f.replace("*",a[c]),b=b.concat(generateSignaturePermutations(d));else b.push(f);return b};k.exports=Overload},{}],25:[function(g,k,h){var f,b,d;h=g("./Shared");var a=function(){this.init.apply(this,arguments)};a.prototype.init=function(a){var f=this;this._name=a;this._data=new d("__FDB__dc_data_"+this._name);this._collData=new b;this._collections=[];this._collectionDroppedWrap=function(){f._collectionDropped.apply(f,arguments)}};h.addModule("Overview",a);h.mixin(a.prototype,"Mixin.Common");h.mixin(a.prototype,
"Mixin.ChainReactor");h.mixin(a.prototype,"Mixin.Constants");h.mixin(a.prototype,"Mixin.Triggers");h.mixin(a.prototype,"Mixin.Events");b=g("./Collection");d=g("./Document");g=h.modules.Core;f=h.modules.Core.prototype.init;h.synthesize(a.prototype,"state");h.synthesize(a.prototype,"db");h.synthesize(a.prototype,"name");h.synthesize(a.prototype,"query",function(a){var b=this.$super(a);void 0!==a&&this._refresh();return b});h.synthesize(a.prototype,"queryOptions",function(a){var b=this.$super(a);void 0!==
a&&this._refresh();return b});h.synthesize(a.prototype,"reduce",function(a){var b=this.$super(a);void 0!==a&&this._refresh();return b});a.prototype.from=function(a){return void 0!==a?("string"===typeof a&&(a=this._db.collection(a)),this._addCollection(a),this):this._collections};a.prototype.find=function(){return this._collData.find.apply(this._collData,arguments)};a.prototype.count=function(){return this._collData.count.apply(this._collData,arguments)};a.prototype._addCollection=function(a){-1===
this._collections.indexOf(a)&&(this._collections.push(a),a.chain(this),a.on("drop",this._collectionDroppedWrap),this._refresh());return this};a.prototype._removeCollection=function(a){-1<this._collections.indexOf(a)&&(this._collections.splice(a,1),a.unChain(this),a.off("drop",this._collectionDroppedWrap),this._refresh());return this};a.prototype._collectionDropped=function(a){a&&this._removeCollection(a)};a.prototype._refresh=function(){if("dropped"!==this._state){if(this._collections&&this._collections[0]){this._collData.primaryKey(this._collections[0].primaryKey());
var a=[],b;for(b=0;b<this._collections.length;b++)a=a.concat(this._collections[b].find(this._query,this._queryOptions));this._collData.setData(a)}this._reduce&&(a=this._reduce(),this._data.setData(a))}};a.prototype._chainHandler=function(a){switch(a.type){case "setData":case "insert":case "update":case "remove":this._refresh()}};a.prototype.data=function(){return this._data};a.prototype.drop=function(){if("dropped"!==this._state){this._state="dropped";delete this._data;for(delete this._collData;this._collections.length;)this._removeCollection(this._collections[0]);
delete this._collections;this._db&&this._name&&delete this._db._overview[this._name];delete this._name;this.emit("drop",this)}return!0};g.prototype.init=function(){this._overview={};f.apply(this,arguments)};g.prototype.overview=function(c){return c?(this._overview[c]=this._overview[c]||(new a(c)).db(this),this._overview[c]):this._overview};h.finishModule("Overview");k.exports=a},{"./Collection":4,"./Document":8,"./Shared":30}],26:[function(g,k,h){g=g("./Shared");h=function(f){this.init.apply(this,
arguments)};h.prototype.init=function(f){f&&this.path(f)};g.addModule("Path",h);g.mixin(h.prototype,"Mixin.ChainReactor");h.prototype.path=function(f){return void 0!==f?(this._path=this.clean(f),this._pathParts=this._path.split("."),this):this._path};h.prototype.hasObjectPaths=function(f,b){var d=!0,a;for(a in f)if(f.hasOwnProperty(a)&&(void 0===b[a]||"object"===typeof f[a]&&(d=this.hasObjectPaths(f[a],b[a]),!d)))return!1;return d};h.prototype.countKeys=function(f){var b=0,d;for(d in f)f.hasOwnProperty(d)&&
void 0!==f[d]&&("object"!==typeof f[d]?b++:b+=this.countKeys(f[d]));return b};h.prototype.countObjectPaths=function(f,b){var d,a={},c=0,g=0,e;for(e in b)b.hasOwnProperty(e)&&("object"===typeof b[e]?(d=this.countObjectPaths(f[e],b[e]),a[e]=d.matchedKeys,g+=d.totalKeyCount,c+=d.matchedKeyCount):(g++,f&&f[e]&&"object"!==typeof f[e]?(a[e]=!0,c++):a[e]=!1));return{matchedKeys:a,matchedKeyCount:c,totalKeyCount:g}};h.prototype.parse=function(f,b){var d=[],a="",c,g,e;for(g in f)if(f.hasOwnProperty(g))if(a=
g,"object"===typeof f[g])if(b)for(c=this.parse(f[g],b),e=0;e<c.length;e++)d.push({path:a+"."+c[e].path,value:c[e].value});else for(c=this.parse(f[g]),e=0;e<c.length;e++)d.push({path:a+"."+c[e].path});else b?d.push({path:a,value:f[g]}):d.push({path:a});return d};h.prototype.parseArr=function(f,b){b=b||{};return this._parseArr(f,"",[],b)};h.prototype._parseArr=function(f,b,d,a){var c,g="";b=b||"";d=d||[];for(c in f)f.hasOwnProperty(c)&&(!a.ignore||a.ignore&&!a.ignore.test(c))&&(g=b?b+"."+c:c,"object"===
typeof f[c]?this._parseArr(f[c],g,d,a):d.push(g));return d};h.prototype.value=function(f,b){if(void 0!==f&&"object"===typeof f){var d,a,c,g,e=[],n;void 0!==b&&(b=this.clean(b),d=b.split("."));d=d||this._pathParts;a=d.length;c=f;for(n=0;n<a;n++){c=c[d[n]];if(g instanceof Array){for(a=0;a<g.length;a++)e=e.concat(this.value(g,a+"."+d[n]));return e}if(!c||"object"!==typeof c)break;g=c}return[c]}return[]};h.prototype.set=function(f,b,d){if(void 0!==f&&void 0!==b){var a;b=this.clean(b);b=b.split(".");a=
b.shift();b.length?(f[a]=f[a]||{},this.set(f[a],b.join("."),d)):f[a]=d}return f};h.prototype.get=function(f,b){return this.value(f,b)[0]};h.prototype.push=function(f,b,d){if(void 0!==f&&void 0!==b){var a;b=this.clean(b);b=b.split(".");a=b.shift();if(b.length)f[a]=f[a]||{},this.set(f[a],b.join("."),d);else if(f[a]=f[a]||[],f[a]instanceof Array)f[a].push(d);else throw"ForerunnerDB.Path: Cannot push to a path whose endpoint is not an array!";}return f};h.prototype.keyValue=function(f,b){var d,a,c,g,
e;void 0!==b&&(b=this.clean(b),d=b.split("."));d=d||this._pathParts;a=d.length;c=f;for(e=0;e<a;e++)if(c=c[d[e]],!c||"object"!==typeof c){g=d[e]+":"+c;break}return g};h.prototype.clean=function(f){"."===f.substr(0,1)&&(f=f.substr(1,f.length-1));return f};g.finishModule("Path");k.exports=h},{"./Shared":30}],27:[function(g,k,h){h=g("./Shared");var f=g("localforage"),b,d,a,c,m;m=function(){this.init.apply(this,arguments)};m.prototype.init=function(a){a.isClient()&&void 0!==Storage&&(this.mode("localforage"),
f.config({driver:[f.INDEXEDDB,f.WEBSQL,f.LOCALSTORAGE],name:"ForerunnerDB",storeName:"FDB"}))};h.addModule("Persist",m);h.mixin(m.prototype,"Mixin.ChainReactor");b=h.modules.Core;d=g("./Collection");a=d.prototype.drop;g("./CollectionGroup");c=b.prototype.init;g=h.overload;m.prototype.mode=function(a){return void 0!==a?(this._mode=a,this):this._mode};m.prototype.driver=function(a){if(void 0!==a){switch(a.toUpperCase()){case "LOCALSTORAGE":f.setDriver(f.LOCALSTORAGE);break;case "WEBSQL":f.setDriver(f.WEBSQL);
break;case "INDEXEDDB":f.setDriver(f.INDEXEDDB);break;default:throw"ForerunnerDB.Persist: The persistence driver you have specified is not found. Please use either IndexedDB, WebSQL or LocalStorage!";}return this}return f.driver()};m.prototype.save=function(a,c,b){var d;d=function(a,c){a="object"===typeof a?"json::fdb::"+JSON.stringify(a):"raw::fdb::"+a;c&&c(!1,a)};switch(this.mode()){case "localforage":d(c,function(c,d){f.setItem(a,d).then(function(a){b(!1,a)},function(a){b(a)})});break;default:b&&
b("No data handler.")}};m.prototype.load=function(a,c){var b,d,g;g=function(a,c){if(a){b=a.split("::fdb::");switch(b[0]){case "json":d=JSON.parse(b[1]);break;case "raw":d=b[1]}c&&c(!1,d)}else c(!1,a)};switch(this.mode()){case "localforage":f.getItem(a).then(function(a){g(a,c)},function(a){c(a)});break;default:c&&c("No data handler or unrecognised data type.")}};m.prototype.drop=function(a,c){switch(this.mode()){case "localforage":f.removeItem(a).then(function(){c(!1)},function(a){c(a)});break;default:c&&
c("No data handler or unrecognised data type.")}};d.prototype.drop=new g({"":function(){"dropped"!==this._state&&this.drop(!0)},"function":function(a){"dropped"!==this._state&&this.drop(!0,a)},"boolean":function(c){if("dropped"!==this._state){if(c)if(this._name)if(this._db)this._db.persist.drop(this._name);else throw"ForerunnerDB.Persist: Cannot drop a collection's persistent storage when the collection is not attached to a database!";else throw"ForerunnerDB.Persist: Cannot drop a collection's persistent storage when no name assigned to collection!";
a.apply(this,arguments)}},"boolean, function":function(c,b){"dropped"!==this._state&&(c&&(this._name?this._db?this._db.persist.drop(this._name,b):b&&b("Cannot drop a collection's persistent storage when the collection is not attached to a database!"):b&&b("Cannot drop a collection's persistent storage when no name assigned to collection!")),a.apply(this,arguments))}});d.prototype.save=function(a){this._name?this._db?this._db.persist.save(this._name,this._data,a):a&&a("Cannot save a collection that is not attached to a database!"):
a&&a("Cannot save a collection with no assigned name!")};d.prototype.load=function(a){var c=this;this._name?this._db?this._db.persist.load(this._name,function(b,d){b?a&&a(b):(d&&c.setData(d),a&&a(!1))}):a&&a("Cannot load a collection that is not attached to a database!"):a&&a("Cannot load a collection with no assigned name!")};b.prototype.init=function(){this.persist=new m(this);c.apply(this,arguments)};b.prototype.load=function(a){var c=this._collection,b=c.keys().length,d,f;d=function(c){c?a(c):
(b--,0===b&&a(!1))};for(f in c)c.hasOwnProperty(f)&&c[f].load(d)};b.prototype.save=function(a){var c=this._collection,b=c.keys().length,d,f;d=function(c){c?a(c):(b--,0===b&&a(!1))};for(f in c)c.hasOwnProperty(f)&&c[f].save(d)};h.finishModule("Persist");k.exports=m},{"./Collection":4,"./CollectionGroup":5,"./Shared":30,localforage:39}],28:[function(g,k,h){g=g("./Shared");h=function(f,b,d){if(f&&b&&d){this._reactorIn=f;this._reactorOut=b;this._chainHandler=d;if(!f.chain||!b.chainReceive)throw"ForerunnerDB.ReactorIO: ReactorIO requires passed in and out objects to implement the ChainReactor mixin!";
f.chain(this);this.chain(b)}else throw"ForerunnerDB.ReactorIO: ReactorIO requires an in, out and process argument to instantiate!";};g.addModule("ReactorIO",h);h.prototype.drop=function(){"dropped"!==this._state&&(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));return!0};g.synthesize(h.prototype,"state");g.mixin(h.prototype,"Mixin.ChainReactor");
g.mixin(h.prototype,"Mixin.Events");g.finishModule("ReactorIO");k.exports=h},{"./Shared":30}],29:[function(g,k,h){h=g("./Shared");var f=g("rest"),b=g("rest/interceptor/mime"),d=function(){this.init.apply(this,arguments)};d.prototype.init=function(a){this._endPoint="";this._client=f.wrap(b)};d.prototype._params=function(a){var c=[],b;for(b in a)a.hasOwnProperty(b)&&c.push(encodeURIComponent(b)+"="+encodeURIComponent(a[b]));return c.join("&")};d.prototype.get=function(a,c,b){var e=this,d;a=void 0!==
a?a:"";console.log("Getting: ",this.endPoint()+a+"?"+this._params(c));this._client({method:"get",path:this.endPoint()+a,params:c}).then(function(a){a.entity&&a.entity.error?b(a.entity.error,a.entity,a):((d=e.collection())&&d.upsert(a.entity),b(!1,a.entity,a))},function(a){b(!0,a.entity,a)})};d.prototype.post=function(a,c,b){this._client({method:"post",path:this.endPoint()+a,entity:c,headers:{"Content-Type":"application/json"}}).then(function(a){a.entity&&a.entity.error?b(a.entity.error,a.entity,a):
b(!1,a.entity,a)},function(a){b(!0,a)})};h.synthesize(d.prototype,"sessionData");h.synthesize(d.prototype,"endPoint");h.synthesize(d.prototype,"collection");h.addModule("Rest",d);h.mixin(d.prototype,"Mixin.ChainReactor");Core=h.modules.Core;Collection=g("./Collection");CollectionDrop=Collection.prototype.drop;CollectionGroup=g("./CollectionGroup");CollectionInit=Collection.prototype.init;CoreInit=Core.prototype.init;Overload=h.overload;Collection.prototype.init=function(){this.rest=new d;this.rest.collection(this);
CollectionInit.apply(this,arguments)};Core.prototype.init=function(){this.rest=new d;CoreInit.apply(this,arguments)};h.finishModule("Rest");k.exports=d},{"./Collection":4,"./CollectionGroup":5,"./Shared":30,rest:42,"rest/interceptor/mime":47}],30:[function(g,k,h){g={version:"1.3.8",modules:{},_synth:{},addModule:function(f,b){this.modules[f]=b;this.emit("moduleLoad",[f,b])},finishModule:function(f){if(this.modules[f])this.modules[f]._fdbFinished=!0,this.emit("moduleFinished",[f,this.modules[f]]);
else throw"ForerunnerDB.Shared: finishModule called on a module that has not been registered with addModule(): "+f;},moduleFinished:function(f,b){if(this.modules[f]&&this.modules[f]._fdbFinished)b(f,this.modules[f]);else this.on("moduleFinished",b)},moduleExists:function(f){return Boolean(this.modules[f])},mixin:function(f,b){var d=this.mixins[b];if(d)for(var a in d)d.hasOwnProperty(a)&&(f[a]=d[a]);else throw"ForerunnerDB.Shared: Cannot find mixin named: "+b;},synthesize:function(f,b,d){this._synth[b]=
this._synth[b]||function(a){return void 0!==a?(this["_"+b]=a,this):this["_"+b]};if(d){var a=this;f[b]=function(){var c=this.$super,f;this.$super=a._synth[b];f=d.apply(this,arguments);this.$super=c;return f}}else f[b]=this._synth[b]},overload:g("./Overload"),mixins:{"Mixin.Common":g("./Mixin.Common"),"Mixin.Events":g("./Mixin.Events"),"Mixin.ChainReactor":g("./Mixin.ChainReactor"),"Mixin.CRUD":g("./Mixin.CRUD"),"Mixin.Constants":g("./Mixin.Constants"),"Mixin.Triggers":g("./Mixin.Triggers"),"Mixin.Sorting":g("./Mixin.Sorting"),
"Mixin.Matching":g("./Mixin.Matching")}};g.mixin(g,"Mixin.Events");k.exports=g},{"./Mixin.CRUD":15,"./Mixin.ChainReactor":16,"./Mixin.Common":17,"./Mixin.Constants":18,"./Mixin.Events":19,"./Mixin.Matching":20,"./Mixin.Sorting":21,"./Mixin.Triggers":22,"./Overload":24}],31:[function(g,k,h){Array.prototype.filter||(Array.prototype.filter=function(f){if(void 0===this||null===this)throw new TypeError;var b=Object(this),d=b.length>>>0;if("function"!==typeof f)throw new TypeError;for(var a=[],c=2<=arguments.length?
arguments[1]:void 0,g=0;g<d;g++)if(g in b){var e=b[g];f.call(c,e,g,b)&&a.push(e)}return a});"function"!==typeof Object.create&&(Object.create=function(){var f=function(){};return function(b){if(1<arguments.length)throw Error("Second argument not supported");if("object"!==typeof b)throw TypeError("Argument must be an object");f.prototype=b;var d=new f;f.prototype=null;return d}}());Array.prototype.indexOf||(Array.prototype.indexOf=function(f,b){var d;if(null==this)throw new TypeError('"this" is null or not defined');
var a=Object(this),c=a.length>>>0;if(0===c)return-1;d=+b||0;Infinity===Math.abs(d)&&(d=0);if(d>=c)return-1;for(d=Math.max(0<=d?d:c-Math.abs(d),0);d<c;){if(d in a&&a[d]===f)return d;d++}return-1});k.exports={}},{}],32:[function(g,k,h){var f,b,d,a,c,m;h=g("./Shared");var e=function(a,c,b){this.init.apply(this,arguments)};e.prototype.init=function(a,c,b){var e=this;this._name=a;this._groups=[];this._listeners={};this._querySettings={};this._debug={};this.query(c,!1);this.queryOptions(b,!1);this._collectionDroppedWrap=
function(){e._collectionDropped.apply(e,arguments)};this._privateData=new f("__FDB__view_privateData_"+this._name)};h.addModule("View",e);h.mixin(e.prototype,"Mixin.Common");h.mixin(e.prototype,"Mixin.ChainReactor");h.mixin(e.prototype,"Mixin.Constants");h.mixin(e.prototype,"Mixin.Triggers");f=g("./Collection");b=g("./CollectionGroup");m=g("./ActiveBucket");c=g("./ReactorIO");d=f.prototype.init;g=h.modules.Core;a=g.prototype.init;h.synthesize(e.prototype,"state");h.synthesize(e.prototype,"name");
e.prototype.insert=function(){this._from.insert.apply(this._from,arguments)};e.prototype.update=function(){this._from.update.apply(this._from,arguments)};e.prototype.updateById=function(){this._from.updateById.apply(this._from,arguments)};e.prototype.remove=function(){this._from.remove.apply(this._from,arguments)};e.prototype.find=function(a,c){return this.publicData().find(a,c)};e.prototype.data=function(){return this._privateData};e.prototype.from=function(a){var b=this;if(void 0!==a){this._from&&
(this._from.off("drop",this._collectionDroppedWrap),this._from._removeView(this));"string"===typeof a&&(a=this._db.collection(a));this._from=a;this._io=new c(a,this,function(a){var c,e,d;if(b._querySettings.query){if("insert"===a.type){c=a.data;if(c instanceof Array)for(e=[],a=0;a<c.length;a++)b._privateData._match(c[a],b._querySettings.query,"and")&&(e.push(c[a]),d=!0);else b._privateData._match(c,b._querySettings.query,"and")&&(e=c,d=!0);d&&this.chainSend("insert",e);return!0}if("update"===a.type&&
(e=b._privateData.diff(b._from.subset(b._querySettings.query,b._querySettings.options)),e.insert.length||e.remove.length)){e.insert.length&&this.chainSend("insert",e.insert);if(e.update.length)for(d=b._privateData.primaryKey(),a=0;a<e.update.length;a++)c={},c[d]=e.update[a][d],this.chainSend("update",{query:c,update:e.update[a]});if(e.remove.length){d=b._privateData.primaryKey();c=[];var f={query:{$or:c}};for(a=0;a<e.remove.length;a++)c.push({_id:e.remove[a][d]});this.chainSend("remove",f)}return!0}}return!1});
var e=a.find(this._querySettings.query,this._querySettings.options);this._transformPrimaryKey(a.primaryKey());this._transformSetData(e);this._privateData.primaryKey(a.primaryKey());this._privateData.setData(e);this._querySettings.options&&this._querySettings.options.$orderBy?this.rebuildActiveBucket(this._querySettings.options.$orderBy):this.rebuildActiveBucket()}return this};e.prototype._collectionDropped=function(a){a&&delete this._from};e.prototype.ensureIndex=function(){return this._privateData.ensureIndex.apply(this._privateData,
arguments)};e.prototype._chainHandler=function(a){var c,b,e,d;switch(a.type){case "setData":this.debug()&&console.log('ForerunnerDB.View: Setting data on view "'+this.name()+'" in underlying (internal) view collection "'+this._privateData.name()+'"');a=this._from.find(this._querySettings.query,this._querySettings.options);this._transformSetData(a);this._privateData.setData(a);break;case "insert":this.debug()&&console.log('ForerunnerDB.View: Inserting some data on view "'+this.name()+'" in underlying (internal) view collection "'+
this._privateData.name()+'"');a.data=this.decouple(a.data);a.data instanceof Array||(a.data=[a.data]);if(this._querySettings.options&&this._querySettings.options.$orderBy)for(c=a.data,b=c.length,e=0;e<b;e++)d=this._activeBucket.insert(c[e]),this._transformInsert(a.data,d),this._privateData._insertHandle(a.data,d);else d=this._privateData._data.length,this._transformInsert(a.data,d),this._privateData._insertHandle(a.data,d);break;case "update":this.debug()&&console.log('ForerunnerDB.View: Updating some data on view "'+
this.name()+'" in underlying (internal) view collection "'+this._privateData.name()+'"');this._privateData.primaryKey();a=this._privateData.update(a.data.query,a.data.update,a.data.options);if(this._querySettings.options&&this._querySettings.options.$orderBy)for(b=a.length,e=0;e<b;e++)d=a[e],this._activeBucket.remove(d),c=this._privateData._data.indexOf(d),d=this._activeBucket.insert(d),c!==d&&this._privateData._updateSpliceMove(this._privateData._data,c,d);if(this._transformEnabled&&this._transformIn)for(b=
this._publicData.primaryKey(),c=0;c<a.length;c++)e={},d=a[c],e[b]=d[b],this._transformUpdate(e,d);break;case "remove":this.debug()&&console.log('ForerunnerDB.View: Removing some data on view "'+this.name()+'" in underlying (internal) view collection "'+this._privateData.name()+'"'),this._transformRemove(a.data.query,a.options),this._privateData.remove(a.data.query,a.options)}};e.prototype.on=function(){this._privateData.on.apply(this._privateData,arguments)};e.prototype.off=function(){this._privateData.off.apply(this._privateData,
arguments)};e.prototype.emit=function(){this._privateData.emit.apply(this._privateData,arguments)};e.prototype.drop=function(){if("dropped"!==this._state){if(this._from)return this._from.off("drop",this._collectionDroppedWrap),this._from._removeView(this),(this.debug()||this._db&&this._db.debug())&&console.log("ForerunnerDB.View: Dropping view "+this._name),this._state="dropped",this._io&&this._io.drop(),this._privateData&&this._privateData.drop(),this._db&&this._name&&delete this._db._view[this._name],
this.emit("drop",this),delete this._chain,delete this._from,delete this._privateData,delete this._io,delete this._groups,delete this._listeners,delete this._querySettings,delete this._db,!0}else return!0;return!1};e.prototype.db=function(a){return void 0!==a?(this._db=a,this.privateData().db(a),this.publicData().db(a),this):this._db};e.prototype.primaryKey=function(){return this._privateData.primaryKey()};e.prototype.queryData=function(a,c,b){void 0!==a&&(this._querySettings.query=a);void 0!==c&&
(this._querySettings.options=c);return void 0!==a||void 0!==c?(void 0!==b&&!0!==b||this.refresh(),this):this._querySettings};e.prototype.queryAdd=function(a,c,b){var e=this._querySettings.query,d;if(void 0!==a)for(d in a)a.hasOwnProperty(d)&&(void 0===e[d]||void 0!==e[d]&&c)&&(e[d]=a[d]);void 0!==b&&!0!==b||this.refresh()};e.prototype.queryRemove=function(a,c){var b=this._querySettings.query,e;if(void 0!==a)for(e in a)a.hasOwnProperty(e)&&delete b[e];void 0!==c&&!0!==c||this.refresh()};e.prototype.query=
function(a,c){return void 0!==a?(this._querySettings.query=a,void 0!==c&&!0!==c||this.refresh(),this):this._querySettings.query};e.prototype.orderBy=function(a){if(void 0!==a){var c=this.queryOptions()||{};c.$orderBy=a;this.queryOptions(c);return this}return(this.queryOptions()||{}).$orderBy};e.prototype.queryOptions=function(a,c){return void 0!==a?(this._querySettings.options=a,void 0===a.$decouple&&(a.$decouple=!0),void 0===c||!0===c?this.refresh():this.rebuildActiveBucket(a.$orderBy),this):this._querySettings.options};
e.prototype.rebuildActiveBucket=function(a){if(a){var c=this._privateData._data,b=c.length;this._activeBucket=new m(a);this._activeBucket.primaryKey(this._privateData.primaryKey());for(a=0;a<b;a++)this._activeBucket.insert(c[a])}else delete this._activeBucket};e.prototype.refresh=function(){if(this._from){var a=this.publicData();this._privateData.remove();a.remove();this._privateData.insert(this._from.find(this._querySettings.query,this._querySettings.options))}this._querySettings.options&&this._querySettings.options.$orderBy?
this.rebuildActiveBucket(this._querySettings.options.$orderBy):this.rebuildActiveBucket();return this};e.prototype.count=function(){return this._privateData&&this._privateData._data?this._privateData._data.length:0};e.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=!1!==a,this._transformPrimaryKey(this.privateData().primaryKey()),
this._transformSetData(this.privateData().find()),this):{enabled:this._transformEnabled,dataIn:this._transformIn,dataOut:this._transformOut}};e.prototype.privateData=function(){return this._privateData};e.prototype.publicData=function(){return this._transformEnabled?this._publicData:this._privateData};e.prototype._transformSetData=function(a){this._transformEnabled&&(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._publicData.setData(a))};e.prototype._transformInsert=function(a,c){this._transformEnabled&&this._publicData&&this._publicData.insert(a,c)};e.prototype._transformUpdate=function(a,c,b){this._transformEnabled&&this._publicData&&this._publicData.update(a,c,b)};e.prototype._transformRemove=function(a,c){this._transformEnabled&&this._publicData&&this._publicData.remove(a,c)};e.prototype._transformPrimaryKey=function(a){this._transformEnabled&&
this._publicData&&this._publicData.primaryKey(a)};f.prototype.init=function(){this._view=[];d.apply(this,arguments)};f.prototype.view=function(a,c,b){if(this._db&&this._db._view){if(this._db._view[a])throw'ForerunnerDB.Collection "'+this.name()+'": Cannot create a view using this collection because a view with this name already exists: '+a;a=(new e(a,c,b)).db(this._db).from(this);this._view=this._view||[];this._view.push(a);return a}};f.prototype._addView=b.prototype._addView=function(a){void 0!==
a&&this._view.push(a);return this};f.prototype._removeView=b.prototype._removeView=function(a){void 0!==a&&(a=this._view.indexOf(a),-1<a&&this._view.splice(a,1));return this};g.prototype.init=function(){this._view={};a.apply(this,arguments)};g.prototype.view=function(a){this._view[a]||(this.debug()||this._db&&this._db.debug())&&console.log("Core.View: Creating view "+a);this._view[a]=this._view[a]||(new e(a)).db(this);return this._view[a]};g.prototype.viewExists=function(a){return Boolean(this._view[a])};
g.prototype.views=function(){var a=[],c;for(c in this._view)this._view.hasOwnProperty(c)&&a.push({name:c,count:this._view[c].count()});return a};h.finishModule("View");k.exports=e},{"./ActiveBucket":3,"./Collection":4,"./CollectionGroup":5,"./ReactorIO":28,"./Shared":30}],33:[function(g,k,h){function f(c){function g(c){null===t?v.push(c):a(function(){var a=t?c.onFulfilled:c.onRejected;if(null===a)(t?c.resolve:c.reject)(q);else{var b;try{b=a(q)}catch(e){c.reject(e);return}c.resolve(b)}})}function e(a){try{if(a===
p)throw new TypeError("A promise cannot be resolved with itself.");if(a&&("object"===typeof a||"function"===typeof a)){var c=a.then;if("function"===typeof c){d(c.bind(a),e,h);return}}t=!0;q=a;k()}catch(b){h(b)}}function h(a){t=!1;q=a;k()}function k(){for(var a=0,c=v.length;a<c;a++)g(v[a]);v=null}if("object"!==typeof this)throw new TypeError("Promises must be constructed via new");if("function"!==typeof c)throw new TypeError("not a function");var t=null,q=null,v=[],p=this;this.then=function(a,c){return new f(function(e,
d){g(new b(a,c,e,d))})};d(c,e,h)}function b(a,b,e,d){this.onFulfilled="function"===typeof a?a:null;this.onRejected="function"===typeof b?b:null;this.resolve=e;this.reject=d}function d(a,b,e){var d=!1;try{a(function(a){d||(d=!0,b(a))},function(a){d||(d=!0,e(a))})}catch(f){d||(d=!0,e(f))}}var a=g("asap");k.exports=f},{asap:35}],34:[function(g,k,h){function f(a){this.then=function(c){return"function"!==typeof c?this:new b(function(b,e){d(function(){try{b(c(a))}catch(d){e(d)}})})}}var b=g("./core.js"),
d=g("asap");k.exports=b;f.prototype=Object.create(b.prototype);var a=new f(!0),c=new f(!1),m=new f(null),e=new f(void 0),n=new f(0),y=new f("");b.resolve=function(d){if(d instanceof b)return d;if(null===d)return m;if(void 0===d)return e;if(!0===d)return a;if(!1===d)return c;if(0===d)return n;if(""===d)return y;if("object"===typeof d||"function"===typeof d)try{var g=d.then;if("function"===typeof g)return new b(g.bind(d))}catch(h){return new b(function(a,c){c(h)})}return new f(d)};b.from=b.cast=function(a){var c=
Error("Promise.from and Promise.cast are deprecated, use Promise.resolve instead");c.name="Warning";console.warn(c.stack);return b.resolve(a)};b.denodeify=function(a,c){c=c||Infinity;return function(){var e=this,d=Array.prototype.slice.call(arguments);return new b(function(b,f){for(;d.length&&d.length>c;)d.pop();d.push(function(a,c){a?f(a):b(c)});a.apply(e,d)})}};b.nodeify=function(a){return function(){var c=Array.prototype.slice.call(arguments),e="function"===typeof c[c.length-1]?c.pop():null;try{return a.apply(this,
arguments).nodeify(e)}catch(f){if(null===e||"undefined"==typeof e)return new b(function(a,c){c(f)});d(function(){e(f)})}}};b.all=function(){var a=1===arguments.length&&Array.isArray(arguments[0]),c=Array.prototype.slice.call(a?arguments[0]:arguments);a||(a=Error("Promise.all should be called with a single array, calling it with multiple arguments is deprecated"),a.name="Warning",console.warn(a.stack));return new b(function(a,b){function e(f,g){try{if(g&&("object"===typeof g||"function"===typeof g)){var h=
g.then;if("function"===typeof h){h.call(g,function(a){e(f,a)},b);return}}c[f]=g;0===--d&&a(c)}catch(m){b(m)}}if(0===c.length)return a([]);for(var d=c.length,f=0;f<c.length;f++)e(f,c[f])})};b.reject=function(a){return new b(function(c,b){b(a)})};b.race=function(a){return new b(function(c,e){a.forEach(function(a){b.resolve(a).then(c,e)})})};b.prototype.done=function(a,c){(arguments.length?this.then.apply(this,arguments):this).then(null,function(a){d(function(){throw a;})})};b.prototype.nodeify=function(a){if("function"!=
typeof a)return this;this.then(function(c){d(function(){a(null,c)})},function(c){d(function(){a(c)})})};b.prototype["catch"]=function(a){return this.then(null,a)}},{"./core.js":33,asap:35}],35:[function(g,k,h){(function(f){function b(){for(;d.next;){d=d.next;var a=d.task;d.task=void 0;var f=d.domain;f&&(d.domain=void 0,f.enter());try{a()}catch(g){if(e)throw f&&f.exit(),setTimeout(b,0),f&&f.enter(),g;setTimeout(function(){throw g;},0)}f&&f.exit()}c=!1}var d={task:void 0,next:null},a=d,c=!1,g=void 0,
e=!1;if("undefined"!==typeof f&&f.nextTick)e=!0,g=function(){f.nextTick(b)};else if("function"===typeof setImmediate)g="undefined"!==typeof window?setImmediate.bind(window,b):function(){setImmediate(b)};else if("undefined"!==typeof MessageChannel){var h=new MessageChannel;h.port1.onmessage=b;g=function(){h.port2.postMessage(0)}}else g=function(){setTimeout(b,0)};k.exports=function(b){a=a.next={task:b,domain:e&&f.domain,next:null};c||(c=!0,g())}}).call(this,g("_process"))},{_process:82}],36:[function(g,
k,h){(function(){function f(a){var c=this,b={db:null};if(a)for(var e in a)b[e]=a[e];return new p(function(a,e){var d=w.open(b.name,b.version);d.onerror=function(){e(d.error)};d.onupgradeneeded=function(){d.result.createObjectStore(b.storeName)};d.onsuccess=function(){b.db=d.result;c._dbInfo=b;a()}})}function b(a,c){var b=this;"string"!==typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var e=new p(function(c,e){b.ready().then(function(){var d=b._dbInfo,f=d.db.transaction(d.storeName,
"readonly").objectStore(d.storeName).get(a);f.onsuccess=function(){var a=f.result;void 0===a&&(a=null);c(a)};f.onerror=function(){e(f.error)}})["catch"](e)});q(e,c);return e}function d(a,c){var b=this,e=new p(function(c,e){b.ready().then(function(){var d=b._dbInfo,f=d.db.transaction(d.storeName,"readonly").objectStore(d.storeName).openCursor(),g=1;f.onsuccess=function(){var b=f.result;if(b){var e=a(b.value,b.key,g++);void 0!==e?c(e):b["continue"]()}else c()};f.onerror=function(){e(f.error)}})["catch"](e)});
q(e,c);return e}function a(a,c,b){var e=this;"string"!==typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new p(function(b,d){e.ready().then(function(){var f=e._dbInfo,g=f.db.transaction(f.storeName,"readwrite"),f=g.objectStore(f.storeName);null===c&&(c=void 0);var h=f.put(c,a);g.oncomplete=function(){void 0===c&&(c=null);b(c)};g.onabort=g.onerror=function(){d(h.error)}})["catch"](d)});q(d,b);return d}function c(a,c){var b=this;"string"!==typeof a&&(window.console.warn(a+
" used as a key, but it is not a string."),a=String(a));var e=new p(function(c,e){b.ready().then(function(){var d=b._dbInfo,f=d.db.transaction(d.storeName,"readwrite"),g=f.objectStore(d.storeName)["delete"](a);f.oncomplete=function(){c()};f.onerror=function(){e(g.error)};f.onabort=function(a){a=a.target.error;"QuotaExceededError"===a&&e(a)}})["catch"](e)});q(e,c);return e}function h(a){var c=this,b=new p(function(a,b){c.ready().then(function(){var e=c._dbInfo,d=e.db.transaction(e.storeName,"readwrite"),
f=d.objectStore(e.storeName).clear();d.oncomplete=function(){a()};d.onabort=d.onerror=function(){b(f.error)}})["catch"](b)});q(b,a);return b}function e(a){var c=this,b=new p(function(a,b){c.ready().then(function(){var e=c._dbInfo,d=e.db.transaction(e.storeName,"readonly").objectStore(e.storeName).count();d.onsuccess=function(){a(d.result)};d.onerror=function(){b(d.error)}})["catch"](b)});t(b,a);return b}function n(a,c){var b=this,e=new p(function(c,e){0>a?c(null):b.ready().then(function(){var d=b._dbInfo,
f=!1,g=d.db.transaction(d.storeName,"readonly").objectStore(d.storeName).openCursor();g.onsuccess=function(){var b=g.result;b?0===a?c(b.key):f?c(b.key):(f=!0,b.advance(a)):c(null)};g.onerror=function(){e(g.error)}})["catch"](e)});t(e,c);return e}function y(a){var c=this,b=new p(function(a,b){c.ready().then(function(){var e=c._dbInfo,d=e.db.transaction(e.storeName,"readonly").objectStore(e.storeName).openCursor(),f=[];d.onsuccess=function(){var c=d.result;c?(f.push(c.key),c["continue"]()):a(f)};d.onerror=
function(){b(d.error)}})["catch"](b)});t(b,a);return b}function t(a,c){c&&a.then(function(a){c(null,a)},function(a){c(a)})}function q(a,c){c&&a.then(function(a){v(c,a)},function(a){c(a)})}function v(a,c){if(a)return setTimeout(function(){return a(null,c)},0)}var p="undefined"!==typeof k&&k.exports?g("promise"):this.Promise,w=w||this.indexedDB||this.webkitIndexedDB||this.mozIndexedDB||this.OIndexedDB||this.msIndexedDB;if(w){var s={_driver:"asyncStorage",_initStorage:f,iterate:d,getItem:b,setItem:a,
removeItem:c,clear:h,length:e,key:n,keys:y};"undefined"!==typeof k&&k.exports?k.exports=s:this.asyncStorage=s}}).call(window)},{promise:34}],37:[function(g,k,h){(function(){function f(a,c){c&&a.then(function(a){c(null,a)},function(a){c(a)})}var b="undefined"!==typeof k&&k.exports?g("promise"):this.Promise,d=this,a=null,c=null;try{if(!(this.localStorage&&"setItem"in this.localStorage))return;c=this.localStorage}catch(h){return}var e=3;"undefined"!==typeof k&&k.exports&&(e=2);var n={_driver:"localStorageWrapper",
_initStorage:function(c){var f={};if(c)for(var h in c)f[h]=c[h];f.keyPrefix=f.name+"/";this._dbInfo=f;return(new b(function(a){1===e?g(["localforageSerializer"],a):2===e?a(g("./../utils/serializer")):a(d.localforageSerializer)})).then(function(c){a=c;return b.resolve()})},iterate:function(b,e){var d=this,g=d.ready().then(function(){for(var e=d._dbInfo.keyPrefix.length,f=c.length,g=0;g<f;g++){var h=c.key(g),m=c.getItem(h);m&&(m=a.deserialize(m));m=b(m,h.substring(e),g+1);if(void 0!==m)return m}});
f(g,e);return g},getItem:function(b,e){var d=this;"string"!==typeof b&&(window.console.warn(b+" used as a key, but it is not a string."),b=String(b));var g=d.ready().then(function(){var e=c.getItem(d._dbInfo.keyPrefix+b);e&&(e=a.deserialize(e));return e});f(g,e);return g},setItem:function(e,d,g){var h=this;"string"!==typeof e&&(window.console.warn(e+" used as a key, but it is not a string."),e=String(e));var m=h.ready().then(function(){void 0===d&&(d=null);var f=d;return new b(function(b,g){a.serialize(d,
function(a,d){if(d)g(d);else try{c.setItem(h._dbInfo.keyPrefix+e,a),b(f)}catch(m){"QuotaExceededError"!==m.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==m.name||g(m),g(m)}})})});f(m,g);return m},removeItem:function(a,b){var e=this;"string"!==typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=e.ready().then(function(){c.removeItem(e._dbInfo.keyPrefix+a)});f(d,b);return d},clear:function(a){var b=this,e=b.ready().then(function(){for(var a=b._dbInfo.keyPrefix,e=c.length-
1;0<=e;e--){var d=c.key(e);0===d.indexOf(a)&&c.removeItem(d)}});f(e,a);return e},length:function(a){var c=this.keys().then(function(a){return a.length});f(c,a);return c},key:function(a,b){var e=this,d=e.ready().then(function(){var b=e._dbInfo,d;try{d=c.key(a)}catch(f){d=null}d&&(d=d.substring(b.keyPrefix.length));return d});f(d,b);return d},keys:function(a){var b=this,e=b.ready().then(function(){for(var a=b._dbInfo,e=c.length,d=[],f=0;f<e;f++)0===c.key(f).indexOf(a.keyPrefix)&&d.push(c.key(f).substring(a.keyPrefix.length));
return d});f(e,a);return e}};2===e?k.exports=n:1===e?(void 0)("localStorageWrapper",function(){return n}):this.localStorageWrapper=n}).call(window)},{"./../utils/serializer":40,promise:34}],38:[function(g,k,h){(function(){function f(a){var c=this,b={db:null};if(a)for(var e in a)b[e]="string"!==typeof a[e]?a[e].toString():a[e];e=new q(function(a){z===s.DEFINE?g(["localforageSerializer"],a):z===s.EXPORT?a(g("./../utils/serializer")):a(v.localforageSerializer)});var d=new q(function(e,d){try{b.db=w(b.name,
String(b.version),b.description,b.size)}catch(f){return c.setDriver(c.LOCALSTORAGE).then(function(){return c._initStorage(a)}).then(e)["catch"](d)}b.db.transaction(function(a){a.executeSql("CREATE TABLE IF NOT EXISTS "+b.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],function(){c._dbInfo=b;e()},function(a,c){d(c)})})});return e.then(function(a){p=a;return d})}function b(a,c){var b=this;"string"!==typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));
var e=new q(function(c,e){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){b.executeSql("SELECT * FROM "+d.storeName+" WHERE key = ? LIMIT 1",[a],function(a,b){var e=b.rows.length?b.rows.item(0).value:null;e&&(e=p.deserialize(e));c(e)},function(a,c){e(c)})})})["catch"](e)});t(e,c);return e}function d(a,c){var b=this,e=new q(function(c,e){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){b.executeSql("SELECT * FROM "+d.storeName,[],function(b,e){for(var d=
e.rows,f=d.length,g=0;g<f;g++){var h=d.item(g),m=h.value;m&&(m=p.deserialize(m));m=a(m,h.key,g+1);if(void 0!==m){c(m);return}}c()},function(a,c){e(c)})})})["catch"](e)});t(e,c);return e}function a(a,c,b){var e=this;"string"!==typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new q(function(b,d){e.ready().then(function(){void 0===c&&(c=null);var f=c;p.serialize(c,function(c,g){if(g)d(g);else{var h=e._dbInfo;h.db.transaction(function(e){e.executeSql("INSERT OR REPLACE INTO "+
h.storeName+" (key, value) VALUES (?, ?)",[a,c],function(){b(f)},function(a,c){d(c)})},function(a){a.code===a.QUOTA_ERR&&d(a)})}})})["catch"](d)});t(d,b);return d}function c(a,c){var b=this;"string"!==typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var e=new q(function(c,e){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){b.executeSql("DELETE FROM "+d.storeName+" WHERE key = ?",[a],function(){c()},function(a,c){e(c)})})})["catch"](e)});
t(e,c);return e}function h(a){var c=this,b=new q(function(a,b){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){c.executeSql("DELETE FROM "+e.storeName,[],function(){a()},function(a,c){b(c)})})})["catch"](b)});t(b,a);return b}function e(a){var c=this,b=new q(function(a,b){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){c.executeSql("SELECT COUNT(key) as c FROM "+e.storeName,[],function(c,b){var e=b.rows.item(0).c;a(e)},function(a,c){b(c)})})})["catch"](b)});
t(b,a);return b}function n(a,c){var b=this,e=new q(function(c,e){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){b.executeSql("SELECT key FROM "+d.storeName+" WHERE id = ? LIMIT 1",[a+1],function(a,b){var e=b.rows.length?b.rows.item(0).key:null;c(e)},function(a,c){e(c)})})})["catch"](e)});t(e,c);return e}function y(a){var c=this,b=new q(function(a,b){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){c.executeSql("SELECT key FROM "+e.storeName,[],function(c,
b){for(var e=[],d=0;d<b.rows.length;d++)e.push(b.rows.item(d).key);a(e)},function(a,c){b(c)})})})["catch"](b)});t(b,a);return b}function t(a,c){c&&a.then(function(a){c(null,a)},function(a){c(a)})}var q="undefined"!==typeof k&&k.exports?g("promise"):this.Promise,v=this,p=null,w=this.openDatabase;if(w){var s={DEFINE:1,EXPORT:2,WINDOW:3},z=s.WINDOW;"undefined"!==typeof k&&k.exports&&(z=s.EXPORT);var u={_driver:"webSQLStorage",_initStorage:f,iterate:d,getItem:b,setItem:a,removeItem:c,clear:h,length:e,
key:n,keys:y};z===s.DEFINE?(void 0)("webSQLStorage",function(){return u}):z===s.EXPORT?k.exports=u:this.webSQLStorage=u}}).call(window)},{"./../utils/serializer":40,promise:34}],39:[function(g,k,h){(function(){function f(a,c){a[c]=function(){var b=arguments;return a.ready().then(function(){return a[c].apply(a,b)})}}function b(){for(var a=1;a<arguments.length;a++){var c=arguments[a];if(c)for(var b in c)c.hasOwnProperty(b)&&(v(c[b])?arguments[0][b]=c[b].slice():arguments[0][b]=c[b])}return arguments[0]}
function d(a){for(var c in e)if(e.hasOwnProperty(c)&&e[c]===a)return!0;return!1}function a(a){this._config=b({},y,a);this._driverSet=null;this._ready=!1;this._dbInfo=null;for(a=0;a<n.length;a++)f(this,n[a]);this.setDriver(this._config.driver)}var c="undefined"!==typeof k&&k.exports?g("promise"):this.Promise,h={},e={INDEXEDDB:"asyncStorage",LOCALSTORAGE:"localStorageWrapper",WEBSQL:"webSQLStorage"},n="clear getItem iterate key keys length removeItem setItem".split(" "),y={description:"",driver:[e.INDEXEDDB,
e.WEBSQL,e.LOCALSTORAGE].slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1},t=3;"undefined"!==typeof k&&k.exports&&(t=2);var q=function(a){var c=c||a.indexedDB||a.webkitIndexedDB||a.mozIndexedDB||a.OIndexedDB||a.msIndexedDB,b={};b[e.WEBSQL]=!!a.openDatabase;b[e.INDEXEDDB]=!!function(){if("undefined"!==typeof a.openDatabase&&a.navigator&&a.navigator.userAgent&&/Safari/.test(a.navigator.userAgent)&&!/Chrome/.test(a.navigator.userAgent))return!1;try{return c&&"function"===typeof c.open&&
"undefined"!==typeof a.IDBKeyRange}catch(b){return!1}}();var d=e.LOCALSTORAGE,f;try{f=a.localStorage&&"setItem"in a.localStorage&&a.localStorage.setItem}catch(g){f=!1}b[d]=!!f;return b}(this),v=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)},p=this;a.prototype.INDEXEDDB=e.INDEXEDDB;a.prototype.LOCALSTORAGE=e.LOCALSTORAGE;a.prototype.WEBSQL=e.WEBSQL;a.prototype.config=function(a){if("object"===typeof a){if(this._ready)return Error("Can't call config() after localforage has been used.");
for(var c in a)"storeName"===c&&(a[c]=a[c].replace(/\W/g,"_")),this._config[c]=a[c];"driver"in a&&a.driver&&this.setDriver(this._config.driver);return!0}return"string"===typeof a?this._config[a]:this._config};a.prototype.defineDriver=function(a,b,e){var f=new c(function(b,e){try{var f=a._driver,g=Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver"),k=Error("Custom driver name already in use: "+a._driver);if(a._driver)if(d(a._driver))e(k);else{for(var t=n.concat("_initStorage"),
k=0;k<t.length;k++){var p=t[k];if(!p||!a[p]||"function"!==typeof a[p]){e(g);return}}var y=c.resolve(!0);"_support"in a&&(y=a._support&&"function"===typeof a._support?a._support():c.resolve(!!a._support));y.then(function(c){q[f]=c;h[f]=a;b()},e)}else e(g)}catch(w){e(w)}});f.then(b,e);return f};a.prototype.driver=function(){return this._driver||null};a.prototype.ready=function(a){var b=this,e=new c(function(a,c){b._driverSet.then(function(){null===b._ready&&(b._ready=b._initStorage(b._config));b._ready.then(a,
c)})["catch"](c)});e.then(a,a);return e};a.prototype.setDriver=function(a,b,e){function f(){k._config.driver=k.driver()}var k=this;"string"===typeof a&&(a=[a]);this._driverSet=new c(function(b,e){var f=k._getFirstSupportedDriver(a),n=Error("No available storage method found.");if(f){k._dbInfo=null;k._ready=null;if(d(f)){if(1===t){g([f],function(a){k._extend(a);b()});return}if(2===t){var q;switch(f){case k.INDEXEDDB:q=g("./drivers/indexeddb");break;case k.LOCALSTORAGE:q=g("./drivers/localstorage");
break;case k.WEBSQL:q=g("./drivers/websql")}k._extend(q)}else k._extend(p[f])}else if(h[f])k._extend(h[f]);else{k._driverSet=c.reject(n);e(n);return}b()}else k._driverSet=c.reject(n),e(n)});this._driverSet.then(f,f);this._driverSet.then(b,e);return this._driverSet};a.prototype.supports=function(a){return!!q[a]};a.prototype._extend=function(a){b(this,a)};a.prototype._getFirstSupportedDriver=function(a){if(a&&v(a))for(var c=0;c<a.length;c++){var b=a[c];if(this.supports(b))return b}return null};a.prototype.createInstance=
function(c){return new a(c)};var w=new a;1===t?(void 0)("localforage",function(){return w}):2===t?k.exports=w:this.localforage=w}).call(window)},{"./drivers/indexeddb":36,"./drivers/localstorage":37,"./drivers/websql":38,promise:34}],40:[function(g,k,h){(function(){function f(a){var b=0.75*a.length,e=a.length,f=0,g,h,k,v;"="===a[a.length-1]&&(b--,"="===a[a.length-2]&&b--);for(var p=new ArrayBuffer(b),w=new Uint8Array(p),b=0;b<e;b+=4)g=d.indexOf(a[b]),h=d.indexOf(a[b+1]),k=d.indexOf(a[b+2]),v=d.indexOf(a[b+
3]),w[f++]=g<<2|h>>4,w[f++]=(h&15)<<4|k>>2,w[f++]=(k&3)<<6|v&63;return p}function b(a){a=new Uint8Array(a);var b="",e;for(e=0;e<a.length;e+=3)b+=d[a[e]>>2],b+=d[(a[e]&3)<<4|a[e+1]>>4],b+=d[(a[e+1]&15)<<2|a[e+2]>>6],b+=d[a[e+2]&63];2===a.length%3?b=b.substring(0,b.length-1)+"=":1===a.length%3&&(b=b.substring(0,b.length-2)+"==");return b}var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a={serialize:function(a,d){var e="";a&&(e=a.toString());if(a&&("[object ArrayBuffer]"===a.toString()||
a.buffer&&"[object ArrayBuffer]"===a.buffer.toString())){var f,g="__lfsc__:";a instanceof ArrayBuffer?(f=a,g+="arbf"):(f=a.buffer,"[object Int8Array]"===e?g+="si08":"[object Uint8Array]"===e?g+="ui08":"[object Uint8ClampedArray]"===e?g+="uic8":"[object Int16Array]"===e?g+="si16":"[object Uint16Array]"===e?g+="ur16":"[object Int32Array]"===e?g+="si32":"[object Uint32Array]"===e?g+="ui32":"[object Float32Array]"===e?g+="fl32":"[object Float64Array]"===e?g+="fl64":d(Error("Failed to get type for BinaryArray")));
d(g+b(f))}else if("[object Blob]"===e)e=new FileReader,e.onload=function(){var a=b(this.result);d("__lfsc__:blob"+a)},e.readAsArrayBuffer(a);else try{d(JSON.stringify(a))}catch(h){window.console.error("Couldn't convert value into a JSON string: ",a),d(null,h)}},deserialize:function(a){if("__lfsc__:"!==a.substring(0,9))return JSON.parse(a);var b=a.substring(13);a=a.substring(9,13);b=f(b);switch(a){case "arbf":return b;case "blob":return new Blob([b]);case "si08":return new Int8Array(b);case "ui08":return new Uint8Array(b);
case "uic8":return new Uint8ClampedArray(b);case "si16":return new Int16Array(b);case "ur16":return new Uint16Array(b);case "si32":return new Int32Array(b);case "ui32":return new Uint32Array(b);case "fl32":return new Float32Array(b);case "fl64":return new Float64Array(b);default:throw Error("Unkown type: "+a);}},stringToBuffer:f,bufferToString:b};"undefined"!==typeof k&&k.exports?k.exports=a:this.localforageSerializer=a}).call(window)},{}],41:[function(g,k,h){(function(f,b){f(function(d){function a(b,
e){if(!(this instanceof a))return new a(b,e);b instanceof a?(this._template=b.template,this._params=c({},this._params,e)):(this._template=(b||"").toString(),this._params=e||{})}var c,f,e,g,h;c=d("./util/mixin");e=/([a-z][a-z0-9\+\-\.]*:)\/\/([^@]+@)?(([^:\/]+)(:([0-9]+))?)?(\/[^?#]*)?(\?[^#]*)?(#\S*)?/i;g=/^([a-z][a-z0-9\-\+\.]*:\/\/|\/)/i;h=/([a-z][a-z0-9\+\-\.]*:)\/\/([^@]+@)?(([^:\/]+)(:([0-9]+))?)?\//i;a.prototype={append:function(b,e){return new a(this._template+b,c({},this._params,e))},fullyQualify:function(){if(!b||
this.isFullyQualified())return this;var c=this._template;0===c.indexOf("//")?c=f.protocol+c:0===c.indexOf("/")?c=f.origin+c:this.isAbsolute()||(c=f.origin+f.pathname.substring(0,f.pathname.lastIndexOf("/")+1));-1===c.indexOf("/",8)&&(c+="/");return new a(c,this._params)},isAbsolute:function(){return g.test(this.build())},isFullyQualified:function(){return h.test(this.build())},isCrossOrigin:function(){if(!f)return!0;var a=this.parts();return a.protocol!==f.protocol||a.hostname!==f.hostname||a.port!==
f.port},parts:function(){var a;a=this.fullyQualify().build().match(e);a={href:a[0],protocol:a[1],host:a[3]||"",hostname:a[4]||"",port:a[6],pathname:a[7]||"",search:a[8]||"",hash:a[9]||""};a.origin=a.protocol+"//"+a.host;a.port=a.port||("https:"===a.protocol?"443":"http:"===a.protocol?"80":"");return a},build:function(a){a=c({},this._params,a);var b,e,d,f;b=this._template;d={};if(a){for(e in a)f=RegExp("\\{"+e+"\\}"),f.test(b)?b=b.replace(f,encodeURIComponent(a[e]),"g"):d[e]=a[e];for(e in d)b+=-1===
b.indexOf("?")?"?":"&",b+=encodeURIComponent(e),null!==d[e]&&void 0!==d[e]&&(b+="=",b+=encodeURIComponent(d[e]))}return b},toString:function(){return this.build()}};f=b?(new a(b.href)).parts():void 0;return a})})(function(f){k.exports=f(g)},"undefined"!==typeof window?window.location:void 0)},{"./util/mixin":77}],42:[function(g,k,h){(function(f){f(function(b){var d=b("./client/default");b=b("./client/xhr");d.setPlatformDefaultClient(b);return d})})(function(f){k.exports=f(g)})},{"./client/default":44,
"./client/xhr":45}],43:[function(g,k,h){(function(f){f(function(){return function(b,d){d&&(b.skip=function(){return d});b.wrap=function(a,c){return a(b,c)};b.chain=function(){"undefined"!==typeof console&&console.log("rest.js: client.chain() is deprecated, use client.wrap() instead");return b.wrap.apply(this,arguments)};return b}})})(function(f){k.exports=f(g)})},{}],44:[function(g,k,h){(function(f){f(function(b){function d(){return a.apply(void 0,arguments)}var a,c;b=b("../client");d.setDefaultClient=
function(b){a=b};d.getDefaultClient=function(){return a};d.resetDefaultClient=function(){a=c};d.setPlatformDefaultClient=function(b){if(c)throw Error("Unable to redefine platformDefaultClient");a=c=b};return b(d)})})(function(f){k.exports=f(g)})},{"../client":43}],45:[function(g,k,h){(function(f,b){f(function(d){function a(a){var b={};if(!a)return b;a.trim().split(h).forEach(function(a){var c,d;c=a.indexOf(":");d=e(a.substring(0,c).trim());a=a.substring(c+1).trim();b[d]?Array.isArray(b[d])?b[d].push(a):
b[d]=[b[d],a]:b[d]=a});return b}function c(a,b){Object.keys(b||{}).forEach(function(c){if(b.hasOwnProperty(c)&&c in a)try{a[c]=b[c]}catch(e){}});return a}var f,e,g,h;d("when");f=d("../UrlBuilder");e=d("../util/normalizeHeaderName");g=d("../util/responsePromise");d=d("../client");h=/[\r|\n]+/;return d(function(e){return g.promise(function(d,g){var h,k,n,y,u,r,l,x;e="string"===typeof e?{path:e}:e||{};l={request:e};if(e.canceled)l.error="precanceled",g(l);else if(x=e.engine||b.XMLHttpRequest){u=e.entity;
e.method=e.method||(u?"POST":"GET");k=e.method;n=(new f(e.path||"",e.params)).build();try{h=l.raw=new x;c(h,e.mixin);h.open(k,n,!0);c(h,e.mixin);y=e.headers;for(r in y)"Content-Type"===r&&"multipart/form-data"===y[r]||h.setRequestHeader(r,y[r]);e.canceled=!1;e.cancel=function(){e.canceled=!0;h.abort();g(l)};h.onreadystatechange=function(){e.canceled||h.readyState!==(x.DONE||4)||(l.status={code:h.status,text:h.statusText},l.headers=a(h.getAllResponseHeaders()),l.entity=h.responseText,0<l.status.code?
d(l):setTimeout(function(){d(l)},0))};try{h.onerror=function(){l.error="loaderror";g(l)}}catch(B){}h.send(u)}catch(A){l.error="loaderror",g(l)}}else g({request:e,error:"xhr-not-available"})})})})})(function(f){k.exports=f(g)},"undefined"!==typeof window?window:void 0)},{"../UrlBuilder":41,"../client":43,"../util/normalizeHeaderName":78,"../util/responsePromise":79,when:74}],46:[function(g,k,h){(function(f){f(function(b){function d(a){return a}function a(a){return a}function c(a){return a}function f(a){return p.promise(function(b,
c){a.forEach(function(a){p(a,b,c)})})}function e(a){if(!(this instanceof e))return new e(a);k(this,a)}function g(b){var k,n,t,r;b=b||{};k=b.init||d;n=b.request||a;t=b.success||b.response||c;r=b.error||function(){return p((b.response||c).apply(this,arguments),p.reject,p.reject)};return function(a,c){function d(b){var g,h;g={};h={arguments:Array.prototype.slice.call(arguments),client:d};b="string"===typeof b?{path:b}:b||{};b.originator=b.originator||d;return q(n.call(g,b,c,h),function(b){var d,k,n;
n=a;b instanceof e&&(k=b.abort,n=b.client||n,d=b.response,b=b.request);d=d||p(b,function(a){return p(n(a),function(a){return t.call(g,a,c,h)},function(a){return r.call(g,a,c,h)})});return k?f([d,k]):d},function(a){return p.reject({request:b,error:a})})}"object"===typeof a&&(c=a);"function"!==typeof a&&(a=b.client||h);c=k(c||{});return v(d,a)}}var h,k,q,v,p;h=b("./client/default");k=b("./util/mixin");q=b("./util/responsePromise");v=b("./client");p=b("when");g.ComplexRequest=e;return g})})(function(f){k.exports=
f(g)})},{"./client":43,"./client/default":44,"./util/mixin":77,"./util/responsePromise":79,when:74}],47:[function(g,k,h){(function(f){f(function(b){var d,a,c,f,e;d=b("../interceptor");a=b("../mime");c=b("../mime/registry");e=b("when");f={read:function(a){return a},write:function(a){return a}};return d({init:function(a){a.registry=a.registry||c;return a},request:function(b,c){var d,g;g=b.headers||(b.headers={});d=a.parse(g["Content-Type"]=g["Content-Type"]||c.mime||"text/plain");g.Accept=g.Accept||
c.accept||d.raw+", application/json;q=0.8, text/plain;q=0.5, */*;q=0.2";return"entity"in b?c.registry.lookup(d).otherwise(function(){if(c.permissive)return f;throw"mime-unknown";}).then(function(a){return e.attempt(a.write,b.entity,{client:c.client||b.originator,request:b,mime:d,registry:c.registry}).otherwise(function(){throw"mime-serialization";}).then(function(a){b.entity=a;return b})}):b},response:function(b,c){if(!(b.headers&&b.headers["Content-Type"]&&b.entity))return b;var d=a.parse(b.headers["Content-Type"]);
return c.registry.lookup(d).otherwise(function(){return f}).then(function(a){return e.attempt(a.read,b.entity,{client:c.client||b.request&&b.request.originator,response:b,mime:d,registry:c.registry}).otherwise(function(a){b.error="mime-deserialization";b.cause=a;throw b;}).then(function(a){b.entity=a;return b})})}})})})(function(f){k.exports=f(g)})},{"../interceptor":46,"../mime":50,"../mime/registry":51,when:74}],48:[function(g,k,h){(function(f){f(function(b){var d,a;d=b("../interceptor");a=b("../UrlBuilder");
return d({request:function(b,d){var e;d.prefix&&!(new a(b.path)).isFullyQualified()&&(e=d.prefix,b.path&&(e.lastIndexOf("/")+1!==e.length&&0!==b.path.indexOf("/")&&(e+="/"),e+=b.path),b.path=e);return b}})})})(function(f){k.exports=f(g)})},{"../UrlBuilder":41,"../interceptor":46}],49:[function(g,k,h){(function(f){f(function(b){var d,a,c;d=b("../interceptor");a=b("../util/uriTemplate");c=b("../util/mixin");return d({init:function(a){a.params=a.params||{};a.template=a.template||"";return a},request:function(b,
e){var d,f;d=b.path||e.template;f=c({},b.params,e.params);b.path=a.expand(d,f);delete b.params;return b}})})})(function(f){k.exports=f(g)})},{"../interceptor":46,"../util/mixin":77,"../util/uriTemplate":81}],50:[function(g,k,h){(function(f){f(function(){return{parse:function(b){var d,a;d=b.split(";");a=d[0].trim().split("+");return{raw:b,type:a[0],suffix:a[1]?"+"+a[1]:"",params:d.slice(1).reduce(function(a,b){b=b.split("=");a[b[0].trim()]=b[1]?b[1].trim():void 0;return a},{})}}}})})(function(f){k.exports=
f(g)})},{}],51:[function(g,k,h){(function(f){f(function(b){function d(b){this.lookup=function(d){d="string"===typeof d?a.parse(d):d;return b[d.raw]?b[d.raw]:b[d.type+d.suffix]?b[d.type+d.suffix]:b[d.type]?b[d.type]:b[d.suffix]?b[d.suffix]:c.reject(Error('Unable to locate converter for mime "'+d.raw+'"'))};this.delegate=function(a){return{read:function(){var b=arguments;return this.lookup(a).then(function(a){return a.read.apply(this,b)}.bind(this))}.bind(this),write:function(){var b=arguments;return this.lookup(a).then(function(a){return a.write.apply(this,
b)}.bind(this))}.bind(this)}};this.register=function(a,d){b[a]=c(d);return b[a]};this.child=function(){return new d(Object.create(b))}}var a,c,f;a=b("../mime");c=b("when");f=new d({});f.register("application/hal",b("./type/application/hal"));f.register("application/json",b("./type/application/json"));f.register("application/x-www-form-urlencoded",b("./type/application/x-www-form-urlencoded"));f.register("multipart/form-data",b("./type/multipart/form-data"));f.register("text/plain",b("./type/text/plain"));
f.register("+json",f.delegate("application/json"));return f})})(function(f){k.exports=f(g)})},{"../mime":50,"./type/application/hal":52,"./type/application/json":53,"./type/application/x-www-form-urlencoded":54,"./type/multipart/form-data":55,"./type/text/plain":56,when:74}],52:[function(g,k,h){(function(f){f(function(b){function d(a,b,c){Object.defineProperty(a,b,{value:c,configurable:!0,enumerable:!1,writeable:!0})}var a,c,f,e,g,h;a=b("../../../interceptor/pathPrefix");c=b("../../../interceptor/template");
f=b("../../../util/find");e=b("../../../util/lazyPromise");g=b("../../../util/responsePromise");h=b("when");return{read:function(b,k){function v(a,b){(b&&w&&w.warn||w.log)&&(w.warn||w.log).call(w,"Relationship '"+a+"' is deprecated, see "+b)}var p,w;k=k||{};p=k.client;w=k.console||w;return k.registry.lookup(k.mime.suffix).then(function(s){return h(s.read(b,k)).then(function(b){f.findProperties(b,"_embedded",function(a,b,c){Object.keys(a).forEach(function(c){if(!(c in b)){var e=g({entity:a[c]});d(b,
c,e)}});d(b,c,a)});f.findProperties(b,"_links",function(b,f,h){Object.keys(b).forEach(function(a){var h=b[a];a in f||d(f,a,g.make(e(function(){h.deprecation&&v(a,h.deprecation);return!0===h.templated?c(p)({path:h.href}):p({path:h.href})})))});d(f,h,b);d(f,"clientFor",function(e,d){var f=b[e];if(!f)throw Error("Unknown relationship: "+e);f.deprecation&&v(e,f.deprecation);return!0===f.templated?c(d||p,{template:f.href}):a(d||p,{prefix:f.href})});d(f,"requestFor",function(a,b,c){return this.clientFor(a,
c)(b)})});return b})})},write:function(a,b){return b.registry.lookup(b.mime.suffix).then(function(c){return c.write(a,b)})}}})})(function(f){k.exports=f(g)})},{"../../../interceptor/pathPrefix":48,"../../../interceptor/template":49,"../../../util/find":75,"../../../util/lazyPromise":76,"../../../util/responsePromise":79,when:74}],53:[function(g,k,h){(function(f){f(function(){function b(d,a){return{read:function(a){return JSON.parse(a,d)},write:function(b){return JSON.stringify(b,a)},extend:b}}return b()})})(function(f){k.exports=
f(g)})},{}],54:[function(g,k,h){(function(f){f(function(){function b(a){a=encodeURIComponent(a);return a.replace(c,"+")}function d(a){a=a.replace(f," ");return decodeURIComponent(a)}function a(c,d,f){Array.isArray(f)?f.forEach(function(b){c=a(c,d,b)}):(0<c.length&&(c+="&"),c+=b(d),void 0!==f&&null!==f&&(c+="="+b(f)));return c}var c,f;c=/%20/g;f=/\+/g;return{read:function(a){var b={};a.split("&").forEach(function(a){var c;c=a.split("=");a=d(c[0]);c=2===c.length?d(c[1]):null;a in b?(Array.isArray(b[a])||
(b[a]=[b[a]]),b[a].push(c)):b[a]=c});return b},write:function(b){var c="";Object.keys(b).forEach(function(d){c=a(c,d,b[d])});return c}}})})(function(f){k.exports=f(g)})},{}],55:[function(g,k,h){(function(f){f(function(){return{write:function(b){if("undefined"===typeof FormData)throw Error("The multipart/form-data mime serializer requires FormData support");if(b instanceof FormData)return b;if(b&&1===b.nodeType&&"FORM"===b.tagName)return new FormData(b);if("object"===typeof b&&null!==b){var d=new FormData,
a,c;for(c in b)b.hasOwnProperty(c)&&(a=b[c],a instanceof File?d.append(c,a,a.name):a instanceof Blob?d.append(c,a):d.append(c,String(a)));return d}throw Error("Unable to create FormData from object "+b);}}})})(function(f){k.exports=f(g)})},{}],56:[function(g,k,h){(function(f){f(function(){return{read:function(b){return b},write:function(b){return b.toString()}}})})(function(f){k.exports=f(g)})},{}],57:[function(g,k,h){(function(f){f(function(b){var d=b("./makePromise"),a=b("./Scheduler");b=b("./env").asap;
return d({scheduler:new a(b)})})})(function(f){k.exports=f(g)})},{"./Scheduler":58,"./env":70,"./makePromise":72}],58:[function(g,k,h){(function(f){f(function(){function b(b){this._async=b;this._running=!1;this._queue=this;this._queueLen=0;this._afterQueue={};this._afterQueueLen=0;var a=this;this.drain=function(){a._drain()}}b.prototype.enqueue=function(b){this._queue[this._queueLen++]=b;this.run()};b.prototype.afterQueue=function(b){this._afterQueue[this._afterQueueLen++]=b;this.run()};b.prototype.run=
function(){this._running||(this._running=!0,this._async(this.drain))};b.prototype._drain=function(){for(var b=0;b<this._queueLen;++b)this._queue[b].run(),this._queue[b]=void 0;this._queueLen=0;this._running=!1;for(b=0;b<this._afterQueueLen;++b)this._afterQueue[b].run(),this._afterQueue[b]=void 0;this._afterQueueLen=0};return b})})(function(f){k.exports=f()})},{}],59:[function(g,k,h){(function(f){f(function(){function b(d){Error.call(this);this.message=d;this.name=b.name;"function"===typeof Error.captureStackTrace&&
Error.captureStackTrace(this,b)}b.prototype=Object.create(Error.prototype);return b.prototype.constructor=b})})(function(f){k.exports=f()})},{}],60:[function(g,k,h){(function(f){f(function(){function b(a,b){function f(d,g){if(0>d.i)return b(d.f,d.thisArg,d.params,g);a._handler(d.args[d.i]).fold(e,d,void 0,g)}function e(a,b,c){a.params[a.i]=b;a.i-=1;f(a,c)}2>arguments.length&&(b=d);return function(e,d,g){var h=a._defer(),k=g.length;f({f:e,thisArg:d,args:g,params:Array(k),i:k-1,call:b},h._handler);
return h}}function d(a,b,d,e){try{e.resolve(a.apply(b,d))}catch(f){e.reject(f)}}b.tryCatchResolve=d;return b})})(function(f){k.exports=f()})},{}],61:[function(g,k,h){(function(f){f(function(b){var d=b("../state"),a=b("../apply");return function(b){function f(a){var e=b._handler(a);if(0===e.state())return h(a).then(d.fulfilled,d.rejected);e._unreport();return d.inspect(e)}function e(a){return function(b,c,e){return g(a,void 0,[b,c,e])}}var g=a(b),h=b.resolve,k=b.all,q=Array.prototype.reduce,v=Array.prototype.reduceRight,
p=Array.prototype.slice;b.any=function(a){function e(a){m=null;this.resolve(a)}function d(a){this.resolved||(m.push(a),0===--k&&this.reject(m))}for(var f=b._defer(),g=f._handler,h=a.length>>>0,k=h,m=[],q,p=0;p<h;++p)if(q=a[p],void 0!==q||p in a)if(q=b._handler(q),0<q.state()){g.become(q);b._visitRemaining(a,p,q);break}else q.visit(g,e,d);else--k;0===k&&g.reject(new RangeError("any(): array must not be empty"));return f};b.some=function(a,e){function d(a){this.resolved||(k.push(a),0===--p&&(m=null,
this.resolve(k)))}function f(a){this.resolved||(m.push(a),0===--n&&(k=null,this.reject(m)))}var g=b._defer(),h=g._handler,k=[],m=[],q=a.length>>>0,p=0,n,t,v;for(v=0;v<q;++v)t=a[v],(void 0!==t||v in a)&&++p;e=Math.max(e,0);n=p-e+1;p=Math.min(e,p);e>p?h.reject(new RangeError("some(): array must contain at least "+e+" item(s), but had "+p)):0===p&&h.resolve(k);for(v=0;v<q;++v)t=a[v],(void 0!==t||v in a)&&b._handler(t).visit(h,d,f,h.notify);return g};b.settle=function(a){return k(a.map(f))};b.map=function(a,
e){return b._traverse(e,a)};b.filter=function(a,e){var d=p.call(a);return b._traverse(e,d).then(function(a){for(var e=a.length,f=Array(e),g=0,h=0;g<e;++g)a[g]&&(f[h++]=b._handler(d[g]).value);f.length=h;return f})};b.reduce=function(a,b){return 2<arguments.length?q.call(a,e(b),arguments[2]):q.call(a,e(b))};b.reduceRight=function(a,b){return 2<arguments.length?v.call(a,e(b),arguments[2]):v.call(a,e(b))};b.prototype.spread=function(a){return this.then(k).then(function(b){return a.apply(this,b)})};return b}})})(function(f){k.exports=
f(g)})},{"../apply":60,"../state":73}],62:[function(g,k,h){(function(f){f(function(){function b(){throw new TypeError("catch predicate must be a function");}function d(a){return a}return function(a){function c(a,b){return function(c){return(b===Error||null!=b&&b.prototype instanceof Error?c instanceof b:b(c))?a.call(this,c):h(c)}}function f(a,b,c,d){a=a.call(b);return"object"!==typeof a&&"function"!==typeof a||null===a?c(d):e(a,c,d)}function e(a,b,c){return g(a).then(function(){return b(c)})}var g=
a.resolve,h=a.reject,k=a.prototype["catch"];a.prototype.done=function(a,b){this._handler.visit(this._handler.receiver,a,b)};a.prototype["catch"]=a.prototype.otherwise=function(a){return 2>arguments.length?k.call(this,a):"function"!==typeof a?this.ensure(b):k.call(this,c(arguments[1],a))};a.prototype["finally"]=a.prototype.ensure=function(a){return"function"!==typeof a?this:this.then(function(b){return f(a,this,d,b)},function(b){return f(a,this,h,b)})};a.prototype["else"]=a.prototype.orElse=function(a){return this.then(void 0,
function(){return a})};a.prototype.yield=function(a){return this.then(function(){return a})};a.prototype.tap=function(a){return this.then(a).yield(this)};return a}})})(function(f){k.exports=f()})},{}],63:[function(g,k,h){(function(f){f(function(){return function(b){b.prototype.fold=function(d,a){var c=this._beget();this._handler.fold(function(a,c,f){b._handler(a).fold(function(a,b,c){c.resolve(d.call(this,b,a))},c,this,f)},a,c._handler.receiver,c._handler);return c};return b}})})(function(f){k.exports=
f()})},{}],64:[function(g,k,h){(function(f){f(function(b){var d=b("../state").inspect;return function(a){a.prototype.inspect=function(){return d(a._handler(this))};return a}})})(function(f){k.exports=f(g)})},{"../state":73}],65:[function(g,k,h){(function(f){f(function(){return function(b){function d(b,f,e,g){function h(g,k){return a(e(g)).then(function(){return d(b,f,e,k)})}return a(g).then(function(e){return a(f(e)).then(function(d){return d?e:a(b(e)).spread(h)})})}var a=b.resolve;b.iterate=function(a,
b,e,f){return d(function(b){return[b,a(b)]},b,e,f)};b.unfold=d;return b}})})(function(f){k.exports=f()})},{}],66:[function(g,k,h){(function(f){f(function(){return function(b){b.prototype.progress=function(b){return this.then(void 0,void 0,b)};return b}})})(function(f){k.exports=f()})},{}],67:[function(g,k,h){(function(f){f(function(b){function d(b,c,d,f){return a.setTimer(function(){b(d,f,c)},c)}var a=b("../env"),c=b("../TimeoutError");return function(b){function e(a,b,c){d(f,a,b,c)}function f(a,
b){b.resolve(a)}function g(a,b,e){a="undefined"===typeof a?new c("timed out after "+e+"ms"):a;b.reject(a)}b.prototype.delay=function(a){var b=this._beget();this._handler.fold(e,a,void 0,b._handler);return b};b.prototype.timeout=function(b,c){var e=this._beget(),f=e._handler,h=d(g,b,c,e._handler);this._handler.visit(f,function(b){a.clearTimer(h);this.resolve(b)},function(b){a.clearTimer(h);this.reject(b)},f.notify);return e};return b}})})(function(f){k.exports=f(g)})},{"../TimeoutError":59,"../env":70}],
68:[function(g,k,h){(function(f){f(function(b){function d(a){throw a;}function a(){}var c=b("../env").setTimer,f=b("../format");return function(b){function g(a){a.handled||(z.push(a),v("Potentially unhandled rejection ["+a.id+"] "+f.formatError(a.value)))}function h(a){var b=z.indexOf(a);0<=b&&(z.splice(b,1),p("Handled previous rejection ["+a.id+"] "+f.formatObject(a.value)))}function k(a,b){s.push(a,b);null===u&&(u=c(q,0))}function q(){for(u=null;0<s.length;)s.shift()(s.shift())}var v=a,p=a,w;"undefined"!==
typeof console&&(w=console,v="undefined"!==typeof w.error?function(a){w.error(a)}:function(a){w.log(a)},p="undefined"!==typeof w.info?function(a){w.info(a)}:function(a){w.log(a)});b.onPotentiallyUnhandledRejection=function(a){k(g,a)};b.onPotentiallyUnhandledRejectionHandled=function(a){k(h,a)};b.onFatalRejection=function(a){k(d,a.value)};var s=[],z=[],u=null;return b}})})(function(f){k.exports=f(g)})},{"../env":70,"../format":71}],69:[function(g,k,h){(function(f){f(function(){return function(b){b.prototype["with"]=
b.prototype.withThis=function(b){var a=this._beget(),c=a._handler;c.receiver=b;this._handler.chain(c,b);return a};return b}})})(function(f){k.exports=f()})},{}],70:[function(g,k,h){(function(f){(function(b){b(function(b){function a(a){var b,c=document.createTextNode("");(new a(function(){var a=b;b=void 0;a()})).observe(c,{characterData:!0});var e=0;return function(a){b=a;c.data=e^=1}}var c,g="undefined"!==typeof setTimeout&&setTimeout,e=function(a,b){return setTimeout(a,b)},h=function(a){return clearTimeout(a)},
k=function(a){return g(a,0)};if("undefined"!==typeof f&&null!==f&&"function"===typeof f.nextTick)k=function(a){return f.nextTick(a)};else if(c="function"===typeof MutationObserver&&MutationObserver||"function"===typeof WebKitMutationObserver&&WebKitMutationObserver)k=a(c);else if(!g)var t=b("vertx"),e=function(a,b){return t.setTimer(b,a)},h=t.cancelTimer,k=t.runOnLoop||t.runOnContext;return{setTimer:e,clearTimer:h,asap:k}})})(function(b){k.exports=b(g)})}).call(this,g("_process"))},{_process:82}],
71:[function(g,k,h){(function(f){f(function(){function b(a){var b=String(a);"[object Object]"===b&&"undefined"!==typeof JSON&&(b=d(a,b));return b}function d(a,b){try{return JSON.stringify(a)}catch(d){return b}}return{formatError:function(a){var c="object"===typeof a&&null!==a&&a.stack?a.stack:b(a);return a instanceof Error?c:c+" (WARNING: non-Error used)"},formatObject:b,tryStringify:d}})})(function(f){k.exports=f()})},{}],72:[function(g,k,h){(function(f){(function(b){b(function(){return function(b){function a(a,
b){this._handler=a===p?b:c(a)}function c(a){function b(a){d.resolve(a)}function c(a){d.reject(a)}function e(a){d.notify(a)}var d=new s;try{a(b,c,e)}catch(f){c(f)}return d}function g(b){return b instanceof a?b:new a(p,new z(q(b)))}function e(b){return new a(p,new z(new l(b)))}function h(b,c,e){function d(a,g,h){h.resolved||k(e,f,a,b(c,g,a),h)}function f(a,b,c){n[a]=b;0===--m&&c.become(new r(n))}for(var g="function"===typeof c?d:f,l=new s,m=e.length>>>0,n=Array(m),q=0,t;q<e.length&&!l.resolved;++q)t=
e[q],void 0!==t||q in e?k(e,g,q,t,l):--m;0===m&&l.become(new r(n));return new a(p,l)}function k(b,c,e,d,f){if(K(d)){d=d instanceof a?d._handler.join():v(d);var g=d.state();0===g?d.fold(c,e,void 0,f):0<g?c(e,d.value,f):(f.become(d),t(b,e+1,d))}else c(e,d,f)}function t(a,b,c){for(;b<a.length;++b){var e=q(a[b]);if(e!==c){var d=e.state();0===d?e.visit(e,void 0,e._unreport):0>d&&e._unreport()}}}function q(b){return b instanceof a?b._handler.join():K(b)?v(b):new r(b)}function v(a){try{var b=a.then;return"function"===
typeof b?new u(b,a):new r(a)}catch(c){return new l(c)}}function p(){}function w(){}function s(b,c){a.createContext(this,c);this.consumers=void 0;this.receiver=b;this.handler=void 0;this.resolved=!1}function z(a){this.handler=a}function u(a,b){s.call(this);D.enqueue(new J(a,b,this))}function r(b){a.createContext(this);this.value=b}function l(b){a.createContext(this);this.id=++R;this.value=b;this.reported=this.handled=!1;this._report()}function x(a,b){this.rejection=a;this.context=b}function B(a){this.rejection=
a}function A(a,b){this.continuation=a;this.handler=b}function C(a,b){this.handler=b;this.value=a}function J(a,b,c){this._then=a;this.thenable=b;this.resolver=c}function O(a,b,c,e,d){try{a.call(b,c,e,d)}catch(f){e(f)}}function F(a,b,c,e){this.f=a;this.z=b;this.c=c;this.to=e;this.resolver=M;this.receiver=this}function K(a){return("object"===typeof a||"function"===typeof a)&&null!==a}function L(b,c,e,d){if("function"!==typeof b)return d.become(c);a.enterContext(c);try{d.become(q(b.call(e,c.value)))}catch(f){d.become(new l(f))}a.exitContext()}
function P(a,b,c){try{return a(b,c)}catch(d){return e(d)}}function E(a,b){b.prototype=S(a.prototype);b.prototype.constructor=b}function Q(a,b){return b}function G(){}var D=b.scheduler,I=function(){return"undefined"!==typeof f&&null!==f&&"function"===typeof f.emit?function(a,b){return"unhandledRejection"===a?f.emit(a,b.value,b):f.emit(a,b)}:"undefined"!==typeof self&&"function"===typeof CustomEvent?function(a,b,c){var e=!1;try{e=new c("unhandledRejection")instanceof c}catch(d){}return e?function(a,
e){var d=new c(a,{detail:{reason:e.value,key:e},bubbles:!1,cancelable:!0});return!b.dispatchEvent(d)}:a}(G,self,CustomEvent):G}(),S=Object.create||function(a){function b(){}b.prototype=a;return new b};a.resolve=g;a.reject=e;a.never=function(){return N};a._defer=function(){return new a(p,new s)};a._handler=q;a.prototype.then=function(a,b,c){var e=this._handler,d=e.join().state();if("function"!==typeof a&&0<d||"function"!==typeof b&&0>d)return new this.constructor(p,e);d=this._beget();e.chain(d._handler,
e.receiver,a,b,c);return d};a.prototype["catch"]=function(a){return this.then(void 0,a)};a.prototype._beget=function(){var a=this._handler,b=this.constructor,a=new s(a.receiver,a.join().context);return new b(p,a)};a.all=function(a){return h(Q,null,a)};a.race=function(b){if("object"!==typeof b||null===b)return e(new TypeError("non-iterable passed to race()"));if(0===b.length)b=N;else if(1===b.length)b=g(b[0]);else{var c=new s,d,f;for(d=0;d<b.length;++d)if(f=b[d],void 0!==f||d in b)if(f=q(f),0!==f.state()){c.become(f);
t(b,d+1,f);break}else f.visit(c,c.resolve,c.reject);b=new a(p,c)}return b};a._traverse=function(a,b){return h(P,a,b)};a._visitRemaining=t;p.prototype.when=p.prototype.become=p.prototype.notify=p.prototype.fail=p.prototype._unreport=p.prototype._report=G;p.prototype._state=0;p.prototype.state=function(){return this._state};p.prototype.join=function(){for(var a=this;void 0!==a.handler;)a=a.handler;return a};p.prototype.chain=function(a,b,c,e,d){this.when({resolver:a,receiver:b,fulfilled:c,rejected:e,
progress:d})};p.prototype.visit=function(a,b,c,e){this.chain(M,a,b,c,e)};p.prototype.fold=function(a,b,c,e){this.when(new F(a,b,c,e))};E(p,w);w.prototype.become=function(a){a.fail()};var M=new w;E(p,s);s.prototype._state=0;s.prototype.resolve=function(a){this.become(q(a))};s.prototype.reject=function(a){this.resolved||this.become(new l(a))};s.prototype.join=function(){if(!this.resolved)return this;for(var a=this;void 0!==a.handler;)if(a=a.handler,a===this)return this.handler=new l(new TypeError("Promise cycle"));
return a};s.prototype.run=function(){var a=this.consumers,b=this.handler;this.handler=this.handler.join();this.consumers=void 0;for(var c=0;c<a.length;++c)b.when(a[c])};s.prototype.become=function(a){this.resolved||(this.resolved=!0,this.handler=a,void 0!==this.consumers&&D.enqueue(this),void 0!==this.context&&a._report(this.context))};s.prototype.when=function(a){this.resolved?D.enqueue(new A(a,this.handler)):void 0===this.consumers?this.consumers=[a]:this.consumers.push(a)};s.prototype.notify=function(a){this.resolved||
D.enqueue(new C(a,this))};s.prototype.fail=function(a){a="undefined"===typeof a?this.context:a;this.resolved&&this.handler.join().fail(a)};s.prototype._report=function(a){this.resolved&&this.handler.join()._report(a)};s.prototype._unreport=function(){this.resolved&&this.handler.join()._unreport()};E(p,z);z.prototype.when=function(a){D.enqueue(new A(a,this))};z.prototype._report=function(a){this.join()._report(a)};z.prototype._unreport=function(){this.join()._unreport()};E(s,u);E(p,r);r.prototype._state=
1;r.prototype.fold=function(b,c,e,d){if("function"!==typeof b)d.become(this);else{a.enterContext(this);try{b.call(e,c,this.value,d)}catch(f){d.become(new l(f))}a.exitContext()}};r.prototype.when=function(a){L(a.fulfilled,this,a.receiver,a.resolver)};var R=0;E(p,l);l.prototype._state=-1;l.prototype.fold=function(a,b,c,e){e.become(this)};l.prototype.when=function(a){"function"===typeof a.rejected&&this._unreport();L(a.rejected,this,a.receiver,a.resolver)};l.prototype._report=function(a){D.afterQueue(new x(this,
a))};l.prototype._unreport=function(){this.handled||(this.handled=!0,D.afterQueue(new B(this)))};l.prototype.fail=function(b){this.reported=!0;I("unhandledRejection",this);a.onFatalRejection(this,void 0===b?this.context:b)};x.prototype.run=function(){this.rejection.handled||this.rejection.reported||(this.rejection.reported=!0,I("unhandledRejection",this.rejection)||a.onPotentiallyUnhandledRejection(this.rejection,this.context))};B.prototype.run=function(){this.rejection.reported&&(I("rejectionHandled",
this.rejection)||a.onPotentiallyUnhandledRejectionHandled(this.rejection))};a.createContext=a.enterContext=a.exitContext=a.onPotentiallyUnhandledRejection=a.onPotentiallyUnhandledRejectionHandled=a.onFatalRejection=G;b=new p;var N=new a(p,b);A.prototype.run=function(){this.handler.join().when(this.continuation)};C.prototype.run=function(){var b=this.handler.consumers;if(void 0!==b)for(var c,e=0;e<b.length;++e){c=b[e];var d=c.progress,f=this.value,g=this.handler,h=c.receiver;c=c.resolver;if("function"!==
typeof d)c.notify(f);else{a.enterContext(g);g=c;try{g.notify(d.call(h,f))}catch(k){g.notify(k)}a.exitContext()}}};J.prototype.run=function(){var a=this.resolver;O(this._then,this.thenable,function(b){a.resolve(b)},function(b){a.reject(b)},function(b){a.notify(b)})};F.prototype.fulfilled=function(a){this.f.call(this.c,this.z,a,this.to)};F.prototype.rejected=function(a){this.to.reject(a)};F.prototype.progress=function(a){this.to.notify(a)};return a}})})(function(b){k.exports=b()})}).call(this,g("_process"))},
{_process:82}],73:[function(g,k,h){(function(f){f(function(){function b(){return{state:"pending"}}function d(a){return{state:"rejected",reason:a}}function a(a){return{state:"fulfilled",value:a}}return{pending:b,fulfilled:a,rejected:d,inspect:function(c){var f=c.state();return 0===f?b():0<f?a(c.value):d(c.value)}}})})(function(f){k.exports=f()})},{}],74:[function(g,k,h){(function(f){f(function(b){function d(a,b,c,e){var d=u.resolve(a);return 2>arguments.length?d:d.then(b,c,e)}function a(a){return function(){for(var b=
0,c=arguments.length,e=Array(c);b<c;++b)e[b]=arguments[b];return r(a,this,e)}}function c(a){for(var b=0,c=arguments.length-1,e=Array(c);b<c;++b)e[b]=arguments[b+1];return r(a,this,e)}function f(){function a(b){e._handler.resolve(b)}function b(a){e._handler.reject(a)}function c(a){e._handler.notify(a)}var e=u._defer();this.promise=e;this.resolve=a;this.reject=b;this.notify=c;this.resolver={resolve:a,reject:b,notify:c}}var e=b("./lib/decorators/timed"),g=b("./lib/decorators/array"),h=b("./lib/decorators/flow"),
k=b("./lib/decorators/fold"),q=b("./lib/decorators/inspect"),v=b("./lib/decorators/iterate"),p=b("./lib/decorators/progress"),w=b("./lib/decorators/with"),s=b("./lib/decorators/unhandledRejection"),z=b("./lib/TimeoutError"),u=[g,h,k,v,p,q,w,e,s].reduce(function(a,b){return b(a)},b("./lib/Promise")),r=b("./lib/apply")(u);d.promise=function(a){return new u(a)};d.resolve=u.resolve;d.reject=u.reject;d.lift=a;d["try"]=c;d.attempt=c;d.iterate=u.iterate;d.unfold=u.unfold;d.join=function(){return u.all(arguments)};
d.all=function(a){return d(a,u.all)};d.settle=function(a){return d(a,u.settle)};d.any=a(u.any);d.some=a(u.some);d.race=a(u.race);d.map=function(a,b){return d(a,function(a){return u.map(a,b)})};d.filter=function(a,b){return d(a,function(a){return u.filter(a,b)})};d.reduce=a(u.reduce);d.reduceRight=a(u.reduceRight);d.isPromiseLike=function(a){return a&&"function"===typeof a.then};d.Promise=u;d.defer=function(){return new f};d.TimeoutError=z;return d})})(function(f){k.exports=f(g)})},{"./lib/Promise":57,
"./lib/TimeoutError":59,"./lib/apply":60,"./lib/decorators/array":61,"./lib/decorators/flow":62,"./lib/decorators/fold":63,"./lib/decorators/inspect":64,"./lib/decorators/iterate":65,"./lib/decorators/progress":66,"./lib/decorators/timed":67,"./lib/decorators/unhandledRejection":68,"./lib/decorators/with":69}],75:[function(g,k,h){(function(f){f(function(){return{findProperties:function d(a,c,f){"object"===typeof a&&null!==a&&(c in a&&f(a[c],a,c),Object.keys(a).forEach(function(e){d(a[e],c,f)}))}}})})(function(f){k.exports=
f(g)})},{}],76:[function(g,k,h){(function(f){f(function(b){var d;d=b("when");return function(a){var b,f,e,g,h;b=d.defer();f=!1;e=b.resolver;g=b.promise;h=g.then;g.then=function(){f||(f=!0,d.attempt(a).then(e.resolve,e.reject));return h.apply(g,arguments)};return g}})})(function(f){k.exports=f(g)})},{when:74}],77:[function(g,k,h){(function(f){f(function(){var b={};return function(d){var a,c,f,e;d||(d={});a=1;for(c=arguments.length;a<c;a+=1)for(e in f=arguments[a],f)e in d&&(d[e]===f[e]||e in b&&b[e]===
f[e])||(d[e]=f[e]);return d}})})(function(f){k.exports=f(g)})},{}],78:[function(g,k,h){(function(f){f(function(){return function(b){return b.toLowerCase().split("-").map(function(b){return b.charAt(0).toUpperCase()+b.slice(1)}).join("-")}})})(function(f){k.exports=f(g)})},{}],79:[function(g,k,h){(function(f){f(function(b){function d(a,b){return a.then(function(a){return a&&a[b]},function(a){return q.reject(a&&a[b])})}function a(){return d(this,"entity")}function c(){return d(d(this,"status"),"code")}
function f(){return d(this,"headers")}function e(a){a=v(a);return d(this.headers(),a)}function g(a){a=[].concat(a);return h(q.reduce(a,function(a,b){"string"===typeof b&&(b={rel:b});if("function"!==typeof a.entity.clientFor)throw Error("Hypermedia response expected");return a.entity.clientFor(b.rel)({params:b.params})},this))}function h(b){b.status=c;b.headers=f;b.header=e;b.entity=a;b.follow=g;return b}function k(){return h(q.apply(q,arguments))}var q=b("when"),v=b("./normalizeHeaderName");k.make=
h;k.reject=function(a){return h(q.reject(a))};k.promise=function(a){return h(q.promise(a))};return k})})(function(f){k.exports=f(g)})},{"./normalizeHeaderName":78,when:74}],80:[function(g,k,h){(function(f){f(function(){function b(a,b){if("string"!==typeof a)throw Error("String required for URL encoding");return a.split("").map(function(a){if(b.hasOwnProperty(a))return a;var c=a.charCodeAt(0);return 127>=c?"%"+c.toString(16).toUpperCase():encodeURIComponent(a).toUpperCase()}).join("")}function d(c){c=
c||a.unreserved;return function(a){return b(a,c)}}var a;a=function(){var a={alpha:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",digit:"0123456789",genDelims:":/?#[]@",subDelims:"!$&'()*+,;="};a.reserved=a.genDelims+a.subDelims;a.unreserved=a.alpha+a.digit+"-._~";a.url=a.reserved+a.unreserved;a.scheme=a.alpha+a.digit+"+-.";a.userinfo=a.unreserved+a.subDelims+":";a.host=a.unreserved+a.subDelims;a.port=a.digit;a.pchar=a.unreserved+a.subDelims+":@";a.segment=a.pchar;a.path=a.segment+"/";a.query=
a.pchar+"/?";a.fragment=a.pchar+"/?";return Object.keys(a).reduce(function(b,e){b[e]=a[e].split("").reduce(function(a,b){a[b]=!0;return a},{});return b},{})}();return{decode:function(a){return decodeURIComponent(a)},encode:d(),encodeURL:d(a.url),encodeScheme:d(a.scheme),encodeUserInfo:d(a.userinfo),encodeHost:d(a.host),encodePort:d(a.port),encodePathSegment:d(a.segment),encodePath:d(a.path),encodeQuery:d(a.query),encodeFragment:d(a.fragment)}})})(function(f){k.exports=f(g)})},{}],81:[function(g,k,
h){(function(f){f(function(b){function d(b,c,d){return c.split(",").reduce(function(c,g){var h,k,n;k=h=void 0;"*"===g.slice(-1)&&(g=g.slice(0,-1),h=!0);f.test(g)&&(k=f.exec(g),g=k[1],k=parseInt(k[2]));g=a.decode(g);n=d[g];if(void 0===n||null===n)return c;"string"===typeof n?(k&&(n=n.slice(0,k)),c+=c.length?b.separator:b.first,b.named&&(c+=b.encoder(g),c+=n.length?"=":b.empty),c+=b.encoder(n)):c=Array.isArray(n)?c+n.reduce(function(a,c){a.length?(a+=h?b.separator:",",b.named&&h&&(a+=b.encoder(g),a+=
c.length?"=":b.empty)):(a+=b.first,b.named&&(a+=b.encoder(g),a+=c.length?"=":b.empty));return a+=b.encoder(c)},""):c+Object.keys(n).reduce(function(a,c){a.length?a+=h?b.separator:",":(a+=b.first,b.named&&!h&&(a+=b.encoder(g),a+=n[c].length?"=":b.empty));a+=b.encoder(c);a+=h?"=":",";return a+=b.encoder(n[c])},"");return c},"")}var a,c,f;a=b("./uriEncoder");f=/^([^:]*):([0-9]+)$/;c={"":{first:"",separator:",",named:!1,empty:"",encoder:a.encode},"+":{first:"",separator:",",named:!1,empty:"",encoder:a.encodeURL},
"#":{first:"#",separator:",",named:!1,empty:"",encoder:a.encodeURL},".":{first:".",separator:".",named:!1,empty:"",encoder:a.encode},"/":{first:"/",separator:"/",named:!1,empty:"",encoder:a.encode},";":{first:";",separator:";",named:!0,empty:"",encoder:a.encode},"?":{first:"?",separator:"&",named:!0,empty:"=",encoder:a.encode},"&":{first:"&",separator:"&",named:!0,empty:"=",encoder:a.encode},"=":{reserved:!0},",":{reserved:!0},"!":{reserved:!0},"@":{reserved:!0},"|":{reserved:!0}};return{expand:function(a,
b){var f,g,h;h="";for(g=0;;){f=a.indexOf("{",g);if(-1===f){h+=a.slice(g);break}h+=a.slice(g,f);g=a.indexOf("}",f)+1;f=a.slice(f+1,g-1);var k=b,m=void 0;(m=c[f.slice(0,1)])?f=f.slice(1):m=c[""];if(m.reserved)throw Error("Reserved expression operations are not supported");f=d(m,f,k);h+=f}return h}}})})(function(f){k.exports=f(g)})},{"./uriEncoder":80}],82:[function(g,k,h){function f(){if(!a){a=!0;for(var b,f=d.length;f;){b=d;d=[];for(var e=-1;++e<f;)b[e]();f=d.length}a=!1}}function b(){}g=k.exports=
{};var d=[],a=!1;g.nextTick=function(b){d.push(b);a||setTimeout(f,0)};g.title="browser";g.browser=!0;g.env={};g.argv=[];g.version="";g.versions={};g.on=b;g.addListener=b;g.once=b;g.off=b;g.removeListener=b;g.removeAllListeners=b;g.emit=b;g.binding=function(a){throw Error("process.binding is not supported");};g.cwd=function(){return"/"};g.chdir=function(a){throw Error("process.chdir is not supported");};g.umask=function(){return 0}},{}]},{},[1])(1)});
|
src/components/ImgFigure.js
|
lxjx/gallery-by-react
|
import React from 'react';
class ImgFigure extends React.Component{
handleClick(){
return ()=>{
if(this.props.arrange.isCenter){
this.props.flip();
}else{
this.props.center();
}
}
}
render() {
let styleObj = this.props.arrange.pos?this.props.arrange.pos:{};
if(this.props.arrange.rotate){
styleObj['transform'] ='rotate('+this.props.arrange.rotate+'deg)';
}
if(this.props.arrange.isCenter){
styleObj['zIndex'] ='101';
}
let cn = this.props.arrange.isFlip?"img-figure is-inverse":"img-figure";
return <figure className = {cn} style= {styleObj} onClick = {this.handleClick()} >
<img src={this.props.data.imageURL} alt={this.props.data.title} />
<figcaption>
<h2 className ="img-title">{this.props.data.title}</h2>
<div className="img-back">
<p>{this.props.data.desc}</p>
</div>
</figcaption>
</figure>
}
}
ImgFigure.defaultProps = {
};
export default ImgFigure;
|
src/provider/api-connect.js
|
gugamm/redux-api-mapper
|
import React, { Component } from 'react';
import PropTypes from 'prop-types';
/**
* Connect a component to api functions
* @param {Function} apiToProps
* @returns {Function} - Returns a connected component
*/
function apiConnect(apiToProps) {
return function (ConnectComponent) {
class ApiConnected extends Component {
constructor(props, context) {
super(props, context);
this.apiProps = apiToProps(context.api, Object.assign({}, props));
}
render() {
return <ConnectComponent {...this.apiProps} {...this.props} />
}
}
ApiConnected.contextTypes = {
api : PropTypes.object
};
return ApiConnected;
};
}
export default apiConnect;
|
test/OverlayTriggerSpec.js
|
mxc/react-bootstrap
|
import React from 'react';
import ReactTestUtils from 'react/lib/ReactTestUtils';
import OverlayTrigger from '../src/OverlayTrigger';
import Popover from '../src/Popover';
import Tooltip from '../src/Tooltip';
import { render } from './helpers';
describe('OverlayTrigger', () => {
it('Should create OverlayTrigger element', () => {
const instance = ReactTestUtils.renderIntoDocument(
<OverlayTrigger overlay={<div>test</div>}>
<button>button</button>
</OverlayTrigger>
);
const overlayTrigger = React.findDOMNode(instance);
assert.equal(overlayTrigger.nodeName, 'BUTTON');
});
it('Should pass OverlayTrigger onClick prop to child', () => {
const callback = sinon.spy();
const instance = ReactTestUtils.renderIntoDocument(
<OverlayTrigger overlay={<div>test</div>} onClick={callback}>
<button>button</button>
</OverlayTrigger>
);
const overlayTrigger = React.findDOMNode(instance);
ReactTestUtils.Simulate.click(overlayTrigger);
callback.called.should.be.true;
});
it('Should show after click trigger', () => {
const instance = ReactTestUtils.renderIntoDocument(
<OverlayTrigger trigger='click' overlay={<div>test</div>}>
<button>button</button>
</OverlayTrigger>
);
const overlayTrigger = React.findDOMNode(instance);
ReactTestUtils.Simulate.click(overlayTrigger);
instance.state.isOverlayShown.should.be.true;
});
it('Should keep trigger handlers', (done) => {
const instance = render(
<div>
<OverlayTrigger trigger='focus' overlay={<div>test</div>}>
<button onBlur={()=> done()}>button</button>
</OverlayTrigger>
<input id='target'/>
</div>
, document.body);
const overlayTrigger = React.findDOMNode(instance).firstChild;
ReactTestUtils.Simulate.blur(overlayTrigger);
});
it('Should maintain overlay classname', () => {
const instance = ReactTestUtils.renderIntoDocument(
<OverlayTrigger trigger='click' overlay={<div className='test-overlay'>test</div>}>
<button>button</button>
</OverlayTrigger>
);
const overlayTrigger = React.findDOMNode(instance);
ReactTestUtils.Simulate.click(overlayTrigger);
expect(document.getElementsByClassName('test-overlay').length).to.equal(1);
});
it('Should pass transition callbacks to Transition', (done) => {
let count = 0;
let increment = ()=> count++;
let overlayTrigger;
let instance = ReactTestUtils.renderIntoDocument(
<OverlayTrigger
trigger='click'
overlay={<div>test</div>}
onHide={() => {}}
onExit={increment}
onExiting={increment}
onExited={()=> {
increment();
expect(count).to.equal(6);
done();
}}
onEnter={increment}
onEntering={increment}
onEntered={()=> {
increment();
ReactTestUtils.Simulate.click(overlayTrigger);
}}
>
<button>button</button>
</OverlayTrigger>
);
overlayTrigger = React.findDOMNode(instance);
ReactTestUtils.Simulate.click(overlayTrigger);
});
it('Should forward requested context', () => {
const contextTypes = {
key: React.PropTypes.string
};
const contextSpy = sinon.spy();
class ContextReader extends React.Component {
render() {
contextSpy(this.context.key);
return <div />;
}
}
ContextReader.contextTypes = contextTypes;
const TriggerWithContext = OverlayTrigger.withContext(contextTypes);
class ContextHolder extends React.Component {
getChildContext() {
return {key: 'value'};
}
render() {
return (
<TriggerWithContext
trigger="click"
overlay={<ContextReader />}
>
<button>button</button>
</TriggerWithContext>
);
}
}
ContextHolder.childContextTypes = contextTypes;
const instance = ReactTestUtils.renderIntoDocument(<ContextHolder />);
const overlayTrigger = React.findDOMNode(instance);
ReactTestUtils.Simulate.click(overlayTrigger);
contextSpy.calledWith('value').should.be.true;
});
describe('overlay types', () => {
[
{
name: 'Popover',
overlay: (<Popover>test</Popover>)
},
{
name: 'Tooltip',
overlay: (<Tooltip>test</Tooltip>)
}
].forEach( testCase => {
describe(testCase.name, () => {
let instance, overlayTrigger;
beforeEach(() => {
instance = ReactTestUtils.renderIntoDocument(
<OverlayTrigger trigger="click" overlay={testCase.overlay}>
<button>button</button>
</OverlayTrigger>
);
overlayTrigger = React.findDOMNode(instance);
});
it('Should handle trigger without warnings', () => {
ReactTestUtils.Simulate.click(overlayTrigger);
});
});
});
});
describe('rootClose', () => {
[
{
label: 'true',
rootClose: true,
shownAfterClick: false
},
{
label: 'default (false)',
rootClose: null,
shownAfterClick: true
}
].forEach( testCase => {
describe(testCase.label, () => {
let instance;
beforeEach(() => {
instance = ReactTestUtils.renderIntoDocument(
<OverlayTrigger
overlay={<div>test</div>}
trigger='click' rootClose={testCase.rootClose}
>
<button>button</button>
</OverlayTrigger>
);
const overlayTrigger = React.findDOMNode(instance);
ReactTestUtils.Simulate.click(overlayTrigger);
});
it('Should have correct isOverlayShown state', () => {
document.documentElement.click();
// Need to click this way for it to propagate to document element.
instance.state.isOverlayShown.should.equal(testCase.shownAfterClick);
});
});
});
describe('replaced overlay', () => {
let instance;
beforeEach(() => {
class ReplacedOverlay extends React.Component {
constructor(props) {
super(props);
this.handleClick = this.handleClick.bind(this);
this.state = {replaced: false};
}
handleClick() {
this.setState({replaced: true});
}
render() {
if (this.state.replaced) {
return (
<div>replaced</div>
);
}
return (
<div>
<a id="replace-overlay" onClick={this.handleClick}>
original
</a>
</div>
);
}
}
instance = ReactTestUtils.renderIntoDocument(
<OverlayTrigger
overlay={<ReplacedOverlay />}
trigger='click' rootClose={true}
>
<button>button</button>
</OverlayTrigger>
);
const overlayTrigger = React.findDOMNode(instance);
ReactTestUtils.Simulate.click(overlayTrigger);
});
it('Should still be shown', () => {
// Need to click this way for it to propagate to document element.
const replaceOverlay = document.getElementById('replace-overlay');
replaceOverlay.click();
instance.state.isOverlayShown.should.be.true;
});
});
});
});
|
ajax/libs/react-virtualized/8.11.4/react-virtualized.min.js
|
ahocevar/cdnjs
|
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("React"),require("React.addons.shallowCompare"),require("ReactDOM")):"function"==typeof define&&define.amd?define(["React","React.addons.shallowCompare","ReactDOM"],t):"object"==typeof exports?exports.ReactVirtualized=t(require("React"),require("React.addons.shallowCompare"),require("ReactDOM")):e.ReactVirtualized=t(e.React,e["React.addons.shallowCompare"],e.ReactDOM)}(this,function(e,t,n){return function(e){function t(o){if(n[o])return n[o].exports;var i=n[o]={exports:{},id:o,loaded:!1};return e[o].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(1);Object.defineProperty(t,"ArrowKeyStepper",{enumerable:!0,get:function(){return o.ArrowKeyStepper}});var i=n(91);Object.defineProperty(t,"AutoSizer",{enumerable:!0,get:function(){return i.AutoSizer}});var r=n(94);Object.defineProperty(t,"CellMeasurer",{enumerable:!0,get:function(){return r.CellMeasurer}}),Object.defineProperty(t,"defaultCellMeasurerCellSizeCache",{enumerable:!0,get:function(){return r.defaultCellSizeCache}}),Object.defineProperty(t,"uniformSizeCellMeasurerCellSizeCache",{enumerable:!0,get:function(){return r.defaultCellSizeCache}}),Object.defineProperty(t,"idCellMeasurerCellSizeCache",{enumerable:!0,get:function(){return r.idCellSizeCache}});var l=n(99);Object.defineProperty(t,"Collection",{enumerable:!0,get:function(){return l.Collection}});var s=n(119);Object.defineProperty(t,"ColumnSizer",{enumerable:!0,get:function(){return s.ColumnSizer}});var a=n(121);Object.defineProperty(t,"defaultTableCellDataGetter",{enumerable:!0,get:function(){return a.defaultCellDataGetter}}),Object.defineProperty(t,"defaultTableCellRenderer",{enumerable:!0,get:function(){return a.defaultCellRenderer}}),Object.defineProperty(t,"defaultTableHeaderRenderer",{enumerable:!0,get:function(){return a.defaultHeaderRenderer}}),Object.defineProperty(t,"defaultTableRowRenderer",{enumerable:!0,get:function(){return a.defaultRowRenderer}}),Object.defineProperty(t,"Table",{enumerable:!0,get:function(){return a.Table}}),Object.defineProperty(t,"Column",{enumerable:!0,get:function(){return a.Column}}),Object.defineProperty(t,"SortDirection",{enumerable:!0,get:function(){return a.SortDirection}}),Object.defineProperty(t,"SortIndicator",{enumerable:!0,get:function(){return a.SortIndicator}});var u=n(129);Object.defineProperty(t,"defaultCellRangeRenderer",{enumerable:!0,get:function(){return u.defaultCellRangeRenderer}}),Object.defineProperty(t,"Grid",{enumerable:!0,get:function(){return u.Grid}});var c=n(138);Object.defineProperty(t,"InfiniteLoader",{enumerable:!0,get:function(){return c.InfiniteLoader}});var d=n(140);Object.defineProperty(t,"List",{enumerable:!0,get:function(){return d.List}});var f=n(145);Object.defineProperty(t,"MultiGrid",{enumerable:!0,get:function(){return f.MultiGrid}});var h=n(147);Object.defineProperty(t,"ScrollSync",{enumerable:!0,get:function(){return h.ScrollSync}});var _=n(149);Object.defineProperty(t,"WindowScroller",{enumerable:!0,get:function(){return _.WindowScroller}})},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.ArrowKeyStepper=t.default=void 0;var i=n(2),r=o(i);t.default=r.default,t.ArrowKeyStepper=r.default},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(3),r=o(i),l=n(29),s=o(l),a=n(30),u=o(a),c=n(34),d=o(c),f=n(81),h=o(f),_=n(89),p=o(_),v=n(90),m=o(v),g=function(e){function t(e,n){(0,s.default)(this,t);var o=(0,d.default)(this,(t.__proto__||(0,r.default)(t)).call(this,e,n));return o.state={scrollToColumn:e.scrollToColumn,scrollToRow:e.scrollToRow},o._columnStartIndex=0,o._columnStopIndex=0,o._rowStartIndex=0,o._rowStopIndex=0,o._onKeyDown=o._onKeyDown.bind(o),o._onSectionRendered=o._onSectionRendered.bind(o),o}return(0,h.default)(t,e),(0,u.default)(t,[{key:"componentWillUpdate",value:function(e,t){var n=e.scrollToColumn,o=e.scrollToRow;this.props.scrollToColumn!==n&&this.setState({scrollToColumn:n}),this.props.scrollToRow!==o&&this.setState({scrollToRow:o})}},{key:"render",value:function(){var e=this.props,t=e.className,n=e.children,o=this.state,i=o.scrollToColumn,r=o.scrollToRow;return p.default.createElement("div",{className:t,onKeyDown:this._onKeyDown},n({onSectionRendered:this._onSectionRendered,scrollToColumn:i,scrollToRow:r}))}},{key:"shouldComponentUpdate",value:function(e,t){return(0,m.default)(this,e,t)}},{key:"_onKeyDown",value:function(e){var t=this.props,n=t.columnCount,o=t.disabled,i=t.mode,r=t.rowCount;if(!o){var l=this.state,s=l.scrollToColumn,a=l.scrollToRow,u=this.state,c=u.scrollToColumn,d=u.scrollToRow;switch(e.key){case"ArrowDown":d="cells"===i?Math.min(d+1,r-1):Math.min(this._rowStopIndex+1,r-1);break;case"ArrowLeft":c="cells"===i?Math.max(c-1,0):Math.max(this._columnStartIndex-1,0);break;case"ArrowRight":c="cells"===i?Math.min(c+1,n-1):Math.min(this._columnStopIndex+1,n-1);break;case"ArrowUp":d="cells"===i?Math.max(d-1,0):Math.max(this._rowStartIndex-1,0)}c===s&&d===a||(e.preventDefault(),this.setState({scrollToColumn:c,scrollToRow:d}))}}},{key:"_onSectionRendered",value:function(e){var t=e.columnStartIndex,n=e.columnStopIndex,o=e.rowStartIndex,i=e.rowStopIndex;this._columnStartIndex=t,this._columnStopIndex=n,this._rowStartIndex=o,this._rowStopIndex=i}}]),t}(_.Component);g.defaultProps={disabled:!1,mode:"edges",scrollToColumn:0,scrollToRow:0},t.default=g},function(e,t,n){e.exports={default:n(4),__esModule:!0}},function(e,t,n){n(5),e.exports=n(16).Object.getPrototypeOf},function(e,t,n){var o=n(6),i=n(8);n(14)("getPrototypeOf",function(){return function(e){return i(o(e))}})},function(e,t,n){var o=n(7);e.exports=function(e){return Object(o(e))}},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){var o=n(9),i=n(6),r=n(10)("IE_PROTO"),l=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=i(e),o(e,r)?e[r]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?l:null}},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var o=n(11)("keys"),i=n(13);e.exports=function(e){return o[e]||(o[e]=i(e))}},function(e,t,n){var o=n(12),i="__core-js_shared__",r=o[i]||(o[i]={});e.exports=function(e){return r[e]||(r[e]={})}},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t){var n=0,o=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+o).toString(36))}},function(e,t,n){var o=n(15),i=n(16),r=n(25);e.exports=function(e,t){var n=(i.Object||{})[e]||Object[e],l={};l[e]=t(n),o(o.S+o.F*r(function(){n(1)}),"Object",l)}},function(e,t,n){var o=n(12),i=n(16),r=n(17),l=n(19),s="prototype",a=function(e,t,n){var u,c,d,f=e&a.F,h=e&a.G,_=e&a.S,p=e&a.P,v=e&a.B,m=e&a.W,g=h?i:i[t]||(i[t]={}),S=g[s],y=h?o:_?o[t]:(o[t]||{})[s];h&&(n=t);for(u in n)c=!f&&y&&void 0!==y[u],c&&u in g||(d=c?y[u]:n[u],g[u]=h&&"function"!=typeof y[u]?n[u]:v&&c?r(d,o):m&&y[u]==d?function(e){var t=function(t,n,o){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,o)}return e.apply(this,arguments)};return t[s]=e[s],t}(d):p&&"function"==typeof d?r(Function.call,d):d,p&&((g.virtual||(g.virtual={}))[u]=d,e&a.R&&S&&!S[u]&&l(S,u,d)))};a.F=1,a.G=2,a.S=4,a.P=8,a.B=16,a.W=32,a.U=64,a.R=128,e.exports=a},function(e,t){var n=e.exports={version:"2.4.0"};"number"==typeof __e&&(__e=n)},function(e,t,n){var o=n(18);e.exports=function(e,t,n){if(o(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,o){return e.call(t,n,o)};case 3:return function(n,o,i){return e.call(t,n,o,i)}}return function(){return e.apply(t,arguments)}}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,n){var o=n(20),i=n(28);e.exports=n(24)?function(e,t,n){return o.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){var o=n(21),i=n(23),r=n(27),l=Object.defineProperty;t.f=n(24)?Object.defineProperty:function(e,t,n){if(o(e),t=r(t,!0),o(n),i)try{return l(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){var o=n(22);e.exports=function(e){if(!o(e))throw TypeError(e+" is not an object!");return e}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){e.exports=!n(24)&&!n(25)(function(){return 7!=Object.defineProperty(n(26)("div"),"a",{get:function(){return 7}}).a})},function(e,t,n){e.exports=!n(25)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,n){var o=n(22),i=n(12).document,r=o(i)&&o(i.createElement);e.exports=function(e){return r?i.createElement(e):{}}},function(e,t,n){var o=n(22);e.exports=function(e,t){if(!o(e))return e;var n,i;if(t&&"function"==typeof(n=e.toString)&&!o(i=n.call(e)))return i;if("function"==typeof(n=e.valueOf)&&!o(i=n.call(e)))return i;if(!t&&"function"==typeof(n=e.toString)&&!o(i=n.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t){"use strict";t.__esModule=!0,t.default=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var i=n(31),r=o(i);t.default=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),(0,r.default)(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}()},function(e,t,n){e.exports={default:n(32),__esModule:!0}},function(e,t,n){n(33);var o=n(16).Object;e.exports=function(e,t,n){return o.defineProperty(e,t,n)}},function(e,t,n){var o=n(15);o(o.S+o.F*!n(24),"Object",{defineProperty:n(20).f})},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var i=n(35),r=o(i);t.default=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==("undefined"==typeof t?"undefined":(0,r.default)(t))&&"function"!=typeof t?e:t}},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var i=n(36),r=o(i),l=n(65),s=o(l),a="function"==typeof s.default&&"symbol"==typeof r.default?function(e){return typeof e}:function(e){return e&&"function"==typeof s.default&&e.constructor===s.default?"symbol":typeof e};t.default="function"==typeof s.default&&"symbol"===a(r.default)?function(e){return"undefined"==typeof e?"undefined":a(e)}:function(e){return e&&"function"==typeof s.default&&e.constructor===s.default?"symbol":"undefined"==typeof e?"undefined":a(e)}},function(e,t,n){e.exports={default:n(37),__esModule:!0}},function(e,t,n){n(38),n(60),e.exports=n(64).f("iterator")},function(e,t,n){"use strict";var o=n(39)(!0);n(41)(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,n=this._i;return n>=t.length?{value:void 0,done:!0}:(e=o(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t,n){var o=n(40),i=n(7);e.exports=function(e){return function(t,n){var r,l,s=String(i(t)),a=o(n),u=s.length;return a<0||a>=u?e?"":void 0:(r=s.charCodeAt(a),r<55296||r>56319||a+1===u||(l=s.charCodeAt(a+1))<56320||l>57343?e?s.charAt(a):r:e?s.slice(a,a+2):(r-55296<<10)+(l-56320)+65536)}}},function(e,t){var n=Math.ceil,o=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?o:n)(e)}},function(e,t,n){"use strict";var o=n(42),i=n(15),r=n(43),l=n(19),s=n(9),a=n(44),u=n(45),c=n(58),d=n(8),f=n(59)("iterator"),h=!([].keys&&"next"in[].keys()),_="@@iterator",p="keys",v="values",m=function(){return this};e.exports=function(e,t,n,g,S,y,C){u(n,t,g);var w,R,x,b=function(e){if(!h&&e in I)return I[e];switch(e){case p:return function(){return new n(this,e)};case v:return function(){return new n(this,e)}}return function(){return new n(this,e)}},z=t+" Iterator",T=S==v,M=!1,I=e.prototype,O=I[f]||I[_]||S&&I[S],k=O||b(S),P=S?T?b("entries"):k:void 0,L="Array"==t?I.entries||O:O;if(L&&(x=d(L.call(new e)),x!==Object.prototype&&(c(x,z,!0),o||s(x,f)||l(x,f,m))),T&&O&&O.name!==v&&(M=!0,k=function(){return O.call(this)}),o&&!C||!h&&!M&&I[f]||l(I,f,k),a[t]=k,a[z]=m,S)if(w={values:T?k:b(v),keys:y?k:b(p),entries:P},C)for(R in w)R in I||r(I,R,w[R]);else i(i.P+i.F*(h||M),t,w);return w}},function(e,t){e.exports=!0},function(e,t,n){e.exports=n(19)},function(e,t){e.exports={}},function(e,t,n){"use strict";var o=n(46),i=n(28),r=n(58),l={};n(19)(l,n(59)("iterator"),function(){return this}),e.exports=function(e,t,n){e.prototype=o(l,{next:i(1,n)}),r(e,t+" Iterator")}},function(e,t,n){var o=n(21),i=n(47),r=n(56),l=n(10)("IE_PROTO"),s=function(){},a="prototype",u=function(){var e,t=n(26)("iframe"),o=r.length,i="<",l=">";for(t.style.display="none",n(57).appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write(i+"script"+l+"document.F=Object"+i+"/script"+l),e.close(),u=e.F;o--;)delete u[a][r[o]];return u()};e.exports=Object.create||function(e,t){var n;return null!==e?(s[a]=o(e),n=new s,s[a]=null,n[l]=e):n=u(),void 0===t?n:i(n,t)}},function(e,t,n){var o=n(20),i=n(21),r=n(48);e.exports=n(24)?Object.defineProperties:function(e,t){i(e);for(var n,l=r(t),s=l.length,a=0;s>a;)o.f(e,n=l[a++],t[n]);return e}},function(e,t,n){var o=n(49),i=n(56);e.exports=Object.keys||function(e){return o(e,i)}},function(e,t,n){var o=n(9),i=n(50),r=n(53)(!1),l=n(10)("IE_PROTO");e.exports=function(e,t){var n,s=i(e),a=0,u=[];for(n in s)n!=l&&o(s,n)&&u.push(n);for(;t.length>a;)o(s,n=t[a++])&&(~r(u,n)||u.push(n));return u}},function(e,t,n){var o=n(51),i=n(7);e.exports=function(e){return o(i(e))}},function(e,t,n){var o=n(52);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==o(e)?e.split(""):Object(e)}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){var o=n(50),i=n(54),r=n(55);e.exports=function(e){return function(t,n,l){var s,a=o(t),u=i(a.length),c=r(l,u);if(e&&n!=n){for(;u>c;)if(s=a[c++],s!=s)return!0}else for(;u>c;c++)if((e||c in a)&&a[c]===n)return e||c||0;return!e&&-1}}},function(e,t,n){var o=n(40),i=Math.min;e.exports=function(e){return e>0?i(o(e),9007199254740991):0}},function(e,t,n){var o=n(40),i=Math.max,r=Math.min;e.exports=function(e,t){return e=o(e),e<0?i(e+t,0):r(e,t)}},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){e.exports=n(12).document&&document.documentElement},function(e,t,n){var o=n(20).f,i=n(9),r=n(59)("toStringTag");e.exports=function(e,t,n){e&&!i(e=n?e:e.prototype,r)&&o(e,r,{configurable:!0,value:t})}},function(e,t,n){var o=n(11)("wks"),i=n(13),r=n(12).Symbol,l="function"==typeof r,s=e.exports=function(e){return o[e]||(o[e]=l&&r[e]||(l?r:i)("Symbol."+e))};s.store=o},function(e,t,n){n(61);for(var o=n(12),i=n(19),r=n(44),l=n(59)("toStringTag"),s=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],a=0;a<5;a++){var u=s[a],c=o[u],d=c&&c.prototype;d&&!d[l]&&i(d,l,u),r[u]=r.Array}},function(e,t,n){"use strict";var o=n(62),i=n(63),r=n(44),l=n(50);e.exports=n(41)(Array,"Array",function(e,t){this._t=l(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,n=this._i++;return!e||n>=e.length?(this._t=void 0,i(1)):"keys"==t?i(0,n):"values"==t?i(0,e[n]):i(0,[n,e[n]])},"values"),r.Arguments=r.Array,o("keys"),o("values"),o("entries")},function(e,t){e.exports=function(){}},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t,n){t.f=n(59)},function(e,t,n){e.exports={default:n(66),__esModule:!0}},function(e,t,n){n(67),n(78),n(79),n(80),e.exports=n(16).Symbol},function(e,t,n){"use strict";var o=n(12),i=n(9),r=n(24),l=n(15),s=n(43),a=n(68).KEY,u=n(25),c=n(11),d=n(58),f=n(13),h=n(59),_=n(64),p=n(69),v=n(70),m=n(71),g=n(74),S=n(21),y=n(50),C=n(27),w=n(28),R=n(46),x=n(75),b=n(77),z=n(20),T=n(48),M=b.f,I=z.f,O=x.f,k=o.Symbol,P=o.JSON,L=P&&P.stringify,A="prototype",E=h("_hidden"),G=h("toPrimitive"),W={}.propertyIsEnumerable,H=c("symbol-registry"),D=c("symbols"),j=c("op-symbols"),N=Object[A],F="function"==typeof k,U=o.QObject,B=!U||!U[A]||!U[A].findChild,V=r&&u(function(){return 7!=R(I({},"a",{get:function(){return I(this,"a",{value:7}).a}})).a})?function(e,t,n){var o=M(N,t);o&&delete N[t],I(e,t,n),o&&e!==N&&I(N,t,o)}:I,K=function(e){var t=D[e]=R(k[A]);return t._k=e,t},q=F&&"symbol"==typeof k.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof k},Y=function(e,t,n){return e===N&&Y(j,t,n),S(e),t=C(t,!0),S(n),i(D,t)?(n.enumerable?(i(e,E)&&e[E][t]&&(e[E][t]=!1),n=R(n,{enumerable:w(0,!1)})):(i(e,E)||I(e,E,w(1,{})),e[E][t]=!0),V(e,t,n)):I(e,t,n)},Q=function(e,t){S(e);for(var n,o=m(t=y(t)),i=0,r=o.length;r>i;)Y(e,n=o[i++],t[n]);return e},X=function(e,t){return void 0===t?R(e):Q(R(e),t)},J=function(e){var t=W.call(this,e=C(e,!0));return!(this===N&&i(D,e)&&!i(j,e))&&(!(t||!i(this,e)||!i(D,e)||i(this,E)&&this[E][e])||t)},Z=function(e,t){if(e=y(e),t=C(t,!0),e!==N||!i(D,t)||i(j,t)){var n=M(e,t);return!n||!i(D,t)||i(e,E)&&e[E][t]||(n.enumerable=!0),n}},$=function(e){for(var t,n=O(y(e)),o=[],r=0;n.length>r;)i(D,t=n[r++])||t==E||t==a||o.push(t);return o},ee=function(e){for(var t,n=e===N,o=O(n?j:y(e)),r=[],l=0;o.length>l;)!i(D,t=o[l++])||n&&!i(N,t)||r.push(D[t]);return r};F||(k=function(){if(this instanceof k)throw TypeError("Symbol is not a constructor!");var e=f(arguments.length>0?arguments[0]:void 0),t=function(n){this===N&&t.call(j,n),i(this,E)&&i(this[E],e)&&(this[E][e]=!1),V(this,e,w(1,n))};return r&&B&&V(N,e,{configurable:!0,set:t}),K(e)},s(k[A],"toString",function(){return this._k}),b.f=Z,z.f=Y,n(76).f=x.f=$,n(73).f=J,n(72).f=ee,r&&!n(42)&&s(N,"propertyIsEnumerable",J,!0),_.f=function(e){return K(h(e))}),l(l.G+l.W+l.F*!F,{Symbol:k});for(var te="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),ne=0;te.length>ne;)h(te[ne++]);for(var te=T(h.store),ne=0;te.length>ne;)p(te[ne++]);l(l.S+l.F*!F,"Symbol",{for:function(e){return i(H,e+="")?H[e]:H[e]=k(e)},keyFor:function(e){if(q(e))return v(H,e);throw TypeError(e+" is not a symbol!")},useSetter:function(){B=!0},useSimple:function(){B=!1}}),l(l.S+l.F*!F,"Object",{create:X,defineProperty:Y,defineProperties:Q,getOwnPropertyDescriptor:Z,getOwnPropertyNames:$,getOwnPropertySymbols:ee}),P&&l(l.S+l.F*(!F||u(function(){var e=k();return"[null]"!=L([e])||"{}"!=L({a:e})||"{}"!=L(Object(e))})),"JSON",{stringify:function(e){if(void 0!==e&&!q(e)){for(var t,n,o=[e],i=1;arguments.length>i;)o.push(arguments[i++]);return t=o[1],"function"==typeof t&&(n=t),!n&&g(t)||(t=function(e,t){if(n&&(t=n.call(this,e,t)),!q(t))return t}),o[1]=t,L.apply(P,o)}}}),k[A][G]||n(19)(k[A],G,k[A].valueOf),d(k,"Symbol"),d(Math,"Math",!0),d(o.JSON,"JSON",!0)},function(e,t,n){var o=n(13)("meta"),i=n(22),r=n(9),l=n(20).f,s=0,a=Object.isExtensible||function(){return!0},u=!n(25)(function(){return a(Object.preventExtensions({}))}),c=function(e){l(e,o,{value:{i:"O"+ ++s,w:{}}})},d=function(e,t){if(!i(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!r(e,o)){if(!a(e))return"F";if(!t)return"E";c(e)}return e[o].i},f=function(e,t){if(!r(e,o)){if(!a(e))return!0;if(!t)return!1;c(e)}return e[o].w},h=function(e){return u&&_.NEED&&a(e)&&!r(e,o)&&c(e),e},_=e.exports={KEY:o,NEED:!1,fastKey:d,getWeak:f,onFreeze:h}},function(e,t,n){var o=n(12),i=n(16),r=n(42),l=n(64),s=n(20).f;e.exports=function(e){var t=i.Symbol||(i.Symbol=r?{}:o.Symbol||{});"_"==e.charAt(0)||e in t||s(t,e,{value:l.f(e)})}},function(e,t,n){var o=n(48),i=n(50);e.exports=function(e,t){for(var n,r=i(e),l=o(r),s=l.length,a=0;s>a;)if(r[n=l[a++]]===t)return n}},function(e,t,n){var o=n(48),i=n(72),r=n(73);e.exports=function(e){var t=o(e),n=i.f;if(n)for(var l,s=n(e),a=r.f,u=0;s.length>u;)a.call(e,l=s[u++])&&t.push(l);return t}},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,n){var o=n(52);e.exports=Array.isArray||function(e){return"Array"==o(e)}},function(e,t,n){var o=n(50),i=n(76).f,r={}.toString,l="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],s=function(e){try{return i(e)}catch(e){return l.slice()}};e.exports.f=function(e){return l&&"[object Window]"==r.call(e)?s(e):i(o(e))}},function(e,t,n){var o=n(49),i=n(56).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return o(e,i)}},function(e,t,n){var o=n(73),i=n(28),r=n(50),l=n(27),s=n(9),a=n(23),u=Object.getOwnPropertyDescriptor;t.f=n(24)?u:function(e,t){if(e=r(e),t=l(t,!0),a)try{return u(e,t)}catch(e){}if(s(e,t))return i(!o.f.call(e,t),e[t])}},function(e,t){},function(e,t,n){n(69)("asyncIterator")},function(e,t,n){n(69)("observable")},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var i=n(82),r=o(i),l=n(86),s=o(l),a=n(35),u=o(a);t.default=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+("undefined"==typeof t?"undefined":(0,u.default)(t)));e.prototype=(0,s.default)(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(r.default?(0,r.default)(e,t):e.__proto__=t)}},function(e,t,n){e.exports={default:n(83),__esModule:!0}},function(e,t,n){n(84),e.exports=n(16).Object.setPrototypeOf},function(e,t,n){var o=n(15);o(o.S,"Object",{setPrototypeOf:n(85).set})},function(e,t,n){var o=n(22),i=n(21),r=function(e,t){if(i(e),!o(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,o){try{o=n(17)(Function.call,n(77).f(Object.prototype,"__proto__").set,2),o(e,[]),t=!(e instanceof Array)}catch(e){t=!0}return function(e,n){return r(e,n),t?e.__proto__=n:o(e,n),e}}({},!1):void 0),check:r}},function(e,t,n){e.exports={default:n(87),__esModule:!0}},function(e,t,n){n(88);var o=n(16).Object;e.exports=function(e,t){return o.create(e,t)}},function(e,t,n){var o=n(15);o(o.S,"Object",{create:n(46)})},function(t,n){t.exports=e},function(e,t){e.exports=React.addons.shallowCompare},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.AutoSizer=t.default=void 0;var i=n(92),r=o(i);t.default=r.default,t.AutoSizer=r.default},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(3),r=o(i),l=n(29),s=o(l),a=n(30),u=o(a),c=n(34),d=o(c),f=n(81),h=o(f),_=n(89),p=o(_),v=n(90),m=o(v),g=n(93),S=o(g),y=function(e){function t(e){(0,s.default)(this,t);var n=(0,d.default)(this,(t.__proto__||(0,r.default)(t)).call(this,e));return n.state={height:0,width:0},n._onResize=n._onResize.bind(n),n._setRef=n._setRef.bind(n),n}return(0,h.default)(t,e),(0,u.default)(t,[{key:"componentDidMount",value:function(){this._parentNode=this._autoSizer.parentNode,this._detectElementResize=(0,S.default)(),this._detectElementResize.addResizeListener(this._parentNode,this._onResize),this._onResize()}},{key:"componentWillUnmount",value:function(){this._detectElementResize&&this._detectElementResize.removeResizeListener(this._parentNode,this._onResize)}},{key:"render",value:function(){var e=this.props,t=e.children,n=e.disableHeight,o=e.disableWidth,i=this.state,r=i.height,l=i.width,s={overflow:"visible"};return n||(s.height=0),o||(s.width=0),p.default.createElement("div",{ref:this._setRef,style:s},t({height:r,width:l}))}},{key:"shouldComponentUpdate",value:function(e,t){return(0,m.default)(this,e,t)}},{key:"_onResize",value:function(){var e=this.props.onResize,t=this._parentNode.getBoundingClientRect(),n=t.height||0,o=t.width||0,i=window.getComputedStyle(this._parentNode)||{},r=parseInt(i.paddingLeft,10)||0,l=parseInt(i.paddingRight,10)||0,s=parseInt(i.paddingTop,10)||0,a=parseInt(i.paddingBottom,10)||0;this.setState({height:n-s-a,width:o-r-l}),e({height:n,width:o})}},{key:"_setRef",value:function(e){this._autoSizer=e}}]),t}(_.Component);y.defaultProps={onResize:function(){}},t.default=y},function(e,t){"use strict";function n(){var e;e="undefined"!=typeof window?window:"undefined"!=typeof self?self:this;var t="undefined"!=typeof document&&document.attachEvent;if(!t){var n=function(){var t=e.requestAnimationFrame||e.mozRequestAnimationFrame||e.webkitRequestAnimationFrame||function(t){return e.setTimeout(t,20)};return function(e){return t(e)}}(),o=function(){var t=e.cancelAnimationFrame||e.mozCancelAnimationFrame||e.webkitCancelAnimationFrame||e.clearTimeout;return function(e){return t(e)}}(),i=function(e){var t=e.__resizeTriggers__,n=t.firstElementChild,o=t.lastElementChild,i=n.firstElementChild;o.scrollLeft=o.scrollWidth,o.scrollTop=o.scrollHeight,i.style.width=n.offsetWidth+1+"px",i.style.height=n.offsetHeight+1+"px",n.scrollLeft=n.scrollWidth,n.scrollTop=n.scrollHeight},r=function(e){return e.offsetWidth!=e.__resizeLast__.width||e.offsetHeight!=e.__resizeLast__.height},l=function(e){if(!(e.target.className.indexOf("contract-trigger")<0&&e.target.className.indexOf("expand-trigger")<0)){var t=this;i(this),this.__resizeRAF__&&o(this.__resizeRAF__),this.__resizeRAF__=n(function(){r(t)&&(t.__resizeLast__.width=t.offsetWidth,t.__resizeLast__.height=t.offsetHeight,t.__resizeListeners__.forEach(function(n){n.call(t,e)}))})}},s=!1,a="animation",u="",c="animationstart",d="Webkit Moz O ms".split(" "),f="webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" "),h="",_=document.createElement("fakeelement");if(void 0!==_.style.animationName&&(s=!0),s===!1)for(var p=0;p<d.length;p++)if(void 0!==_.style[d[p]+"AnimationName"]){h=d[p],a=h+"Animation",u="-"+h.toLowerCase()+"-",c=f[p],s=!0;break}var v="resizeanim",m="@"+u+"keyframes "+v+" { from { opacity: 0; } to { opacity: 0; } } ",g=u+"animation: 1ms "+v+"; "}var S=function(){if(!document.getElementById("detectElementResize")){var e=(m?m:"")+".resize-triggers { "+(g?g:"")+'visibility: hidden; opacity: 0; } .resize-triggers, .resize-triggers > div, .contract-trigger:before { content: " "; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; z-index: -1; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }',t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.id="detectElementResize",n.type="text/css",n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e)),t.appendChild(n)}},y=function(n,o){if(t)n.attachEvent("onresize",o);else{if(!n.__resizeTriggers__){var r=e.getComputedStyle(n);r&&"static"==r.position&&(n.style.position="relative"),S(),n.__resizeLast__={},n.__resizeListeners__=[],(n.__resizeTriggers__=document.createElement("div")).className="resize-triggers",n.__resizeTriggers__.innerHTML='<div class="expand-trigger"><div></div></div><div class="contract-trigger"></div>',n.appendChild(n.__resizeTriggers__),i(n),n.addEventListener("scroll",l,!0),c&&(n.__resizeTriggers__.__animationListener__=function(e){e.animationName==v&&i(n)},n.__resizeTriggers__.addEventListener(c,n.__resizeTriggers__.__animationListener__))}n.__resizeListeners__.push(o)}},C=function(e,n){if(t)e.detachEvent("onresize",n);else if(e.__resizeListeners__.splice(e.__resizeListeners__.indexOf(n),1),!e.__resizeListeners__.length){e.removeEventListener("scroll",l,!0),e.__resizeTriggers__.__animationListener__&&(e.__resizeTriggers__.removeEventListener(c,e.__resizeTriggers__.__animationListener__),e.__resizeTriggers__.__animationListener__=null);try{e.__resizeTriggers__=!e.removeChild(e.__resizeTriggers__)}catch(e){}}};return{addResizeListener:y,removeResizeListener:C}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.idCellSizeCache=t.defaultCellSizeCache=t.CellMeasurer=t.default=void 0;var i=n(95),r=o(i),l=n(97),s=o(l),a=n(98),u=o(a);t.default=r.default,t.CellMeasurer=r.default,t.defaultCellSizeCache=s.default,t.idCellSizeCache=u.default},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(3),r=o(i),l=n(29),s=o(l),a=n(30),u=o(a),c=n(34),d=o(c),f=n(81),h=o(f),_=n(89),p=(o(_),n(90)),v=o(p),m=n(96),g=o(m),S=n(97),y=o(S),C=function(e){function t(e,n){(0,s.default)(this,t);var o=(0,d.default)(this,(t.__proto__||(0,r.default)(t)).call(this,e,n));return o._cellSizeCache=e.cellSizeCache||new y.default,o.getColumnWidth=o.getColumnWidth.bind(o),o.getRowHeight=o.getRowHeight.bind(o),o.resetMeasurements=o.resetMeasurements.bind(o),o.resetMeasurementForColumn=o.resetMeasurementForColumn.bind(o),o.resetMeasurementForRow=o.resetMeasurementForRow.bind(o),o}return(0,h.default)(t,e),(0,u.default)(t,[{key:"getColumnWidth",value:function(e){var t=e.index,n=this._cellSizeCache.getColumnWidth(t);if(null!=n)return n;for(var o=this.props.rowCount,i=0,r=0;r<o;r++){var l=this._measureCell({clientWidth:!0,columnIndex:t,rowIndex:r}),s=l.width;i=Math.max(i,s)}return this._cellSizeCache.setColumnWidth(t,i),i}},{key:"getRowHeight",value:function(e){var t=e.index,n=this._cellSizeCache.getRowHeight(t);if(null!=n)return n;for(var o=this.props.columnCount,i=0,r=0;r<o;r++){var l=this._measureCell({clientHeight:!0,columnIndex:r,rowIndex:t}),s=l.height;i=Math.max(i,s)}return this._cellSizeCache.setRowHeight(t,i),i}},{key:"resetMeasurementForColumn",value:function(e){this._cellSizeCache.clearColumnWidth(e)}},{key:"resetMeasurementForRow",value:function(e){this._cellSizeCache.clearRowHeight(e)}},{key:"resetMeasurements",value:function(){this._cellSizeCache.clearAllColumnWidths(),this._cellSizeCache.clearAllRowHeights()}},{key:"componentDidMount",value:function(){this._renderAndMount()}},{key:"componentWillReceiveProps",value:function(e){var t=this.props.cellSizeCache;t!==e.cellSizeCache&&(this._cellSizeCache=e.cellSizeCache),this._updateDivDimensions(e)}},{key:"componentWillUnmount",value:function(){this._unmountContainer()}},{key:"render",value:function(){var e=this.props.children;return e({getColumnWidth:this.getColumnWidth,getRowHeight:this.getRowHeight,resetMeasurements:this.resetMeasurements,resetMeasurementForColumn:this.resetMeasurementForColumn,resetMeasurementForRow:this.resetMeasurementForRow})}},{key:"shouldComponentUpdate",value:function(e,t){return(0,v.default)(this,e,t)}},{key:"_getContainerNode",value:function(e){var t=e.container;return t?g.default.findDOMNode("function"==typeof t?t():t):document.body}},{key:"_measureCell",value:function(e){var t=e.clientHeight,n=void 0!==t&&t,o=e.clientWidth,i=void 0===o||o,r=e.columnIndex,l=e.rowIndex,s=this.props.cellRenderer,a=s({columnIndex:r,index:l,rowIndex:l});this._renderAndMount(),g.default.unstable_renderSubtreeIntoContainer(this,a,this._div);var u={height:n&&this._div.clientHeight,width:i&&this._div.clientWidth};return g.default.unmountComponentAtNode(this._div),u}},{key:"_renderAndMount",value:function(){this._div||(this._div=document.createElement("div"),this._div.style.display="inline-block",this._div.style.position="absolute",this._div.style.visibility="hidden",this._div.style.zIndex=-1,
this._updateDivDimensions(this.props),this._containerNode=this._getContainerNode(this.props),this._containerNode.appendChild(this._div))}},{key:"_unmountContainer",value:function(){this._div&&(this._containerNode.removeChild(this._div),this._div=null),this._containerNode=null}},{key:"_updateDivDimensions",value:function(e){var t=e.height,n=e.width;t&&t!==this._divHeight&&(this._divHeight=t,this._div.style.height=t+"px"),n&&n!==this._divWidth&&(this._divWidth=n,this._div.style.width=n+"px")}}]),t}(_.Component);t.default=C},function(e,t){e.exports=n},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(29),r=o(i),l=n(30),s=o(l),a=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.uniformRowHeight,o=void 0!==n&&n,i=t.uniformColumnWidth,l=void 0!==i&&i;(0,r.default)(this,e),this._uniformRowHeight=o,this._uniformColumnWidth=l,this._cachedColumnWidth=void 0,this._cachedRowHeight=void 0,this._cachedColumnWidths={},this._cachedRowHeights={}}return(0,s.default)(e,[{key:"clearAllColumnWidths",value:function(){this._cachedColumnWidth=void 0,this._cachedColumnWidths={}}},{key:"clearAllRowHeights",value:function(){this._cachedRowHeight=void 0,this._cachedRowHeights={}}},{key:"clearColumnWidth",value:function(e){this._cachedColumnWidth=void 0,delete this._cachedColumnWidths[e]}},{key:"clearRowHeight",value:function(e){this._cachedRowHeight=void 0,delete this._cachedRowHeights[e]}},{key:"getColumnWidth",value:function(e){return this._uniformColumnWidth?this._cachedColumnWidth:this._cachedColumnWidths[e]}},{key:"getRowHeight",value:function(e){return this._uniformRowHeight?this._cachedRowHeight:this._cachedRowHeights[e]}},{key:"setColumnWidth",value:function(e,t){this._cachedColumnWidth=t,this._cachedColumnWidths[e]=t}},{key:"setRowHeight",value:function(e,t){this._cachedRowHeight=t,this._cachedRowHeights[e]=t}}]),e}();t.default=a},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function i(e){var t=e.indexToIdMap,n=e.uniformColumnWidth,o=void 0!==n&&n,i=e.uniformRowHeight,r=void 0!==i&&i,s=new l.default({uniformColumnWidth:o,uniformRowHeight:r});return{clearAllColumnWidths:function(){s.clearAllColumnWidths()},clearAllRowHeights:function(){s.clearAllRowHeights()},clearColumnWidth:function(e){s.clearColumnWidth(t(e))},clearRowHeight:function(e){s.clearRowHeight(t(e))},getColumnWidth:function(e){return s.getColumnWidth(t(e))},getRowHeight:function(e){return s.getRowHeight(t(e))},setColumnWidth:function(e,n){s.setColumnWidth(t(e),n)},setRowHeight:function(e,n){s.setRowHeight(t(e),n)}}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var r=n(97),l=o(r)},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Collection=t.default=void 0;var i=n(100),r=o(i);t.default=r.default,t.Collection=r.default},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function i(e){var t=e.cellCache,n=e.cellRenderer,o=e.cellSizeAndPositionGetter,i=e.indices,r=e.isScrolling;return i.map(function(e){var i=o({index:e}),l={index:e,isScrolling:r,key:e,style:{height:i.height,left:i.x,position:"absolute",top:i.y,width:i.width}};return r?(e in t||(t[e]=n(l)),t[e]):n(l)}).filter(function(e){return!!e})}Object.defineProperty(t,"__esModule",{value:!0});var r=n(101),l=o(r),s=n(106),a=o(s),u=n(3),c=o(u),d=n(29),f=o(d),h=n(30),_=o(h),p=n(34),v=o(p),m=n(81),g=o(m),S=n(89),y=o(S),C=n(107),w=o(C),R=n(115),x=o(R),b=n(118),z=o(b),T=n(90),M=o(T),I=function(e){function t(e,n){(0,f.default)(this,t);var o=(0,v.default)(this,(t.__proto__||(0,c.default)(t)).call(this,e,n));return o._cellMetadata=[],o._lastRenderedCellIndices=[],o._cellCache=[],o._isScrollingChange=o._isScrollingChange.bind(o),o}return(0,g.default)(t,e),(0,_.default)(t,[{key:"recomputeCellSizesAndPositions",value:function(){this._cellCache=[],this._collectionView.recomputeCellSizesAndPositions()}},{key:"render",value:function(){var e=this,t=(0,a.default)(this.props,[]);return y.default.createElement(w.default,(0,l.default)({cellLayoutManager:this,isScrollingChange:this._isScrollingChange,ref:function(t){e._collectionView=t}},t))}},{key:"shouldComponentUpdate",value:function(e,t){return(0,M.default)(this,e,t)}},{key:"calculateSizeAndPositionData",value:function(){var e=this.props,t=e.cellCount,n=e.cellSizeAndPositionGetter,o=e.sectionSize,i=(0,x.default)({cellCount:t,cellSizeAndPositionGetter:n,sectionSize:o});this._cellMetadata=i.cellMetadata,this._sectionManager=i.sectionManager,this._height=i.height,this._width=i.width}},{key:"getLastRenderedIndices",value:function(){return this._lastRenderedCellIndices}},{key:"getScrollPositionForCell",value:function(e){var t=e.align,n=e.cellIndex,o=e.height,i=e.scrollLeft,r=e.scrollTop,l=e.width,s=this.props.cellCount;if(n>=0&&n<s){var a=this._cellMetadata[n];i=(0,z.default)({align:t,cellOffset:a.x,cellSize:a.width,containerSize:l,currentOffset:i,targetIndex:n}),r=(0,z.default)({align:t,cellOffset:a.y,cellSize:a.height,containerSize:o,currentOffset:r,targetIndex:n})}return{scrollLeft:i,scrollTop:r}}},{key:"getTotalSize",value:function(){return{height:this._height,width:this._width}}},{key:"cellRenderers",value:function(e){var t=this,n=e.height,o=e.isScrolling,i=e.width,r=e.x,l=e.y,s=this.props,a=s.cellGroupRenderer,u=s.cellRenderer;return this._lastRenderedCellIndices=this._sectionManager.getCellIndices({height:n,width:i,x:r,y:l}),a({cellCache:this._cellCache,cellRenderer:u,cellSizeAndPositionGetter:function(e){var n=e.index;return t._sectionManager.getCellMetadata({index:n})},indices:this._lastRenderedCellIndices,isScrolling:o})}},{key:"_isScrollingChange",value:function(e){e||(this._cellCache=[])}}]),t}(S.Component);I.defaultProps={"aria-label":"grid",cellGroupRenderer:i},t.default=I},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var i=n(102),r=o(i);t.default=r.default||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}},function(e,t,n){e.exports={default:n(103),__esModule:!0}},function(e,t,n){n(104),e.exports=n(16).Object.assign},function(e,t,n){var o=n(15);o(o.S+o.F,"Object",{assign:n(105)})},function(e,t,n){"use strict";var o=n(48),i=n(72),r=n(73),l=n(6),s=n(51),a=Object.assign;e.exports=!a||n(25)(function(){var e={},t={},n=Symbol(),o="abcdefghijklmnopqrst";return e[n]=7,o.split("").forEach(function(e){t[e]=e}),7!=a({},e)[n]||Object.keys(a({},t)).join("")!=o})?function(e,t){for(var n=l(e),a=arguments.length,u=1,c=i.f,d=r.f;a>u;)for(var f,h=s(arguments[u++]),_=c?o(h).concat(c(h)):o(h),p=_.length,v=0;p>v;)d.call(h,f=_[v++])&&(n[f]=h[f]);return n}:a},function(e,t){"use strict";t.__esModule=!0,t.default=function(e,t){var n={};for(var o in e)t.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n}},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(101),r=o(i),l=n(3),s=o(l),a=n(29),u=o(a),c=n(30),d=o(c),f=n(34),h=o(f),_=n(81),p=o(_),v=n(89),m=o(v),g=n(108),S=o(g),y=n(109),C=o(y),w=n(113),R=o(w),x=n(90),b=o(x),z=150,T={OBSERVED:"observed",REQUESTED:"requested"},M=function(e){function t(e,n){(0,u.default)(this,t);var o=(0,h.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,n));return o.state={calculateSizeAndPositionDataOnNextUpdate:!1,isScrolling:!1,scrollLeft:0,scrollTop:0},o._onSectionRenderedMemoizer=(0,C.default)(),o._onScrollMemoizer=(0,C.default)(!1),o._invokeOnSectionRenderedHelper=o._invokeOnSectionRenderedHelper.bind(o),o._onScroll=o._onScroll.bind(o),o._updateScrollPositionForScrollToCell=o._updateScrollPositionForScrollToCell.bind(o),o}return(0,p.default)(t,e),(0,d.default)(t,[{key:"recomputeCellSizesAndPositions",value:function(){this.setState({calculateSizeAndPositionDataOnNextUpdate:!0})}},{key:"componentDidMount",value:function(){var e=this.props,t=e.cellLayoutManager,n=e.scrollLeft,o=e.scrollToCell,i=e.scrollTop;this._scrollbarSizeMeasured||(this._scrollbarSize=(0,R.default)(),this._scrollbarSizeMeasured=!0,this.setState({})),o>=0?this._updateScrollPositionForScrollToCell():(n>=0||i>=0)&&this._setScrollPosition({scrollLeft:n,scrollTop:i}),this._invokeOnSectionRenderedHelper();var r=t.getTotalSize(),l=r.height,s=r.width;this._invokeOnScrollMemoizer({scrollLeft:n||0,scrollTop:i||0,totalHeight:l,totalWidth:s})}},{key:"componentDidUpdate",value:function(e,t){var n=this.props,o=n.height,i=n.scrollToAlignment,r=n.scrollToCell,l=n.width,s=this.state,a=s.scrollLeft,u=s.scrollPositionChangeReason,c=s.scrollTop;u===T.REQUESTED&&(a>=0&&a!==t.scrollLeft&&a!==this._scrollingContainer.scrollLeft&&(this._scrollingContainer.scrollLeft=a),c>=0&&c!==t.scrollTop&&c!==this._scrollingContainer.scrollTop&&(this._scrollingContainer.scrollTop=c)),o===e.height&&i===e.scrollToAlignment&&r===e.scrollToCell&&l===e.width||this._updateScrollPositionForScrollToCell(),this._invokeOnSectionRenderedHelper()}},{key:"componentWillMount",value:function(){var e=this.props.cellLayoutManager;e.calculateSizeAndPositionData(),this._scrollbarSize=(0,R.default)(),void 0===this._scrollbarSize?(this._scrollbarSizeMeasured=!1,this._scrollbarSize=0):this._scrollbarSizeMeasured=!0}},{key:"componentWillUnmount",value:function(){this._disablePointerEventsTimeoutId&&clearTimeout(this._disablePointerEventsTimeoutId)}},{key:"componentWillUpdate",value:function(e,t){0!==e.cellCount||0===t.scrollLeft&&0===t.scrollTop?e.scrollLeft===this.props.scrollLeft&&e.scrollTop===this.props.scrollTop||this._setScrollPosition({scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}):this._setScrollPosition({scrollLeft:0,scrollTop:0}),(e.cellCount!==this.props.cellCount||e.cellLayoutManager!==this.props.cellLayoutManager||t.calculateSizeAndPositionDataOnNextUpdate)&&e.cellLayoutManager.calculateSizeAndPositionData(),t.calculateSizeAndPositionDataOnNextUpdate&&this.setState({calculateSizeAndPositionDataOnNextUpdate:!1})}},{key:"render",value:function(){var e=this,t=this.props,n=t.autoHeight,o=t.cellCount,i=t.cellLayoutManager,l=t.className,s=t.height,a=t.horizontalOverscanSize,u=t.id,c=t.noContentRenderer,d=t.style,f=t.verticalOverscanSize,h=t.width,_=this.state,p=_.isScrolling,v=_.scrollLeft,g=_.scrollTop,y=i.getTotalSize(),C=y.height,w=y.width,R=Math.max(0,v-a),x=Math.max(0,g-f),b=Math.min(w,v+h+a),z=Math.min(C,g+s+f),T=s>0&&h>0?i.cellRenderers({height:z-x,isScrolling:p,width:b-R,x:R,y:x}):[],M={boxSizing:"border-box",direction:"ltr",height:n?"auto":s,position:"relative",WebkitOverflowScrolling:"touch",width:h,willChange:"transform"},I=C>s?this._scrollbarSize:0,O=w>h?this._scrollbarSize:0;return M.overflowX=w+I<=h?"hidden":"auto",M.overflowY=C+O<=s?"hidden":"auto",m.default.createElement("div",{ref:function(t){e._scrollingContainer=t},"aria-label":this.props["aria-label"],className:(0,S.default)("ReactVirtualized__Collection",l),id:u,onScroll:this._onScroll,role:"grid",style:(0,r.default)({},M,d),tabIndex:0},o>0&&m.default.createElement("div",{className:"ReactVirtualized__Collection__innerScrollContainer",style:{height:C,maxHeight:C,maxWidth:w,overflow:"hidden",pointerEvents:p?"none":"",width:w}},T),0===o&&c())}},{key:"shouldComponentUpdate",value:function(e,t){return(0,b.default)(this,e,t)}},{key:"_enablePointerEventsAfterDelay",value:function(){var e=this;this._disablePointerEventsTimeoutId&&clearTimeout(this._disablePointerEventsTimeoutId),this._disablePointerEventsTimeoutId=setTimeout(function(){var t=e.props.isScrollingChange;t(!1),e._disablePointerEventsTimeoutId=null,e.setState({isScrolling:!1})},z)}},{key:"_invokeOnSectionRenderedHelper",value:function(){var e=this.props,t=e.cellLayoutManager,n=e.onSectionRendered;this._onSectionRenderedMemoizer({callback:n,indices:{indices:t.getLastRenderedIndices()}})}},{key:"_invokeOnScrollMemoizer",value:function(e){var t=this,n=e.scrollLeft,o=e.scrollTop,i=e.totalHeight,r=e.totalWidth;this._onScrollMemoizer({callback:function(e){var n=e.scrollLeft,o=e.scrollTop,l=t.props,s=l.height,a=l.onScroll,u=l.width;a({clientHeight:s,clientWidth:u,scrollHeight:i,scrollLeft:n,scrollTop:o,scrollWidth:r})},indices:{scrollLeft:n,scrollTop:o}})}},{key:"_setScrollPosition",value:function(e){var t=e.scrollLeft,n=e.scrollTop,o={scrollPositionChangeReason:T.REQUESTED};t>=0&&(o.scrollLeft=t),n>=0&&(o.scrollTop=n),(t>=0&&t!==this.state.scrollLeft||n>=0&&n!==this.state.scrollTop)&&this.setState(o)}},{key:"_updateScrollPositionForScrollToCell",value:function(){var e=this.props,t=e.cellLayoutManager,n=e.height,o=e.scrollToAlignment,i=e.scrollToCell,r=e.width,l=this.state,s=l.scrollLeft,a=l.scrollTop;if(i>=0){var u=t.getScrollPositionForCell({align:o,cellIndex:i,height:n,scrollLeft:s,scrollTop:a,width:r});u.scrollLeft===s&&u.scrollTop===a||this._setScrollPosition(u)}}},{key:"_onScroll",value:function(e){if(e.target===this._scrollingContainer){this._enablePointerEventsAfterDelay();var t=this.props,n=t.cellLayoutManager,o=t.height,i=t.isScrollingChange,r=t.width,l=this._scrollbarSize,s=n.getTotalSize(),a=s.height,u=s.width,c=Math.max(0,Math.min(u-r+l,e.target.scrollLeft)),d=Math.max(0,Math.min(a-o+l,e.target.scrollTop));if(this.state.scrollLeft!==c||this.state.scrollTop!==d){var f=e.cancelable?T.OBSERVED:T.REQUESTED;this.state.isScrolling||i(!0),this.setState({isScrolling:!0,scrollLeft:c,scrollPositionChangeReason:f,scrollTop:d})}this._invokeOnScrollMemoizer({scrollLeft:c,scrollTop:d,totalWidth:u,totalHeight:a})}}}]),t}(v.Component);M.defaultProps={"aria-label":"grid",horizontalOverscanSize:0,noContentRenderer:function(){return null},onScroll:function(){return null},onSectionRendered:function(){return null},scrollToAlignment:"auto",style:{},verticalOverscanSize:0},t.default=M},function(e,t,n){var o,i;!function(){"use strict";function n(){for(var e=[],t=0;t<arguments.length;t++){var o=arguments[t];if(o){var i=typeof o;if("string"===i||"number"===i)e.push(o);else if(Array.isArray(o))e.push(n.apply(null,o));else if("object"===i)for(var l in o)r.call(o,l)&&o[l]&&e.push(l)}}return e.join(" ")}var r={}.hasOwnProperty;"undefined"!=typeof e&&e.exports?e.exports=n:(o=[],i=function(){return n}.apply(t,o),!(void 0!==i&&(e.exports=i)))}()},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function i(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t={};return function(n){var o=n.callback,i=n.indices,r=(0,l.default)(i),s=!e||r.every(function(e){var t=i[e];return Array.isArray(t)?t.length>0:t>=0}),a=r.length!==(0,l.default)(t).length||r.some(function(e){var n=t[e],o=i[e];return Array.isArray(o)?n.join(",")!==o.join(","):n!==o});t=i,s&&a&&o(i)}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(110),l=o(r);t.default=i},function(e,t,n){e.exports={default:n(111),__esModule:!0}},function(e,t,n){n(112),e.exports=n(16).Object.keys},function(e,t,n){var o=n(6),i=n(48);n(14)("keys",function(){return function(e){return i(o(e))}})},function(e,t,n){"use strict";var o,i=n(114);e.exports=function(e){if((!o||e)&&i){var t=document.createElement("div");t.style.position="absolute",t.style.top="-9999px",t.style.width="50px",t.style.height="50px",t.style.overflow="scroll",document.body.appendChild(t),o=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return o}},function(e,t){"use strict";e.exports=!("undefined"==typeof window||!window.document||!window.document.createElement)},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function i(e){for(var t=e.cellCount,n=e.cellSizeAndPositionGetter,o=e.sectionSize,i=[],r=new l.default(o),s=0,a=0,u=0;u<t;u++){var c=n({index:u});if(null==c.height||isNaN(c.height)||null==c.width||isNaN(c.width)||null==c.x||isNaN(c.x)||null==c.y||isNaN(c.y))throw Error("Invalid metadata returned for cell "+u+":\n x:"+c.x+", y:"+c.y+", width:"+c.width+", height:"+c.height);s=Math.max(s,c.y+c.height),a=Math.max(a,c.x+c.width),i[u]=c,r.registerCell({cellMetadatum:c,index:u})}return{cellMetadata:i,height:s,sectionManager:r,width:a}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var r=n(116),l=o(r)},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(110),r=o(i),l=n(29),s=o(l),a=n(30),u=o(a),c=n(117),d=o(c),f=100,h=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:f;(0,s.default)(this,e),this._sectionSize=t,this._cellMetadata=[],this._sections={}}return(0,u.default)(e,[{key:"getCellIndices",value:function(e){var t=e.height,n=e.width,o=e.x,i=e.y,l={};return this.getSections({height:t,width:n,x:o,y:i}).forEach(function(e){return e.getCellIndices().forEach(function(e){l[e]=e})}),(0,r.default)(l).map(function(e){return l[e]})}},{key:"getCellMetadata",value:function(e){var t=e.index;return this._cellMetadata[t]}},{key:"getSections",value:function(e){for(var t=e.height,n=e.width,o=e.x,i=e.y,r=Math.floor(o/this._sectionSize),l=Math.floor((o+n-1)/this._sectionSize),s=Math.floor(i/this._sectionSize),a=Math.floor((i+t-1)/this._sectionSize),u=[],c=r;c<=l;c++)for(var f=s;f<=a;f++){var h=c+"."+f;this._sections[h]||(this._sections[h]=new d.default({height:this._sectionSize,width:this._sectionSize,x:c*this._sectionSize,y:f*this._sectionSize})),u.push(this._sections[h])}return u}},{key:"getTotalSectionCount",value:function(){return(0,r.default)(this._sections).length}},{key:"toString",value:function(){var e=this;return(0,r.default)(this._sections).map(function(t){return e._sections[t].toString()})}},{key:"registerCell",value:function(e){var t=e.cellMetadatum,n=e.index;this._cellMetadata[n]=t,this.getSections(t).forEach(function(e){return e.addCellIndex({index:n})})}}]),e}();t.default=h},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(29),r=o(i),l=n(30),s=o(l),a=function(){function e(t){var n=t.height,o=t.width,i=t.x,l=t.y;(0,r.default)(this,e),this.height=n,this.width=o,this.x=i,this.y=l,this._indexMap={},this._indices=[]}return(0,s.default)(e,[{key:"addCellIndex",value:function(e){var t=e.index;this._indexMap[t]||(this._indexMap[t]=!0,this._indices.push(t))}},{key:"getCellIndices",value:function(){return this._indices}},{key:"toString",value:function(){return this.x+","+this.y+" "+this.width+"x"+this.height}}]),e}();t.default=a},function(e,t){"use strict";function n(e){var t=e.align,n=void 0===t?"auto":t,o=e.cellOffset,i=e.cellSize,r=e.containerSize,l=e.currentOffset,s=o,a=s-r+i;switch(n){case"start":return s;case"end":return a;case"center":return s-(r-i)/2;default:return Math.max(a,Math.min(s,l))}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.ColumnSizer=t.default=void 0;var i=n(120),r=o(i);t.default=r.default,t.ColumnSizer=r.default},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(3),r=o(i),l=n(29),s=o(l),a=n(30),u=o(a),c=n(34),d=o(c),f=n(81),h=o(f),_=n(89),p=n(90),v=o(p),m=function(e){function t(e,n){(0,s.default)(this,t);var o=(0,d.default)(this,(t.__proto__||(0,r.default)(t)).call(this,e,n));return o._registerChild=o._registerChild.bind(o),o}return(0,h.default)(t,e),(0,u.default)(t,[{key:"componentDidUpdate",value:function(e,t){var n=this.props,o=n.columnMaxWidth,i=n.columnMinWidth,r=n.columnCount,l=n.width;o===e.columnMaxWidth&&i===e.columnMinWidth&&r===e.columnCount&&l===e.width||this._registeredChild&&this._registeredChild.recomputeGridSize()}},{key:"render",value:function(){var e=this.props,t=e.children,n=e.columnMaxWidth,o=e.columnMinWidth,i=e.columnCount,r=e.width,l=o||1,s=n?Math.min(n,r):r,a=r/i;a=Math.max(l,a),a=Math.min(s,a),a=Math.floor(a);var u=Math.min(r,a*i);return t({adjustedWidth:u,getColumnWidth:function(){return a},registerChild:this._registerChild})}},{key:"shouldComponentUpdate",value:function(e,t){return(0,v.default)(this,e,t)}},{key:"_registerChild",value:function(e){if(e&&"function"!=typeof e.recomputeGridSize)throw Error("Unexpected child type registered; only Grid/MultiGrid children are supported.");this._registeredChild=e,this._registeredChild&&this._registeredChild.recomputeGridSize()}}]),t}(_.Component);t.default=m},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.SortIndicator=t.SortDirection=t.Column=t.Table=t.defaultRowRenderer=t.defaultHeaderRenderer=t.defaultCellRenderer=t.defaultCellDataGetter=t.default=void 0;var i=n(122),r=o(i),l=n(128),s=o(l),a=n(127),u=o(a),c=n(124),d=o(c),f=n(137),h=o(f),_=n(123),p=o(_),v=n(126),m=o(v),g=n(125),S=o(g);t.default=r.default,t.defaultCellDataGetter=s.default,t.defaultCellRenderer=u.default,t.defaultHeaderRenderer=d.default,t.defaultRowRenderer=h.default,t.Table=r.default,t.Column=p.default,t.SortDirection=m.default,t.SortIndicator=S.default},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(101),r=o(i),l=n(3),s=o(l),a=n(29),u=o(a),c=n(30),d=o(c),f=n(34),h=o(f),_=n(81),p=o(_),v=n(108),m=o(v),g=n(123),S=(o(g),n(89)),y=o(S),C=n(96),w=n(90),R=o(w),x=n(129),b=o(x),z=n(137),T=o(z),M=n(126),I=o(M),O=function(e){function t(e){(0,u.default)(this,t);var n=(0,h.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e));return n.state={scrollbarWidth:0},n._createColumn=n._createColumn.bind(n),n._createRow=n._createRow.bind(n),n._onScroll=n._onScroll.bind(n),n._onSectionRendered=n._onSectionRendered.bind(n),n}return(0,p.default)(t,e),(0,d.default)(t,[{key:"forceUpdateGrid",value:function(){this.Grid.forceUpdate()}},{key:"measureAllRows",value:function(){this.Grid.measureAllCells()}},{key:"recomputeRowHeights",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.Grid.recomputeGridSize({rowIndex:e})}},{key:"scrollToRow",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.Grid.scrollToCell({columnIndex:0,rowIndex:e})}},{key:"componentDidMount",value:function(){this._setScrollbarWidth()}},{key:"componentDidUpdate",value:function(){this._setScrollbarWidth()}},{key:"render",value:function(){var e=this,t=this.props,n=t.children,o=t.className,i=t.disableHeader,l=t.gridClassName,s=t.gridStyle,a=t.headerHeight,u=t.height,c=t.id,d=t.noRowsRenderer,f=t.rowClassName,h=t.rowStyle,_=t.scrollToIndex,p=t.style,v=t.width,g=this.state.scrollbarWidth,S=i?u:u-a,C=f instanceof Function?f({index:-1}):f,w=h instanceof Function?h({index:-1}):h;return this._cachedColumnStyles=[],y.default.Children.toArray(n).forEach(function(t,n){var o=e._getFlexStyleForColumn(t,t.props.style);e._cachedColumnStyles[n]=(0,r.default)({},o,{overflow:"hidden"})}),y.default.createElement("div",{className:(0,m.default)("ReactVirtualized__Table",o),id:c,style:p},!i&&y.default.createElement("div",{className:(0,m.default)("ReactVirtualized__Table__headerRow",C),style:(0,r.default)({},w,{height:a,overflow:"hidden",paddingRight:g,width:v})},this._getRenderedHeaderRow()),y.default.createElement(b.default,(0,r.default)({},this.props,{autoContainerWidth:!0,className:(0,m.default)("ReactVirtualized__Table__Grid",l),cellRenderer:this._createRow,columnWidth:v,columnCount:1,height:S,id:void 0,noContentRenderer:d,onScroll:this._onScroll,onSectionRendered:this._onSectionRendered,ref:function(t){e.Grid=t},scrollbarWidth:g,scrollToRow:_,style:(0,r.default)({},s,{overflowX:"hidden"})})))}},{key:"shouldComponentUpdate",value:function(e,t){return(0,R.default)(this,e,t)}},{key:"_createColumn",value:function(e){var t=e.column,n=e.columnIndex,o=e.isScrolling,i=e.rowData,r=e.rowIndex,l=t.props,s=l.cellDataGetter,a=l.cellRenderer,u=l.className,c=l.columnData,d=l.dataKey,f=s({columnData:c,dataKey:d,rowData:i}),h=a({cellData:f,columnData:c,dataKey:d,isScrolling:o,rowData:i,rowIndex:r}),_=this._cachedColumnStyles[n],p="string"==typeof h?h:null;return y.default.createElement("div",{key:"Row"+r+"-Col"+n,className:(0,m.default)("ReactVirtualized__Table__rowColumn",u),style:_,title:p},h)}},{key:"_createHeader",value:function(e){var t=e.column,n=e.index,o=this.props,i=o.headerClassName,l=o.headerStyle,s=o.onHeaderClick,a=o.sort,u=o.sortBy,c=o.sortDirection,d=t.props,f=d.dataKey,h=d.disableSort,_=d.headerRenderer,p=d.label,v=d.columnData,g=!h&&a,S=(0,m.default)("ReactVirtualized__Table__headerColumn",i,t.props.headerClassName,{ReactVirtualized__Table__sortableHeaderColumn:g}),C=this._getFlexStyleForColumn(t,l),w=_({columnData:v,dataKey:f,disableSort:h,label:p,sortBy:u,sortDirection:c}),R={};return(g||s)&&!function(){var e=u!==f||c===I.default.DESC?I.default.ASC:I.default.DESC,n=function(){g&&a({sortBy:f,sortDirection:e}),s&&s({columnData:v,dataKey:f})},o=function(e){"Enter"!==e.key&&" "!==e.key||n()};R["aria-label"]=t.props["aria-label"]||p||f,R.role="rowheader",R.tabIndex=0,R.onClick=n,R.onKeyDown=o}(),y.default.createElement("div",(0,r.default)({},R,{key:"Header-Col"+n,className:S,style:C}),w)}},{key:"_createRow",value:function(e){var t=this,n=e.rowIndex,o=e.isScrolling,i=e.key,l=e.style,s=this.props,a=s.children,u=s.onRowClick,c=s.onRowDoubleClick,d=s.onRowMouseOver,f=s.onRowMouseOut,h=s.rowClassName,_=s.rowGetter,p=s.rowRenderer,v=s.rowStyle,g=this.state.scrollbarWidth,S=h instanceof Function?h({index:n}):h,C=v instanceof Function?v({index:n}):v,w=_({index:n}),R=y.default.Children.toArray(a).map(function(e,i){return t._createColumn({column:e,columnIndex:i,isScrolling:o,rowData:w,rowIndex:n,scrollbarWidth:g})}),x=(0,m.default)("ReactVirtualized__Table__row",S),b=(0,r.default)({},l,C,{height:this._getRowHeight(n),overflow:"hidden",paddingRight:g});return p({className:x,columns:R,index:n,isScrolling:o,key:i,onRowClick:u,onRowDoubleClick:c,onRowMouseOver:d,onRowMouseOut:f,rowData:w,style:b})}},{key:"_getFlexStyleForColumn",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.props.flexGrow+" "+e.props.flexShrink+" "+e.props.width+"px",o=(0,r.default)({},t,{flex:n,msFlex:n,WebkitFlex:n});return e.props.maxWidth&&(o.maxWidth=e.props.maxWidth),e.props.minWidth&&(o.minWidth=e.props.minWidth),o}},{key:"_getRenderedHeaderRow",value:function(){var e=this,t=this.props,n=t.children,o=t.disableHeader,i=o?[]:y.default.Children.toArray(n);return i.map(function(t,n){return e._createHeader({column:t,index:n})})}},{key:"_getRowHeight",value:function(e){var t=this.props.rowHeight;return t instanceof Function?t({index:e}):t}},{key:"_onScroll",value:function(e){var t=e.clientHeight,n=e.scrollHeight,o=e.scrollTop,i=this.props.onScroll;i({clientHeight:t,scrollHeight:n,scrollTop:o})}},{key:"_onSectionRendered",value:function(e){var t=e.rowOverscanStartIndex,n=e.rowOverscanStopIndex,o=e.rowStartIndex,i=e.rowStopIndex,r=this.props.onRowsRendered;r({overscanStartIndex:t,overscanStopIndex:n,startIndex:o,stopIndex:i})}},{key:"_setScrollbarWidth",value:function(){var e=(0,C.findDOMNode)(this.Grid),t=e.clientWidth||0,n=e.offsetWidth||0,o=n-t;this.setState({scrollbarWidth:o})}}]),t}(S.Component);O.defaultProps={disableHeader:!1,estimatedRowSize:30,headerHeight:0,headerStyle:{},noRowsRenderer:function(){return null},onRowsRendered:function(){return null},onScroll:function(){return null},overscanRowCount:10,rowRenderer:T.default,rowStyle:{},scrollToAlignment:"auto",style:{}},t.default=O},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(3),r=o(i),l=n(29),s=o(l),a=n(34),u=o(a),c=n(81),d=o(c),f=n(89),h=n(124),_=o(h),p=n(127),v=o(p),m=n(128),g=o(m),S=function(e){function t(){return(0,s.default)(this,t),(0,u.default)(this,(t.__proto__||(0,r.default)(t)).apply(this,arguments))}return(0,d.default)(t,e),t}(f.Component);S.defaultProps={cellDataGetter:g.default,cellRenderer:v.default,flexGrow:0,flexShrink:1,headerRenderer:_.default,style:{}},t.default=S},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function i(e){var t=(e.columnData,e.dataKey),n=(e.disableSort,e.label),o=e.sortBy,i=e.sortDirection,r=o===t,s=[l.default.createElement("span",{className:"ReactVirtualized__Table__headerTruncatedText",key:"label",title:n},n)];return r&&s.push(l.default.createElement(a.default,{key:"SortIndicator",sortDirection:i})),s}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var r=n(89),l=o(r),s=n(125),a=o(s)},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function i(e){var t=e.sortDirection,n=(0,a.default)("ReactVirtualized__Table__sortableHeaderIcon",{"ReactVirtualized__Table__sortableHeaderIcon--ASC":t===c.default.ASC,"ReactVirtualized__Table__sortableHeaderIcon--DESC":t===c.default.DESC});return l.default.createElement("svg",{className:n,width:18,height:18,viewBox:"0 0 24 24"},t===c.default.ASC?l.default.createElement("path",{d:"M7 14l5-5 5 5z"}):l.default.createElement("path",{d:"M7 10l5 5 5-5z"}),l.default.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}))}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var r=n(89),l=o(r),s=n(108),a=o(s),u=n(126),c=o(u)},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={ASC:"ASC",DESC:"DESC"};t.default=n},function(e,t){"use strict";function n(e){var t=e.cellData;return e.cellDataKey,e.columnData,e.rowData,e.rowIndex,null==t?"":String(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n},function(e,t){"use strict";function n(e){var t=(e.columnData,e.dataKey),n=e.rowData;return n.get instanceof Function?n.get(t):n[t]}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.defaultCellRangeRenderer=t.Grid=t.default=void 0;var i=n(130),r=o(i),l=n(136),s=o(l);t.default=r.default,t.Grid=r.default,t.defaultCellRangeRenderer=s.default},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_SCROLLING_RESET_TIME_INTERVAL=void 0;var i=n(101),r=o(i),l=n(3),s=o(l),a=n(29),u=o(a),c=n(30),d=o(c),f=n(34),h=o(f),_=n(81),p=o(_),v=n(89),m=o(v),g=n(108),S=o(g),y=n(131),C=o(y),w=n(132),R=o(w),x=n(109),b=o(x),z=n(134),T=o(z),M=n(113),I=o(M),O=n(90),k=o(O),P=n(135),L=o(P),A=n(136),E=o(A),G=t.DEFAULT_SCROLLING_RESET_TIME_INTERVAL=150,W={OBSERVED:"observed",REQUESTED:"requested"},H=function(e){function t(e,n){(0,u.default)(this,t);var o=(0,h.default)(this,(t.__proto__||(0,s.default)(t)).call(this,e,n));return o.state={isScrolling:!1,scrollDirectionHorizontal:z.SCROLL_DIRECTION_FORWARD,scrollDirectionVertical:z.SCROLL_DIRECTION_FORWARD,scrollLeft:0,scrollTop:0},o._onGridRenderedMemoizer=(0,b.default)(),o._onScrollMemoizer=(0,b.default)(!1),o._debounceScrollEndedCallback=o._debounceScrollEndedCallback.bind(o),o._invokeOnGridRenderedHelper=o._invokeOnGridRenderedHelper.bind(o),o._onScroll=o._onScroll.bind(o),o._updateScrollLeftForScrollToColumn=o._updateScrollLeftForScrollToColumn.bind(o),o._updateScrollTopForScrollToRow=o._updateScrollTopForScrollToRow.bind(o),o._columnWidthGetter=o._wrapSizeGetter(e.columnWidth),o._rowHeightGetter=o._wrapSizeGetter(e.rowHeight),o._columnSizeAndPositionManager=new R.default({cellCount:e.columnCount,cellSizeGetter:function(e){return o._columnWidthGetter(e)},estimatedCellSize:o._getEstimatedColumnSize(e)}),o._rowSizeAndPositionManager=new R.default({cellCount:e.rowCount,cellSizeGetter:function(e){return o._rowHeightGetter(e)},estimatedCellSize:o._getEstimatedRowSize(e)}),o._cellCache={},o._styleCache={},o}return(0,p.default)(t,e),(0,d.default)(t,[{key:"measureAllCells",value:function(){var e=this.props,t=e.columnCount,n=e.rowCount;this._columnSizeAndPositionManager.getSizeAndPositionOfCell(t-1),
this._rowSizeAndPositionManager.getSizeAndPositionOfCell(n-1)}},{key:"recomputeGridSize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.columnIndex,n=void 0===t?0:t,o=e.rowIndex,i=void 0===o?0:o;this._columnSizeAndPositionManager.resetCell(n),this._rowSizeAndPositionManager.resetCell(i),this._cellCache={},this._styleCache={},this.forceUpdate()}},{key:"scrollToCell",value:function(e){var t=e.columnIndex,n=e.rowIndex,o=this.props;this._updateScrollLeftForScrollToColumn((0,r.default)({},o,{scrollToColumn:t})),this._updateScrollTopForScrollToRow((0,r.default)({},o,{scrollToRow:n}))}},{key:"componentDidMount",value:function(){var e=this.props,t=e.scrollLeft,n=e.scrollToColumn,o=e.scrollTop,i=e.scrollToRow;this._scrollbarSizeMeasured||(this._scrollbarSize=(0,I.default)(),this._scrollbarSizeMeasured=!0,this.setState({})),(t>=0||o>=0)&&this._setScrollPosition({scrollLeft:t,scrollTop:o}),(n>=0||i>=0)&&(this._updateScrollLeftForScrollToColumn(),this._updateScrollTopForScrollToRow()),this._invokeOnGridRenderedHelper(),this._invokeOnScrollMemoizer({scrollLeft:t||0,scrollTop:o||0,totalColumnsWidth:this._columnSizeAndPositionManager.getTotalSize(),totalRowsHeight:this._rowSizeAndPositionManager.getTotalSize()})}},{key:"componentDidUpdate",value:function(e,t){var n=this,o=this.props,i=o.autoHeight,l=o.columnCount,s=o.height,a=o.rowCount,u=o.scrollToAlignment,c=o.scrollToColumn,d=o.scrollToRow,f=o.width,h=this.state,_=h.scrollLeft,p=h.scrollPositionChangeReason,v=h.scrollTop,m=l>0&&0===e.columnCount||a>0&&0===e.rowCount;if(p===W.REQUESTED&&(_>=0&&(_!==t.scrollLeft&&_!==this._scrollingContainer.scrollLeft||m)&&(this._scrollingContainer.scrollLeft=_),!i&&v>=0&&(v!==t.scrollTop&&v!==this._scrollingContainer.scrollTop||m)&&(this._scrollingContainer.scrollTop=v)),(0,L.default)({cellSizeAndPositionManager:this._columnSizeAndPositionManager,previousCellsCount:e.columnCount,previousCellSize:e.columnWidth,previousScrollToAlignment:e.scrollToAlignment,previousScrollToIndex:e.scrollToColumn,previousSize:e.width,scrollOffset:_,scrollToAlignment:u,scrollToIndex:c,size:f,updateScrollIndexCallback:function(e){return n._updateScrollLeftForScrollToColumn((0,r.default)({},n.props,{scrollToColumn:e}))}}),(0,L.default)({cellSizeAndPositionManager:this._rowSizeAndPositionManager,previousCellsCount:e.rowCount,previousCellSize:e.rowHeight,previousScrollToAlignment:e.scrollToAlignment,previousScrollToIndex:e.scrollToRow,previousSize:e.height,scrollOffset:v,scrollToAlignment:u,scrollToIndex:d,size:s,updateScrollIndexCallback:function(e){return n._updateScrollTopForScrollToRow((0,r.default)({},n.props,{scrollToRow:e}))}}),this._invokeOnGridRenderedHelper(),_!==t.scrollLeft||v!==t.scrollTop){var g=this._rowSizeAndPositionManager.getTotalSize(),S=this._columnSizeAndPositionManager.getTotalSize();this._invokeOnScrollMemoizer({scrollLeft:_,scrollTop:v,totalColumnsWidth:S,totalRowsHeight:g})}}},{key:"componentWillMount",value:function(){this._scrollbarSize=(0,I.default)(),void 0===this._scrollbarSize?(this._scrollbarSizeMeasured=!1,this._scrollbarSize=0):this._scrollbarSizeMeasured=!0,this._calculateChildrenToRender()}},{key:"componentWillUnmount",value:function(){this._disablePointerEventsTimeoutId&&clearTimeout(this._disablePointerEventsTimeoutId)}},{key:"componentWillUpdate",value:function(e,t){var n=this;if(0===e.columnCount&&0!==t.scrollLeft||0===e.rowCount&&0!==t.scrollTop)this._setScrollPosition({scrollLeft:0,scrollTop:0});else if(e.scrollLeft!==this.props.scrollLeft||e.scrollTop!==this.props.scrollTop){var o={};null!=e.scrollLeft&&(o.scrollLeft=e.scrollLeft),null!=e.scrollTop&&(o.scrollTop=e.scrollTop),this._setScrollPosition(o)}e.columnWidth===this.props.columnWidth&&e.rowHeight===this.props.rowHeight||(this._styleCache={}),this._columnWidthGetter=this._wrapSizeGetter(e.columnWidth),this._rowHeightGetter=this._wrapSizeGetter(e.rowHeight),this._columnSizeAndPositionManager.configure({cellCount:e.columnCount,estimatedCellSize:this._getEstimatedColumnSize(e)}),this._rowSizeAndPositionManager.configure({cellCount:e.rowCount,estimatedCellSize:this._getEstimatedRowSize(e)}),(0,C.default)({cellCount:this.props.columnCount,cellSize:this.props.columnWidth,computeMetadataCallback:function(){return n._columnSizeAndPositionManager.resetCell(0)},computeMetadataCallbackProps:e,nextCellsCount:e.columnCount,nextCellSize:e.columnWidth,nextScrollToIndex:e.scrollToColumn,scrollToIndex:this.props.scrollToColumn,updateScrollOffsetForScrollToIndex:function(){return n._updateScrollLeftForScrollToColumn(e,t)}}),(0,C.default)({cellCount:this.props.rowCount,cellSize:this.props.rowHeight,computeMetadataCallback:function(){return n._rowSizeAndPositionManager.resetCell(0)},computeMetadataCallbackProps:e,nextCellsCount:e.rowCount,nextCellSize:e.rowHeight,nextScrollToIndex:e.scrollToRow,scrollToIndex:this.props.scrollToRow,updateScrollOffsetForScrollToIndex:function(){return n._updateScrollTopForScrollToRow(e,t)}}),this._calculateChildrenToRender(e,t)}},{key:"render",value:function(){var e=this,t=this.props,n=t.autoContainerWidth,o=t.autoHeight,i=t.className,l=t.containerStyle,s=t.height,a=t.id,u=t.noContentRenderer,c=t.style,d=t.tabIndex,f=t.width,h=this.state.isScrolling,_={boxSizing:"border-box",direction:"ltr",height:o?"auto":s,position:"relative",width:f,WebkitOverflowScrolling:"touch",willChange:"transform"},p=this._columnSizeAndPositionManager.getTotalSize(),v=this._rowSizeAndPositionManager.getTotalSize(),g=v>s?this._scrollbarSize:0,y=p>f?this._scrollbarSize:0;_.overflowX=p+g<=f?"hidden":"auto",_.overflowY=v+y<=s?"hidden":"auto";var C=this._childrenToDisplay,w=0===C.length&&s>0&&f>0;return m.default.createElement("div",{ref:function(t){e._scrollingContainer=t},"aria-label":this.props["aria-label"],className:(0,S.default)("ReactVirtualized__Grid",i),id:a,onScroll:this._onScroll,role:"grid",style:(0,r.default)({},_,c),tabIndex:d},C.length>0&&m.default.createElement("div",{className:"ReactVirtualized__Grid__innerScrollContainer",style:(0,r.default)({width:n?"auto":p,height:v,maxWidth:p,maxHeight:v,overflow:"hidden",pointerEvents:h?"none":""},l)},C),w&&u())}},{key:"shouldComponentUpdate",value:function(e,t){return(0,k.default)(this,e,t)}},{key:"_calculateChildrenToRender",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.state,n=e.cellRenderer,o=e.cellRangeRenderer,i=e.columnCount,r=e.height,l=e.overscanColumnCount,s=e.overscanRowCount,a=e.rowCount,u=e.width,c=t.isScrolling,d=t.scrollDirectionHorizontal,f=t.scrollDirectionVertical,h=t.scrollLeft,_=t.scrollTop;if(this._childrenToDisplay=[],r>0&&u>0){var p=this._columnSizeAndPositionManager.getVisibleCellRange({containerSize:u,offset:h}),v=this._rowSizeAndPositionManager.getVisibleCellRange({containerSize:r,offset:_}),m=this._columnSizeAndPositionManager.getOffsetAdjustment({containerSize:u,offset:h}),g=this._rowSizeAndPositionManager.getOffsetAdjustment({containerSize:r,offset:_});this._renderedColumnStartIndex=p.start,this._renderedColumnStopIndex=p.stop,this._renderedRowStartIndex=v.start,this._renderedRowStopIndex=v.stop;var S=(0,T.default)({cellCount:i,overscanCellsCount:l,scrollDirection:d,startIndex:this._renderedColumnStartIndex,stopIndex:this._renderedColumnStopIndex}),y=(0,T.default)({cellCount:a,overscanCellsCount:s,scrollDirection:f,startIndex:this._renderedRowStartIndex,stopIndex:this._renderedRowStopIndex});this._columnStartIndex=S.overscanStartIndex,this._columnStopIndex=S.overscanStopIndex,this._rowStartIndex=y.overscanStartIndex,this._rowStopIndex=y.overscanStopIndex,this._childrenToDisplay=o({cellCache:this._cellCache,cellRenderer:n,columnSizeAndPositionManager:this._columnSizeAndPositionManager,columnStartIndex:this._columnStartIndex,columnStopIndex:this._columnStopIndex,horizontalOffsetAdjustment:m,isScrolling:c,rowSizeAndPositionManager:this._rowSizeAndPositionManager,rowStartIndex:this._rowStartIndex,rowStopIndex:this._rowStopIndex,scrollLeft:h,scrollTop:_,styleCache:this._styleCache,verticalOffsetAdjustment:g,visibleColumnIndices:p,visibleRowIndices:v})}}},{key:"_debounceScrollEnded",value:function(){var e=this.props.scrollingResetTimeInterval;this._disablePointerEventsTimeoutId&&clearTimeout(this._disablePointerEventsTimeoutId),this._disablePointerEventsTimeoutId=setTimeout(this._debounceScrollEndedCallback,e)}},{key:"_debounceScrollEndedCallback",value:function(){this._disablePointerEventsTimeoutId=null;var e=this._styleCache;this._cellCache={},this._styleCache={};for(var t=this._rowStartIndex;t<=this._rowStopIndex;t++)for(var n=this._columnStartIndex;n<=this._columnStopIndex;n++){var o=t+"-"+n;this._styleCache[o]=e[o]}this.setState({isScrolling:!1})}},{key:"_getEstimatedColumnSize",value:function(e){return"number"==typeof e.columnWidth?e.columnWidth:e.estimatedColumnSize}},{key:"_getEstimatedRowSize",value:function(e){return"number"==typeof e.rowHeight?e.rowHeight:e.estimatedRowSize}},{key:"_invokeOnGridRenderedHelper",value:function(){var e=this.props.onSectionRendered;this._onGridRenderedMemoizer({callback:e,indices:{columnOverscanStartIndex:this._columnStartIndex,columnOverscanStopIndex:this._columnStopIndex,columnStartIndex:this._renderedColumnStartIndex,columnStopIndex:this._renderedColumnStopIndex,rowOverscanStartIndex:this._rowStartIndex,rowOverscanStopIndex:this._rowStopIndex,rowStartIndex:this._renderedRowStartIndex,rowStopIndex:this._renderedRowStopIndex}})}},{key:"_invokeOnScrollMemoizer",value:function(e){var t=this,n=e.scrollLeft,o=e.scrollTop,i=e.totalColumnsWidth,r=e.totalRowsHeight;this._onScrollMemoizer({callback:function(e){var n=e.scrollLeft,o=e.scrollTop,l=t.props,s=l.height,a=l.onScroll,u=l.width;a({clientHeight:s,clientWidth:u,scrollHeight:r,scrollLeft:n,scrollTop:o,scrollWidth:i})},indices:{scrollLeft:n,scrollTop:o}})}},{key:"_setScrollPosition",value:function(e){var t=e.scrollLeft,n=e.scrollTop,o={scrollPositionChangeReason:W.REQUESTED};t>=0&&(o.scrollDirectionHorizontal=t>this.state.scrollLeft?z.SCROLL_DIRECTION_FORWARD:z.SCROLL_DIRECTION_BACKWARD,o.scrollLeft=t),n>=0&&(o.scrollDirectionVertical=n>this.state.scrollTop?z.SCROLL_DIRECTION_FORWARD:z.SCROLL_DIRECTION_BACKWARD,o.scrollTop=n),(t>=0&&t!==this.state.scrollLeft||n>=0&&n!==this.state.scrollTop)&&this.setState(o)}},{key:"_wrapPropertyGetter",value:function(e){return e instanceof Function?e:function(){return e}}},{key:"_wrapSizeGetter",value:function(e){return this._wrapPropertyGetter(e)}},{key:"_updateScrollLeftForScrollToColumn",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.state,n=e.columnCount,o=e.scrollToAlignment,i=e.scrollToColumn,r=e.width,l=t.scrollLeft;if(i>=0&&n>0){var s=Math.max(0,Math.min(n-1,i)),a=this._columnSizeAndPositionManager.getUpdatedOffsetForIndex({align:o,containerSize:r,currentOffset:l,targetIndex:s});l!==a&&this._setScrollPosition({scrollLeft:a})}}},{key:"_updateScrollTopForScrollToRow",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.state,n=e.height,o=e.rowCount,i=e.scrollToAlignment,r=e.scrollToRow,l=t.scrollTop;if(r>=0&&o>0){var s=Math.max(0,Math.min(o-1,r)),a=this._rowSizeAndPositionManager.getUpdatedOffsetForIndex({align:i,containerSize:n,currentOffset:l,targetIndex:s});l!==a&&this._setScrollPosition({scrollTop:a})}}},{key:"_onScroll",value:function(e){if(e.target===this._scrollingContainer){this._debounceScrollEnded();var t=this.props,n=t.autoHeight,o=t.height,i=t.width,r=this._scrollbarSize,l=this._rowSizeAndPositionManager.getTotalSize(),s=this._columnSizeAndPositionManager.getTotalSize(),a=Math.min(Math.max(0,s-i+r),e.target.scrollLeft),u=Math.min(Math.max(0,l-o+r),e.target.scrollTop);if(this.state.scrollLeft!==a||this.state.scrollTop!==u){var c=a>this.state.scrollLeft?z.SCROLL_DIRECTION_FORWARD:z.SCROLL_DIRECTION_BACKWARD,d=u>this.state.scrollTop?z.SCROLL_DIRECTION_FORWARD:z.SCROLL_DIRECTION_BACKWARD,f={isScrolling:!0,scrollDirectionHorizontal:c,scrollDirectionVertical:d,scrollLeft:a,scrollPositionChangeReason:W.OBSERVED};n||(f.scrollTop=u),this.setState(f)}this._invokeOnScrollMemoizer({scrollLeft:a,scrollTop:u,totalColumnsWidth:s,totalRowsHeight:l})}}}]),t}(v.Component);H.defaultProps={"aria-label":"grid",cellRangeRenderer:E.default,estimatedColumnSize:100,estimatedRowSize:30,noContentRenderer:function(){return null},onScroll:function(){return null},onSectionRendered:function(){return null},overscanColumnCount:0,overscanRowCount:10,scrollingResetTimeInterval:G,scrollToAlignment:"auto",style:{},tabIndex:0},t.default=H},function(e,t){"use strict";function n(e){var t=e.cellCount,n=e.cellSize,o=e.computeMetadataCallback,i=e.computeMetadataCallbackProps,r=e.nextCellsCount,l=e.nextCellSize,s=e.nextScrollToIndex,a=e.scrollToIndex,u=e.updateScrollOffsetForScrollToIndex;t===r&&("number"!=typeof n&&"number"!=typeof l||n===l)||(o(i),a>=0&&a===s&&u())}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_MAX_SCROLL_SIZE=void 0;var i=n(106),r=o(i),l=n(29),s=o(l),a=n(30),u=o(a),c=n(133),d=o(c),f=t.DEFAULT_MAX_SCROLL_SIZE=15e5,h=function(){function e(t){var n=t.maxScrollSize,o=void 0===n?f:n,i=(0,r.default)(t,["maxScrollSize"]);(0,s.default)(this,e),this._cellSizeAndPositionManager=new d.default(i),this._maxScrollSize=o}return(0,u.default)(e,[{key:"configure",value:function(e){this._cellSizeAndPositionManager.configure(e)}},{key:"getCellCount",value:function(){return this._cellSizeAndPositionManager.getCellCount()}},{key:"getEstimatedCellSize",value:function(){return this._cellSizeAndPositionManager.getEstimatedCellSize()}},{key:"getLastMeasuredIndex",value:function(){return this._cellSizeAndPositionManager.getLastMeasuredIndex()}},{key:"getOffsetAdjustment",value:function(e){var t=e.containerSize,n=e.offset,o=this._cellSizeAndPositionManager.getTotalSize(),i=this.getTotalSize(),r=this._getOffsetPercentage({containerSize:t,offset:n,totalSize:i});return Math.round(r*(i-o))}},{key:"getSizeAndPositionOfCell",value:function(e){return this._cellSizeAndPositionManager.getSizeAndPositionOfCell(e)}},{key:"getSizeAndPositionOfLastMeasuredCell",value:function(){return this._cellSizeAndPositionManager.getSizeAndPositionOfLastMeasuredCell()}},{key:"getTotalSize",value:function(){return Math.min(this._maxScrollSize,this._cellSizeAndPositionManager.getTotalSize())}},{key:"getUpdatedOffsetForIndex",value:function(e){var t=e.align,n=void 0===t?"auto":t,o=e.containerSize,i=e.currentOffset,r=e.targetIndex,l=e.totalSize;i=this._safeOffsetToOffset({containerSize:o,offset:i});var s=this._cellSizeAndPositionManager.getUpdatedOffsetForIndex({align:n,containerSize:o,currentOffset:i,targetIndex:r,totalSize:l});return this._offsetToSafeOffset({containerSize:o,offset:s})}},{key:"getVisibleCellRange",value:function(e){var t=e.containerSize,n=e.offset;return n=this._safeOffsetToOffset({containerSize:t,offset:n}),this._cellSizeAndPositionManager.getVisibleCellRange({containerSize:t,offset:n})}},{key:"resetCell",value:function(e){this._cellSizeAndPositionManager.resetCell(e)}},{key:"_getOffsetPercentage",value:function(e){var t=e.containerSize,n=e.offset,o=e.totalSize;return o<=t?0:n/(o-t)}},{key:"_offsetToSafeOffset",value:function(e){var t=e.containerSize,n=e.offset,o=this._cellSizeAndPositionManager.getTotalSize(),i=this.getTotalSize();if(o===i)return n;var r=this._getOffsetPercentage({containerSize:t,offset:n,totalSize:o});return Math.round(r*(i-t))}},{key:"_safeOffsetToOffset",value:function(e){var t=e.containerSize,n=e.offset,o=this._cellSizeAndPositionManager.getTotalSize(),i=this.getTotalSize();if(o===i)return n;var r=this._getOffsetPercentage({containerSize:t,offset:n,totalSize:i});return Math.round(r*(o-t))}}]),e}();t.default=h},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(29),r=o(i),l=n(30),s=o(l),a=function(){function e(t){var n=t.cellCount,o=t.cellSizeGetter,i=t.estimatedCellSize;(0,r.default)(this,e),this._cellSizeGetter=o,this._cellCount=n,this._estimatedCellSize=i,this._cellSizeAndPositionData={},this._lastMeasuredIndex=-1}return(0,s.default)(e,[{key:"configure",value:function(e){var t=e.cellCount,n=e.estimatedCellSize;this._cellCount=t,this._estimatedCellSize=n}},{key:"getCellCount",value:function(){return this._cellCount}},{key:"getEstimatedCellSize",value:function(){return this._estimatedCellSize}},{key:"getLastMeasuredIndex",value:function(){return this._lastMeasuredIndex}},{key:"getSizeAndPositionOfCell",value:function(e){if(e<0||e>=this._cellCount)throw Error("Requested index "+e+" is outside of range 0.."+this._cellCount);if(e>this._lastMeasuredIndex){for(var t=this.getSizeAndPositionOfLastMeasuredCell(),n=t.offset+t.size,o=this._lastMeasuredIndex+1;o<=e;o++){var i=this._cellSizeGetter({index:o});if(null==i||isNaN(i))throw Error("Invalid size returned for cell "+o+" of value "+i);this._cellSizeAndPositionData[o]={offset:n,size:i},n+=i}this._lastMeasuredIndex=e}return this._cellSizeAndPositionData[e]}},{key:"getSizeAndPositionOfLastMeasuredCell",value:function(){return this._lastMeasuredIndex>=0?this._cellSizeAndPositionData[this._lastMeasuredIndex]:{offset:0,size:0}}},{key:"getTotalSize",value:function(){var e=this.getSizeAndPositionOfLastMeasuredCell();return e.offset+e.size+(this._cellCount-this._lastMeasuredIndex-1)*this._estimatedCellSize}},{key:"getUpdatedOffsetForIndex",value:function(e){var t=e.align,n=void 0===t?"auto":t,o=e.containerSize,i=e.currentOffset,r=e.targetIndex;if(o<=0)return 0;var l=this.getSizeAndPositionOfCell(r),s=l.offset,a=s-o+l.size,u=void 0;switch(n){case"start":u=s;break;case"end":u=a;break;case"center":u=s-(o-l.size)/2;break;default:u=Math.max(a,Math.min(s,i))}var c=this.getTotalSize();return Math.max(0,Math.min(c-o,u))}},{key:"getVisibleCellRange",value:function(e){var t=e.containerSize,n=e.offset,o=this.getTotalSize();if(0===o)return{};var i=n+t,r=this._findNearestCell(n),l=this.getSizeAndPositionOfCell(r);n=l.offset+l.size;for(var s=r;n<i&&s<this._cellCount-1;)s++,n+=this.getSizeAndPositionOfCell(s).size;return{start:r,stop:s}}},{key:"resetCell",value:function(e){this._lastMeasuredIndex=Math.min(this._lastMeasuredIndex,e-1)}},{key:"_binarySearch",value:function(e){for(var t=e.high,n=e.low,o=e.offset,i=void 0,r=void 0;n<=t;){if(i=n+Math.floor((t-n)/2),r=this.getSizeAndPositionOfCell(i).offset,r===o)return i;r<o?n=i+1:r>o&&(t=i-1)}if(n>0)return n-1}},{key:"_exponentialSearch",value:function(e){for(var t=e.index,n=e.offset,o=1;t<this._cellCount&&this.getSizeAndPositionOfCell(t).offset<n;)t+=o,o*=2;return this._binarySearch({high:Math.min(t,this._cellCount-1),low:Math.floor(t/2),offset:n})}},{key:"_findNearestCell",value:function(e){if(isNaN(e))throw Error("Invalid offset "+e+" specified");e=Math.max(0,e);var t=this.getSizeAndPositionOfLastMeasuredCell(),n=Math.max(0,this._lastMeasuredIndex);return t.offset>=e?this._binarySearch({high:n,low:0,offset:e}):this._exponentialSearch({index:n,offset:e})}}]),e}();t.default=a},function(e,t){"use strict";function n(e){var t=e.cellCount,n=e.overscanCellsCount,r=e.scrollDirection,l=e.startIndex,s=e.stopIndex,a=void 0,u=void 0;switch(r){case i:a=l,u=s+n;break;case o:a=l-n,u=s}return{overscanStartIndex:Math.max(0,a),overscanStopIndex:Math.min(t-1,u)}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n;var o=t.SCROLL_DIRECTION_BACKWARD=-1,i=t.SCROLL_DIRECTION_FORWARD=1},function(e,t){"use strict";function n(e){var t=e.cellSize,n=e.cellSizeAndPositionManager,o=e.previousCellsCount,i=e.previousCellSize,r=e.previousScrollToAlignment,l=e.previousScrollToIndex,s=e.previousSize,a=e.scrollOffset,u=e.scrollToAlignment,c=e.scrollToIndex,d=e.size,f=e.updateScrollIndexCallback,h=n.getCellCount(),_=c>=0&&c<h,p=d!==s||!i||"number"==typeof t&&t!==i;_&&(p||u!==r||c!==l)?f(c):!_&&h>0&&(d<s||h<o)&&a>n.getTotalSize()-d&&f(h-1)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n},function(e,t){"use strict";function n(e){for(var t=e.cellCache,n=e.cellRenderer,o=e.columnSizeAndPositionManager,i=e.columnStartIndex,r=e.columnStopIndex,l=e.horizontalOffsetAdjustment,s=e.isScrolling,a=e.rowSizeAndPositionManager,u=e.rowStartIndex,c=e.rowStopIndex,d=(e.scrollLeft,e.scrollTop,e.styleCache),f=e.verticalOffsetAdjustment,h=e.visibleColumnIndices,_=e.visibleRowIndices,p=[],v=f||l,m=!s||!v,g=u;g<=c;g++)for(var S=a.getSizeAndPositionOfCell(g),y=i;y<=r;y++){var C=o.getSizeAndPositionOfCell(y),w=y>=h.start&&y<=h.stop&&g>=_.start&&g<=_.stop,R=g+"-"+y,x=void 0;m&&d[R]?x=d[R]:(x={height:S.size,left:C.offset+l,position:"absolute",top:S.offset+f,width:C.size},d[R]=x);var b={columnIndex:y,isScrolling:s,isVisible:w,key:R,rowIndex:g,style:x},z=void 0;!s||l||f?z=n(b):(t[R]||(t[R]=n(b)),z=t[R]),null!=z&&z!==!1&&p.push(z)}return p}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function i(e){var t=e.className,n=e.columns,o=e.index,i=(e.isScrolling,e.key),r=e.onRowClick,s=e.onRowDoubleClick,u=e.onRowMouseOver,c=e.onRowMouseOut,d=e.rowData,f=e.style,h={};return(r||s||u||c)&&(h["aria-label"]="row",h.role="row",h.tabIndex=0,r&&(h.onClick=function(){return r({index:o,rowData:d})}),s&&(h.onDoubleClick=function(){return s({index:o,rowData:d})}),c&&(h.onMouseOut=function(){return c({index:o,rowData:d})}),u&&(h.onMouseOver=function(){return u({index:o,rowData:d})})),a.default.createElement("div",(0,l.default)({},h,{className:t,key:i,style:f}),n)}Object.defineProperty(t,"__esModule",{value:!0});var r=n(101),l=o(r);t.default=i;var s=n(89),a=o(s)},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.InfiniteLoader=t.default=void 0;var i=n(139),r=o(i);t.default=r.default,t.InfiniteLoader=r.default},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function i(e){var t=e.lastRenderedStartIndex,n=e.lastRenderedStopIndex,o=e.startIndex,i=e.stopIndex;return!(o>n||i<t)}function r(e){for(var t=e.isRowLoaded,n=e.minimumBatchSize,o=e.rowCount,i=e.startIndex,r=e.stopIndex,l=[],s=null,a=null,u=i;u<=r;u++){var c=t({index:u});c?null!==a&&(l.push({startIndex:s,stopIndex:a}),s=a=null):(a=u,null===s&&(s=u))}if(null!==a){for(var d=Math.min(Math.max(a,s+n-1),o-1),f=a+1;f<=d&&!t({index:f});f++)a=f;l.push({startIndex:s,stopIndex:a})}if(l.length)for(var h=l[0];h.stopIndex-h.startIndex+1<n&&h.startIndex>0;){var _=h.startIndex-1;if(t({index:_}))break;h.startIndex=_}return l}function l(e){var t="function"==typeof e.recomputeGridSize?e.recomputeGridSize:e.recomputeRowHeights;t?t.call(e):e.forceUpdate()}Object.defineProperty(t,"__esModule",{value:!0});var s=n(3),a=o(s),u=n(29),c=o(u),d=n(30),f=o(d),h=n(34),_=o(h),p=n(81),v=o(p);t.isRangeVisible=i,t.scanForUnloadedRanges=r,t.forceUpdateReactVirtualizedComponent=l;var m=n(89),g=n(90),S=o(g),y=n(109),C=o(y),w=function(e){function t(e,n){(0,c.default)(this,t);var o=(0,_.default)(this,(t.__proto__||(0,a.default)(t)).call(this,e,n));return o._loadMoreRowsMemoizer=(0,C.default)(),o._onRowsRendered=o._onRowsRendered.bind(o),o._registerChild=o._registerChild.bind(o),o}return(0,v.default)(t,e),(0,f.default)(t,[{key:"render",value:function(){var e=this.props.children;return e({onRowsRendered:this._onRowsRendered,registerChild:this._registerChild})}},{key:"shouldComponentUpdate",value:function(e,t){return(0,S.default)(this,e,t)}},{key:"_loadUnloadedRanges",value:function(e){var t=this,n=this.props.loadMoreRows;e.forEach(function(e){var o=n(e);o&&o.then(function(){i({lastRenderedStartIndex:t._lastRenderedStartIndex,lastRenderedStopIndex:t._lastRenderedStopIndex,startIndex:e.startIndex,stopIndex:e.stopIndex})&&t._registeredChild&&l(t._registeredChild)})})}},{key:"_onRowsRendered",value:function(e){var t=this,n=e.startIndex,o=e.stopIndex,i=this.props,l=i.isRowLoaded,s=i.minimumBatchSize,a=i.rowCount,u=i.threshold;this._lastRenderedStartIndex=n,this._lastRenderedStopIndex=o;var c=r({isRowLoaded:l,minimumBatchSize:s,rowCount:a,startIndex:Math.max(0,n-u),stopIndex:Math.min(a-1,o+u)}),d=c.reduce(function(e,t){return e.concat([t.startIndex,t.stopIndex])},[]);this._loadMoreRowsMemoizer({callback:function(){t._loadUnloadedRanges(c)},indices:{squashedUnloadedRanges:d}})}},{key:"_registerChild",value:function(e){this._registeredChild=e}}]),t}(m.Component);w.defaultProps={minimumBatchSize:10,rowCount:0,threshold:15},t.default=w},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.List=t.default=void 0;var i=n(141),r=o(i);t.default=r.default,t.List=r.default},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(142),r=o(i),l=n(106),s=o(l),a=n(101),u=o(a),c=n(3),d=o(c),f=n(29),h=o(f),_=n(30),p=o(_),v=n(34),m=o(v),g=n(81),S=o(g),y=n(129),C=o(y),w=n(89),R=o(w),x=n(108),b=o(x),z=n(90),T=o(z),M=function(e){function t(e,n){(0,h.default)(this,t);var o=(0,m.default)(this,(t.__proto__||(0,d.default)(t)).call(this,e,n));return o._cellRenderer=o._cellRenderer.bind(o),o._onScroll=o._onScroll.bind(o),o._onSectionRendered=o._onSectionRendered.bind(o),o}return(0,S.default)(t,e),(0,p.default)(t,[{key:"forceUpdateGrid",value:function(){this.Grid.forceUpdate()}},{key:"measureAllRows",value:function(){this.Grid.measureAllCells()}},{key:"recomputeRowHeights",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.Grid.recomputeGridSize({rowIndex:e})}},{key:"scrollToRow",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.Grid.scrollToCell({columnIndex:0,rowIndex:e})}},{key:"render",value:function(){var e=this,t=this.props,n=t.className,o=t.noRowsRenderer,i=t.scrollToIndex,r=t.width,l=(0,b.default)("ReactVirtualized__List",n);return R.default.createElement(C.default,(0,u.default)({},this.props,{autoContainerWidth:!0,cellRenderer:this._cellRenderer,className:l,columnWidth:r,columnCount:1,noContentRenderer:o,onScroll:this._onScroll,onSectionRendered:this._onSectionRendered,ref:function(t){e.Grid=t},scrollToRow:i}))}},{key:"shouldComponentUpdate",value:function(e,t){return(0,T.default)(this,e,t)}},{key:"_cellRenderer",value:function(e){var t=e.rowIndex,n=e.style,o=(0,s.default)(e,["rowIndex","style"]),i=this.props.rowRenderer,l=(0,r.default)(n,"width"),a=l.writable;return a&&(n.width="100%"),i((0,u.default)({index:t,style:n},o))}},{key:"_onScroll",value:function(e){var t=e.clientHeight,n=e.scrollHeight,o=e.scrollTop,i=this.props.onScroll;i({clientHeight:t,scrollHeight:n,scrollTop:o})}},{key:"_onSectionRendered",value:function(e){var t=e.rowOverscanStartIndex,n=e.rowOverscanStopIndex,o=e.rowStartIndex,i=e.rowStopIndex,r=this.props.onRowsRendered;r({overscanStartIndex:t,overscanStopIndex:n,startIndex:o,stopIndex:i})}}]),t}(w.Component);M.defaultProps={estimatedRowSize:30,noRowsRenderer:function(){return null},onRowsRendered:function(){return null},onScroll:function(){return null},overscanRowCount:10,scrollToAlignment:"auto",style:{}},t.default=M},function(e,t,n){e.exports={default:n(143),__esModule:!0}},function(e,t,n){n(144);var o=n(16).Object;e.exports=function(e,t){return o.getOwnPropertyDescriptor(e,t)}},function(e,t,n){var o=n(50),i=n(77).f;n(14)("getOwnPropertyDescriptor",function(){return function(e,t){return i(o(e),t)}})},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.MultiGrid=t.default=void 0;var i=n(146),r=o(i);t.default=r.default,t.MultiGrid=r.default},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(101),r=o(i),l=n(106),s=o(l),a=n(3),u=o(a),c=n(29),d=o(c),f=n(30),h=o(f),_=n(34),p=o(_),v=n(81),m=o(v),g=n(89),S=o(g),y=n(90),C=o(y),w=n(129),R=o(w),x=function(e){function t(e,n){(0,d.default)(this,t);var o=(0,p.default)(this,(t.__proto__||(0,u.default)(t)).call(this,e,n));return o.state={scrollLeft:0,scrollTop:0},o._bottomLeftGridRef=o._bottomLeftGridRef.bind(o),o._bottomRightGridRef=o._bottomRightGridRef.bind(o),o._cellRendererBottomLeftGrid=o._cellRendererBottomLeftGrid.bind(o),o._cellRendererBottomRightGrid=o._cellRendererBottomRightGrid.bind(o),o._cellRendererTopRightGrid=o._cellRendererTopRightGrid.bind(o),o._columnWidthRightGrid=o._columnWidthRightGrid.bind(o),o._onScroll=o._onScroll.bind(o),o._rowHeightBottomGrid=o._rowHeightBottomGrid.bind(o),o._topLeftGridRef=o._topLeftGridRef.bind(o),o._topRightGridRef=o._topRightGridRef.bind(o),o}return(0,m.default)(t,e),(0,h.default)(t,[{key:"measureAllCells",value:function(){this._bottomLeftGrid&&this._bottomLeftGrid.measureAllCells(),this._bottomRightGrid&&this._bottomRightGrid.measureAllCells(),this._topLeftGrid&&this._topLeftGrid.measureAllCells(),this._topRightGrid&&this._topRightGrid.measureAllCells()}},{key:"measureAllRows",value:function(){console.warn("MultiGrid measureAllRows() is deprecated; use measureAllCells() instead."),this.measureAllCells()}},{key:"recomputeGridSize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.columnIndex,n=void 0===t?0:t,o=e.rowIndex,i=void 0===o?0:o,r=this.props,l=r.fixedColumnCount,s=r.fixedRowCount,a=Math.max(0,n-l),u=Math.max(0,i-s);this._bottomLeftGrid&&this._bottomLeftGrid.recomputeGridSize({columnIndex:n,rowIndex:u}),this._bottomRightGrid&&this._bottomRightGrid.recomputeGridSize({columnIndex:a,rowIndex:u}),this._topLeftGrid&&this._topLeftGrid.recomputeGridSize({columnIndex:n,rowIndex:i}),this._topRightGrid&&this._topRightGrid.recomputeGridSize({columnIndex:a,rowIndex:i}),this._leftGridWidth=null,this._topGridHeight=null,this._maybeCalculateCachedStyles(null,this.props)}},{key:"componentWillMount",value:function(){this._maybeCalculateCachedStyles(null,this.props)}},{key:"componentWillReceiveProps",value:function(e){var t=this.props,n=t.columnWidth,o=t.fixedColumnCount,i=t.fixedRowCount,r=t.rowHeight;n===e.columnWidth&&o===e.fixedColumnCount||(this._leftGridWidth=null),i===e.fixedRowCount&&r===e.rowHeight||(this._topGridHeight=null),this._maybeCalculateCachedStyles(this.props,e)}},{key:"render",value:function(){var e=this.props,t=e.onScroll,n=e.onSectionRendered,o=(e.scrollLeft,e.scrollToColumn),i=(e.scrollTop,e.scrollToRow),l=(0,s.default)(e,["onScroll","onSectionRendered","scrollLeft","scrollToColumn","scrollTop","scrollToRow"]),a=this.state,u=a.scrollLeft,c=a.scrollTop;return S.default.createElement("div",{style:this._containerOuterStyle},S.default.createElement("div",{style:this._containerTopStyle},this._renderTopLeftGrid(l),this._renderTopRightGrid((0,r.default)({},l,{scrollLeft:u}))),S.default.createElement("div",{style:this._containerBottomStyle},this._renderBottomLeftGrid((0,r.default)({},l,{scrollTop:c})),this._renderBottomRightGrid((0,r.default)({},l,{onScroll:t,onSectionRendered:n,scrollLeft:u,scrollToColumn:o,scrollToRow:i,scrollTop:c}))))}},{key:"shouldComponentUpdate",value:function(e,t){return(0,C.default)(this,e,t)}},{key:"_bottomLeftGridRef",value:function(e){this._bottomLeftGrid=e}},{key:"_bottomRightGridRef",value:function(e){this._bottomRightGrid=e}},{key:"_cellRendererBottomLeftGrid",value:function(e){var t=e.rowIndex,n=(0,s.default)(e,["rowIndex"]),o=this.props,i=o.cellRenderer,l=o.fixedRowCount;return i((0,r.default)({},n,{rowIndex:t+l}))}},{key:"_cellRendererBottomRightGrid",value:function(e){var t=e.columnIndex,n=e.rowIndex,o=(0,s.default)(e,["columnIndex","rowIndex"]),i=this.props,l=i.cellRenderer,a=i.fixedColumnCount,u=i.fixedRowCount;return l((0,r.default)({},o,{columnIndex:t+a,rowIndex:n+u}))}},{key:"_cellRendererTopRightGrid",value:function(e){var t=e.columnIndex,n=(0,
s.default)(e,["columnIndex"]),o=this.props,i=o.cellRenderer,l=o.fixedColumnCount;return i((0,r.default)({},n,{columnIndex:t+l}))}},{key:"_columnWidthRightGrid",value:function(e){var t=e.index,n=this.props,o=n.fixedColumnCount,i=n.columnWidth;return i instanceof Function?i({index:t+o}):i}},{key:"_getBottomGridHeight",value:function(e){var t=e.height,n=this._getTopGridHeight(e);return t-n}},{key:"_getLeftGridWidth",value:function(e){var t=e.fixedColumnCount,n=e.columnWidth;if(null==this._leftGridWidth)if(n instanceof Function){for(var o=0,i=0;i<t;i++)o+=n({index:i});this._leftGridWidth=o}else this._leftGridWidth=n*t;return this._leftGridWidth}},{key:"_getRightGridWidth",value:function(e){var t=e.width,n=this._getLeftGridWidth(e);return t-n}},{key:"_getTopGridHeight",value:function(e){var t=e.fixedRowCount,n=e.rowHeight;if(null==this._topGridHeight)if(n instanceof Function){for(var o=0,i=0;i<t;i++)o+=n({index:i});this._topGridHeight=o}else this._topGridHeight=n*t;return this._topGridHeight}},{key:"_maybeCalculateCachedStyles",value:function(e,t){var n=t.columnWidth,o=t.height,i=t.fixedColumnCount,l=t.fixedRowCount,s=t.rowHeight,a=t.style,u=t.styleBottomLeftGrid,c=t.styleBottomRightGrid,d=t.styleTopLeftGrid,f=t.styleTopRightGrid,h=t.width,_=!e,p=_||o!==e.height||h!==e.width,v=_||n!==e.columnWidth||i!==e.fixedColumnCount,m=_||l!==e.fixedRowCount||s!==e.rowHeight;(_||p||a!==e.style)&&(this._containerOuterStyle=(0,r.default)({height:o,width:h},a)),(_||p||m)&&(this._containerTopStyle={height:this._getTopGridHeight(t),position:"relative",width:h},this._containerBottomStyle={height:o-this._getTopGridHeight(t),overflow:"hidden",position:"relative",width:h}),(_||u!==e.styleBottomLeftGrid)&&(this._bottomLeftGridStyle=(0,r.default)({left:0,outline:0,overflowX:"hidden",overflowY:"hidden",position:"absolute"},u)),(_||v||c!==e.styleBottomRightGrid)&&(this._bottomRightGridStyle=(0,r.default)({left:this._getLeftGridWidth(t),outline:0,position:"absolute"},c)),(_||d!==e.styleTopLeftGrid)&&(this._topLeftGridStyle=(0,r.default)({left:0,outline:0,overflowX:"hidden",overflowY:"hidden",position:"absolute",top:0},d)),(_||v||f!==e.styleTopRightGrid)&&(this._topRightGridStyle=(0,r.default)({left:this._getLeftGridWidth(t),outline:0,overflowX:"hidden",overflowY:"hidden",position:"absolute",top:0},f))}},{key:"_onScroll",value:function(e){var t=e.scrollLeft,n=e.scrollTop;this.setState({scrollLeft:t,scrollTop:n});var o=this.props.onScroll;o&&o(e)}},{key:"_renderBottomLeftGrid",value:function(e){var t=e.fixedColumnCount,n=e.fixedRowCount,o=e.rowCount,i=e.scrollTop;return t?S.default.createElement(R.default,(0,r.default)({},e,{cellRenderer:this._cellRendererBottomLeftGrid,columnCount:t,height:this._getBottomGridHeight(e),ref:this._bottomLeftGridRef,rowCount:Math.max(0,o-n),rowHeight:this._rowHeightBottomGrid,scrollTop:i,style:this._bottomLeftGridStyle,width:this._getLeftGridWidth(e)})):null}},{key:"_renderBottomRightGrid",value:function(e){var t=e.columnCount,n=e.fixedColumnCount,o=e.fixedRowCount,i=e.rowCount,l=e.scrollToColumn,s=e.scrollToRow;return S.default.createElement(R.default,(0,r.default)({},e,{cellRenderer:this._cellRendererBottomRightGrid,columnCount:Math.max(0,t-n),columnWidth:this._columnWidthRightGrid,height:this._getBottomGridHeight(e),onScroll:this._onScroll,ref:this._bottomRightGridRef,rowCount:Math.max(0,i-o),rowHeight:this._rowHeightBottomGrid,scrollToColumn:l-n,scrollToRow:s-o,style:this._bottomRightGridStyle,width:this._getRightGridWidth(e)}))}},{key:"_renderTopLeftGrid",value:function(e){var t=e.fixedColumnCount,n=e.fixedRowCount;return t&&n?S.default.createElement(R.default,(0,r.default)({},e,{columnCount:t,height:this._getTopGridHeight(e),ref:this._topLeftGridRef,rowCount:n,style:this._topLeftGridStyle,width:this._getLeftGridWidth(e)})):null}},{key:"_renderTopRightGrid",value:function(e){var t=e.columnCount,n=e.fixedColumnCount,o=e.fixedRowCount,i=e.scrollLeft;return o?S.default.createElement(R.default,(0,r.default)({},e,{cellRenderer:this._cellRendererTopRightGrid,columnCount:Math.max(0,t-n),columnWidth:this._columnWidthRightGrid,height:this._getTopGridHeight(e),ref:this._topRightGridRef,rowCount:o,scrollLeft:i,style:this._topRightGridStyle,width:this._getRightGridWidth(e)})):null}},{key:"_rowHeightBottomGrid",value:function(e){var t=e.index,n=this.props,o=n.fixedRowCount,i=n.rowHeight;return i instanceof Function?i({index:t+o}):i}},{key:"_topLeftGridRef",value:function(e){this._topLeftGrid=e}},{key:"_topRightGridRef",value:function(e){this._topRightGrid=e}}]),t}(g.Component);x.defaultProps={fixedColumnCount:0,fixedRowCount:0,style:{},styleBottomLeftGrid:{},styleBottomRightGrid:{},styleTopLeftGrid:{},styleTopRightGrid:{}},t.default=x},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.ScrollSync=t.default=void 0;var i=n(148),r=o(i);t.default=r.default,t.ScrollSync=r.default},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(3),r=o(i),l=n(29),s=o(l),a=n(30),u=o(a),c=n(34),d=o(c),f=n(81),h=o(f),_=n(89),p=n(90),v=o(p),m=function(e){function t(e,n){(0,s.default)(this,t);var o=(0,d.default)(this,(t.__proto__||(0,r.default)(t)).call(this,e,n));return o.state={clientHeight:0,clientWidth:0,scrollHeight:0,scrollLeft:0,scrollTop:0,scrollWidth:0},o._onScroll=o._onScroll.bind(o),o}return(0,h.default)(t,e),(0,u.default)(t,[{key:"render",value:function(){var e=this.props.children,t=this.state,n=t.clientHeight,o=t.clientWidth,i=t.scrollHeight,r=t.scrollLeft,l=t.scrollTop,s=t.scrollWidth;return e({clientHeight:n,clientWidth:o,onScroll:this._onScroll,scrollHeight:i,scrollLeft:r,scrollTop:l,scrollWidth:s})}},{key:"shouldComponentUpdate",value:function(e,t){return(0,v.default)(this,e,t)}},{key:"_onScroll",value:function(e){var t=e.clientHeight,n=e.clientWidth,o=e.scrollHeight,i=e.scrollLeft,r=e.scrollTop,l=e.scrollWidth;this.setState({clientHeight:t,clientWidth:n,scrollHeight:o,scrollLeft:i,scrollTop:r,scrollWidth:l})}}]),t}(_.Component);t.default=m},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.IS_SCROLLING_TIMEOUT=t.WindowScroller=t.default=void 0;var i=n(150);Object.defineProperty(t,"IS_SCROLLING_TIMEOUT",{enumerable:!0,get:function(){return i.IS_SCROLLING_TIMEOUT}});var r=n(151),l=o(r);t.default=l.default,t.WindowScroller=l.default},function(e,t){"use strict";function n(){c&&(c=null,document.body.style.pointerEvents=u,u=null)}function o(){n(),a.forEach(function(e){return e.__resetIsScrolling()})}function i(){c&&clearTimeout(c),c=setTimeout(o,d)}function r(e){e.currentTarget===window&&null==u&&(u=document.body.style.pointerEvents,document.body.style.pointerEvents="none"),i(),a.forEach(function(t){t.scrollElement===e.currentTarget&&t.__handleWindowScrollEvent(e)})}function l(e,t){a.some(function(e){return e.scrollElement===t})||t.addEventListener("scroll",r),a.push(e)}function s(e,t){a=a.filter(function(t){return t!==e}),a.length||(t.removeEventListener("scroll",r),c&&(clearTimeout(c),n()))}Object.defineProperty(t,"__esModule",{value:!0}),t.registerScrollListener=l,t.unregisterScrollListener=s;var a=[],u=null,c=null,d=t.IS_SCROLLING_TIMEOUT=150},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(3),r=o(i),l=n(29),s=o(l),a=n(30),u=o(a),c=n(34),d=o(c),f=n(81),h=o(f),_=n(89),p=n(96),v=o(p),m=n(90),g=o(m),S=n(150),y=n(152),C=function(e){function t(e){(0,s.default)(this,t);var n=(0,d.default)(this,(t.__proto__||(0,r.default)(t)).call(this,e)),o="undefined"!=typeof window?(0,y.getHeight)(e.scrollElement||window):0;return n.state={height:o,isScrolling:!1,scrollTop:0},n._onResize=n._onResize.bind(n),n.__handleWindowScrollEvent=n.__handleWindowScrollEvent.bind(n),n.__resetIsScrolling=n.__resetIsScrolling.bind(n),n}return(0,h.default)(t,e),(0,u.default)(t,[{key:"updatePosition",value:function(e){var t=this.props.onResize,n=this.state.height;e=e||this.props.scrollElement||window,this._positionFromTop=(0,y.getPositionFromTop)(v.default.findDOMNode(this),e);var o=(0,y.getHeight)(e);n!==o&&(this.setState({height:o}),t({height:o}))}},{key:"componentDidMount",value:function(){var e=this.props.scrollElement||window;this.updatePosition(e),(0,S.registerScrollListener)(this,e),window.addEventListener("resize",this._onResize,!1)}},{key:"componentWillReceiveProps",value:function(e){var t=this.props.scrollElement||window,n=e.scrollElement||window;t!==n&&(this.updatePosition(n),(0,S.unregisterScrollListener)(this,t),(0,S.registerScrollListener)(this,n))}},{key:"componentWillUnmount",value:function(){(0,S.unregisterScrollListener)(this,this.props.scrollElement||window),window.removeEventListener("resize",this._onResize,!1)}},{key:"render",value:function(){var e=this.props.children,t=this.state,n=t.isScrolling,o=t.scrollTop,i=t.height;return e({height:i,isScrolling:n,scrollTop:o})}},{key:"shouldComponentUpdate",value:function(e,t){return(0,g.default)(this,e,t)}},{key:"_onResize",value:function(e){this.updatePosition()}},{key:"__handleWindowScrollEvent",value:function(e){var t=this.props.onScroll,n=this.props.scrollElement||window,o=Math.max(0,(0,y.getScrollTop)(n)-this._positionFromTop);this.setState({isScrolling:!0,scrollTop:o}),t({scrollTop:o})}},{key:"__resetIsScrolling",value:function(){this.setState({isScrolling:!1})}},{key:"scrollElement",get:function(){return this.props.scrollElement||window}}]),t}(_.Component);C.defaultProps={onResize:function(){},onScroll:function(){}},t.default=C},function(e,t){"use strict";function n(e){return e===window?window.innerHeight:e.getBoundingClientRect().height}function o(e,t){var n=t===window?0:i(t),o=t===window?document.documentElement:t;return e.getBoundingClientRect().top+n-o.getBoundingClientRect().top}function i(e){return e===window?"scrollY"in window?window.scrollY:document.documentElement.scrollTop:e.scrollTop}Object.defineProperty(t,"__esModule",{value:!0}),t.getHeight=n,t.getPositionFromTop=o,t.getScrollTop=i}])});
//# sourceMappingURL=react-virtualized.min.js.map
|
example/storybook/src/index.js
|
i18next/react-i18next
|
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
// import i18n (needs to be bundled ;))
import './i18n';
ReactDOM.render(<App />, document.getElementById('root'));
|
node_modules/material-ui/svg-icons/communication/phonelink-setup.js
|
SerendpityZOEY/Solr-Search-React-UI
|
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _pure = require('recompose/pure');
var _pure2 = _interopRequireDefault(_pure);
var _SvgIcon = require('../../SvgIcon');
var _SvgIcon2 = _interopRequireDefault(_SvgIcon);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var CommunicationPhonelinkSetup = function CommunicationPhonelinkSetup(props) {
return _react2.default.createElement(
_SvgIcon2.default,
props,
_react2.default.createElement('path', { d: 'M11.8 12.5v-1l1.1-.8c.1-.1.1-.2.1-.3l-1-1.7c-.1-.1-.2-.2-.3-.1l-1.3.4c-.3-.2-.6-.4-.9-.5l-.2-1.3c0-.1-.1-.2-.3-.2H7c-.1 0-.2.1-.3.2l-.2 1.3c-.3.1-.6.3-.9.5l-1.3-.5c-.1 0-.2 0-.3.1l-1 1.7c-.1.1 0 .2.1.3l1.1.8v1l-1.1.8c-.1.2-.1.3-.1.4l1 1.7c.1.1.2.2.3.1l1.4-.4c.3.2.6.4.9.5l.2 1.3c-.1.1.1.2.2.2h2c.1 0 .2-.1.3-.2l.2-1.3c.3-.1.6-.3.9-.5l1.3.5c.1 0 .2 0 .3-.1l1-1.7c.1-.1 0-.2-.1-.3l-1.1-.9zM8 14c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zM19 1H9c-1.1 0-2 .9-2 2v3h2V4h10v16H9v-2H7v3c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V3c0-1.1-.9-2-2-2z' })
);
};
CommunicationPhonelinkSetup = (0, _pure2.default)(CommunicationPhonelinkSetup);
CommunicationPhonelinkSetup.displayName = 'CommunicationPhonelinkSetup';
CommunicationPhonelinkSetup.muiName = 'SvgIcon';
exports.default = CommunicationPhonelinkSetup;
|
src/svg-icons/action/query-builder.js
|
matthewoates/material-ui
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionQueryBuilder = (props) => (
<SvgIcon {...props}>
<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 8zm.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z"/>
</SvgIcon>
);
ActionQueryBuilder = pure(ActionQueryBuilder);
ActionQueryBuilder.displayName = 'ActionQueryBuilder';
ActionQueryBuilder.muiName = 'SvgIcon';
export default ActionQueryBuilder;
|
src/Parser/Monk/Mistweaver/Modules/Traits/SoothingRemedies.js
|
hasseboulen/WoWAnalyzer
|
import React from 'react';
import SPELLS from 'common/SPELLS';
import SpellIcon from 'common/SpellIcon';
import SpellLink from 'common/SpellLink';
import { formatPercentage } from 'common/format';
import Analyzer from 'Parser/Core/Analyzer';
import calculateEffectiveHealing from 'Parser/Core/calculateEffectiveHealing';
import Combatants from 'Parser/Core/Modules/Combatants';
const SOOTHING_REMEDIES_HEALING_INCREASE = 0.03;
/**
* Soothing Remedies (Artifact Trait)
* Increases healing done by Soothing Mist by 3%.
*/
class SoothingRemedies extends Analyzer {
static dependencies = {
combatants: Combatants,
};
rank = 0;
healing = 0;
on_initialized() {
this.rank = this.combatants.selected.traitsBySpellId[SPELLS.SOOTHING_REMEDIES.id];
this.active = this.rank > 0;
}
on_byPlayer_heal(event) {
if (event.ability.guid !== SPELLS.SOOTHING_MIST.id) {
return;
}
this.healing += calculateEffectiveHealing(event, SOOTHING_REMEDIES_HEALING_INCREASE);
}
subStatistic() {
return (
<div className="flex">
<div className="flex-main">
<SpellLink id={SPELLS.SOOTHING_REMEDIES.id}>
<SpellIcon id={SPELLS.SOOTHING_REMEDIES.id} noLink /> Soothing Remedies
</SpellLink>
</div>
<div className="flex-sub text-right">
{formatPercentage(this.owner.getPercentageOfTotalHealingDone(this.healing))} %
</div>
</div>
);
}
}
export default SoothingRemedies;
|
src/ModalBody.js
|
apisandipas/react-bootstrap
|
import React from 'react';
import classNames from 'classnames';
class ModalBody extends React.Component {
render() {
return (
<div
{...this.props}
className={classNames(this.props.className, this.props.modalClassName)}>
{this.props.children}
</div>
);
}
}
ModalBody.propTypes = {
/**
* A css class applied to the Component
*/
modalClassName: React.PropTypes.string
};
ModalBody.defaultProps = {
modalClassName: 'modal-body'
};
export default ModalBody;
|
packages/vx-demo/pages/voronoi.js
|
Flaque/vx
|
import React from 'react';
import Show from '../components/show';
import VoronoiChart from '../components/charts/VoronoiChart';
export default () => {
return (
<Show
events
margin={{
top: 0,
left: 0,
right: 0,
bottom: 0,
}}
component={VoronoiChart}
title="VoronoiChart with mouseover"
>
{`import React from 'react';
import { extent } from 'd3-array';
import { Group } from '@vx/group';
import { GradientOrangeRed, GradientPinkRed } from '@vx/gradient';
import { RectClipPath } from '@vx/clip-path';
import { scaleLinear } from '@vx/scale';
import { getCoordsFromEvent } from '@vx/brush';
import { voronoi, VoronoiPolygon } from '@vx/voronoi';
const neighborRadius = 50;
const data = Array(150).fill(null).map(() => ({
x: Math.random(),
y: Math.random(),
id: Math.random().toString(36).slice(2),
}));
class VoronoiChart extends React.PureComponent {
static getUpdatedState(props) {
const { width, height, margin } = props;
const innerWidth = width - margin.left - margin.right;
const innerHeight = height - margin.top - margin.bottom;
const xScale = scaleLinear({
domain: extent(data, d => d.x),
range: [0, innerWidth],
});
const yScale = scaleLinear({
domain: extent(data, d => d.y),
range: [innerHeight, 0],
});
const voronoiDiagram = voronoi({
x: d => xScale(d.x),
y: d => yScale(d.y),
width: innerWidth,
height: innerHeight,
})(data);
return {
selected: null,
selectedNeighbors: null,
xScale,
yScale,
voronoiDiagram,
innerWidth,
innerHeight,
};
}
constructor(props) {
super(props);
this.handleMouseMove = this.handleMouseMove.bind(this);
this.state = VoronoiChart.getUpdatedState(props);
}
componentWillReceiveProps(nextProps) {
if (
nextProps.width !== this.props.width ||
nextProps.height !== this.props.height
) {
this.setState(VoronoiChart.getUpdatedState(nextProps));
}
}
handleMouseMove(event) {
const { voronoiDiagram } = this.state;
const { x, y } = getCoordsFromEvent(this.svg, event);
const closest = voronoiDiagram.find(x, y, neighborRadius);
if (closest) {
const neighbors = {};
const cell = voronoiDiagram.cells[closest.index];
cell.halfedges.forEach((index) => {
const edge = voronoiDiagram.edges[index];
const { left, right } = edge;
if (left !== closest) neighbors[left.data.id] = true;
else if (right !== closest) neighbors[right.id] = true;
})
this.setState({ selected: closest, neighbors });
}
}
render() {
const { width, height, margin } = this.props;
const {
voronoiDiagram,
innerWidth,
innerHeight,
xScale,
yScale,
selected,
neighbors,
} = this.state;
const polygons = voronoiDiagram.polygons();
return (
<svg
width={width}
height={height}
ref={(ref) => { this.svg = ref; }}
>
<GradientOrangeRed id="voronoi_orange_red" />
<GradientPinkRed id="voronoi_pink_red" />
<RectClipPath
id="voronoi_clip"
width={innerWidth}
height={innerHeight}
rx={14}
/>
<Group
top={margin.top}
left={margin.left}
clipPath="url(#voronoi_clip)"
onMouseMove={this.handleMouseMove}
onMouseLeave={() => { this.setState({ selected: null, neighbors: null }); }}
>
{polygons.map((polygon) => (
<VoronoiPolygon
key={...}
polygon={polygon}
fill={(d) => (
selected && (d.id === selected.data.id || neighbors[d.id]) ?
'url(#voronoi_orange_red)' : 'url(#voronoi_pink_red)'
)}
fillOpacity={(d) => (
neighbors && neighbors[d.id] ? 0.4 : 1
)}
stroke="#fff"
strokeWidth={1}
/>
))}
{data.map((d) => (
<circle
key={...}
r={2}
cx={xScale(d.x)}
cy={yScale(d.y)}
fill="#ffffff"
fillOpacity={0.5}
/>
))}
</Group>
</svg>
);
}
}
`}
</Show>
);
}
|
mockup2/data/js/jquery-1.7.2.b8d64d0bc142b3f670cc0611b0aebcae.compact.js
|
leeric92/GroupShopV2
|
/* 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+0.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);
|
app/components/Utils/Loader.js
|
sarven/discover-places-app
|
import React, { Component } from 'react';
import { View } from 'react-native';
import CircleProgress from 'react-native-progress/Circle';
import { COLORS, STYLES } from './../../config/style';
export default class Loader extends Component
{
constructor (props) {
super(props);
this.state = {
isLoading: false,
isCommentCreating: false
};
}
componentWillReceiveProps(nextProps) {
this.setState({
isLoading: nextProps.navigationParams.hasOwnProperty('isLoading') ? nextProps.navigationParams.isLoading : false,
isCommentCreating: nextProps.navigationParams.hasOwnProperty('isCommentCreating') ? nextProps.navigationParams.isCommentCreating : false,
});
}
render () {
return (
<View style={STYLES.loader}>
{(this.state.isLoading || this.state.isCommentCreating) &&
<CircleProgress
size={20}
indeterminate={true}
color={COLORS.blue}
/>
}
</View>
);
}
}
|
ajax/libs/flocks.js/0.15.11/flocks.js
|
hare1039/cdnjs
|
/** @jsx React.DOM */
/* jshint node: true, browser: true, newcap: false */
/* eslint max-statements: 0, no-else-return: 0, brace-style: 0 */
/* eslint-env node,browser */
/**
* The Flocks library module.
*
* @module Flocks
* @main Flocks
* @class Flocks
*/
// if it's in a <script> it's defined already
// otherwise assume commonjs
/* eslint-disable no-use-before-define, vars-on-top */
if (typeof React === "undefined") {
var React = require("react");
}
/* eslint-enable no-use-before-define, vars-on-top */
// wrap the remainder
(function() {
"use strict";
var Mixin,
exports,
initialized = false,
updateBlocks = 0,
tagtype,
/* eslint-disable no-unused-vars */
dirty = false,
handler = function(Ignored) { return true; },
/* eslint-ensable no-unused-vars */
finalizer = function() { return true; },
prevFCtx = {},
nextFCtx = {},
flocks2Ctxs = { "flocks2context" : React.PropTypes.object };
// ... lol
function arrayMember(Item, Array) {
return (!!(~( Array.indexOf(Item, 0) )));
}
function isArray(maybeArray) {
return (Object.prototype.toString.call(maybeArray) === "[object Array]");
}
function isUndefined(maybeUndefined) {
return (typeof maybeUndefined === "undefined");
}
function isNonArrayObject(maybeArray) {
if (typeof maybeArray !== "object") { return false; }
if (Object.prototype.toString.call(maybeArray) === "[object Array]") { return false; }
return true;
}
function flocksLog(Level, Message) {
if (typeof Level === "string") {
if (arrayMember(Level, ["warn","debug","error","log","info","exception","assert"])) {
console[Level]("Flocks2 [" + Level + "] " + Message.toString());
} else {
console.log("Flocks2 [Unknown level] " + Message.toString());
}
} else if (isUndefined(nextFCtx.flocks2Config)) {
console.log("Flocks2 pre-config [" + Level.toString() + "] " + Message.toString());
} else if (nextFCtx.flocks2Config.log_level >= Level) {
console.log("Flocks2 [" + Level.toString() + "] " + Message.toString());
}
}
function attemptUpdate() {
flocksLog(3, " - Flocks2 attempting update");
dirty = true;
if (!(initialized)) {
flocksLog(1, " x Flocks2 skipped update: root is not initialized");
return null;
}
if (updateBlocks) {
flocksLog(1, " x Flocks2 skipped update: lock count updateBlocks is non-zero");
return null;
}
/* todo see issue #9 https://github.com/StoneCypher/flocks.js/issues/9
if (deepCompare(nextFCtx, prevFCtx)) {
flocksLog(2, " x Flocks2 skipped update: no update to state");
return true;
}
*/
if (!(handler(nextFCtx))) {
flocksLog(0, " ! Flocks2 rolling back update: handler rejected propset");
nextFCtx = prevFCtx;
dirty = false;
return null;
}
prevFCtx = nextFCtx;
flocksLog(3, " - Flocks2 update passed");
React.render( React.createFactory(tagtype)( { "flocks2context" : nextFCtx } ), document.body );
dirty = false;
flocksLog(3, " - Flocks2 update complete; finalizing");
finalizer();
return true;
}
function enforceString(On, Label) {
if (typeof On !== "string") {
throw Label || "Argument must be a string";
}
}
function enforceArray(On, Label) {
if (!isArray(On)) {
throw Label || "Argument must be an array";
}
}
function enforceNonArrayObject(On, Label) {
if (!isNonArrayObject(On)) {
throw Label || "Argument must be a non-array object";
}
}
function setByKey(Key, MaybeValue) {
enforceString(Key, "Flocks2 set/2 must take a string for its key");
nextFCtx[Key] = MaybeValue;
flocksLog(1, " - Flocks2 setByKey \"" + Key + "\"");
attemptUpdate();
}
// todo
// function setByObject(Key, MaybeValue) {
// flocksLog(0, " - Flocks2 setByObject stub");
// attemptUpdate();
// }
function set(Key, MaybeValue) {
flocksLog(3, " - Flocks2 multi-set");
if (typeof Key === "string") { setByKey(Key, MaybeValue); }
// else if (isArray(Key)) { setByPath(Key, MaybeValue); }
// else if (isNonArrayObject(Key)) { setByObject(Key); } // todo
else { throw "Flocks2 set/1,2 key must be a string or an array"; }
}
function setByPath(Path, Target, NewVal) {
var NextPath,
OldVal; // it gets hoisted anyway, so it triggers eslint warnings when inlined
// might as well be explicit about it
if (!(isArray(Path))) { throw "Path must be an array!"; }
if (Path.length === 0) {
OldVal = Target;
Target = NewVal;
return OldVal;
}
if (Path.length === 1) {
OldVal = Target[Path[0]];
Target[Path[0]] = NewVal;
return OldVal;
}
if (["string","number"].indexOf(typeof Path[0]) !== -1) {
NextPath = Path.splice(1, Number.MAX_VALUE);
return setByPath(NextPath, Target[Path[0]], NewVal);
}
}
function getByPath(Path, Target) {
var NextPath;
if (!(isArray(Path))) { throw "path must be an array!"; }
if (Path.length === 0) {
return Target;
}
if (Path.length === 1) {
return Target[Path[0]];
}
if (["string","number"].indexOf(typeof Path[0]) !== -1) {
NextPath = Path.splice(1, Number.MAX_VALUE);
return getByPath(NextPath, Target[Path[0]]);
}
}
function update(SparseObject) {
// todo
console.log("ERROR: stub called!");
enforceNonArrayObject(SparseObject, "Flocks2 update/1 must take a plain object");
}
function lock() {
++updateBlocks;
}
function unlock() {
if (updateBlocks <= 0) { throw "unlock()ed with no lock!"; }
--updateBlocks;
attemptUpdate();
}
function clone(obj) {
var copy = obj.constructor(),
attr;
if ((obj === null) || (typeof obj !== "object")) { return obj; }
for (attr in obj) {
if (obj.hasOwnProperty(attr)) { copy[attr] = obj[attr]; }
}
return copy;
}
function create(iFlocksConfig, iFlocksData) {
var FlocksConfig = iFlocksConfig || {},
FlocksData = iFlocksData || {},
target = FlocksConfig.target || document.body,
stub = function() { console.log("ERROR: stub called!"); attemptUpdate(); }, // todo
updater = {
"get" : stub, // todo
"override" : stub, // todo
"clear" : stub, // todo
"get_path" : getByPath,
"set" : set,
"set_path" : setByPath,
"update" : update,
"lock" : lock,
"unlock" : unlock
};
FlocksConfig["log_level"] = FlocksConfig["log_level"] || -1;
tagtype = FlocksConfig.control;
FlocksData.flocks2Config = FlocksConfig;
nextFCtx = FlocksData;
flocksLog(1, "Flocks2 root creation begins");
if (!(tagtype)) {
throw "Flocks2 fatal error: must provide a control in create/2 FlocksConfig";
}
if (FlocksConfig.handler) {
handler = FlocksConfig.handler;
flocksLog(3, " - Flocks2 handler assigned");
}
if (FlocksConfig.finalizer) {
finalizer = FlocksConfig.finalizer;
flocksLog(3, " - Flocks2 finalizer assigned");
}
if (FlocksConfig.preventAutoContext) {
flocksLog(2, " - Flocks2 skipping auto-context");
} else {
flocksLog(2, " - Flocks2 engaging auto-context");
this.fctx = clone(nextFCtx);
}
flocksLog(3, "Flocks2 creation finished; initializing");
initialized = true;
attemptUpdate();
flocksLog(3, "Flocks2 expose updater");
this.fupd = updater;
this.fset = updater.set;
this.fgetpath = updater.get_path;
this.flock = updater.lock;
this.funlock = updater.unlock;
this.fupdate = updater.update;
flocksLog(3, "Flocks2 initialization finished");
return updater;
}
Mixin = {
"contextTypes" : flocks2Ctxs,
"childContextTypes" : flocks2Ctxs,
"componentWillMount" : function() {
flocksLog(1, " - Flocks2 component will mount: " + this.constructor.displayName);
flocksLog(3, isUndefined(this.props.flocks2context)?
" - No F2 Context Prop"
: " - F2 Context Prop found");
flocksLog(3, isUndefined(this.context.flocks2context)?
" - No F2 Context"
: " - F2 Context found");
if (this.props.flocks2context) {
this.context.flocks2context = this.props.flocks2context;
}
this.fupdate = function(Obj) { return update(Obj); };
this.fgetpath = function(P,T) { return getByPath(P,T); };
this.fset = function(K,V) { return set(K,V); };
this.fsetpath = function(P,V) { return set(P,V); };
this.flock = function() { return lock(); };
this.funlock = function() { return unlock(); };
this.fctx = this.context.flocks2context;
},
"getChildContext" : function() {
return this.context;
}
};
function atLeastFlocks(OriginalList) {
var NewList;
if (isUndefined(OriginalList)) {
return [ Mixin ];
}
if (isArray(OriginalList)) {
if (arrayMember(Mixin, OriginalList)) {
return OriginalList;
} else {
NewList = clone(OriginalList);
NewList.push(Mixin);
return NewList;
}
}
throw "Original mixin list must be an array or undefined!";
}
function createClass(spec) {
spec.mixins = atLeastFlocks(spec.mixins);
return React.createClass(spec);
}
exports = {
"version" : "0.15.11",
"plumbing" : Mixin,
"createClass" : createClass,
"mount" : create,
"clone" : clone,
"isArray" : isArray,
"isUndefined" : isUndefined,
"isNonArrayObject" : isNonArrayObject,
"enforceString" : enforceString,
"enforceArray" : enforceArray,
"enforceNonArrayObject" : enforceNonArrayObject,
"atLeastFlocks" : atLeastFlocks
};
if (typeof module !== "undefined") {
module.exports = exports;
} else {
window.flocks = exports;
}
}());
|
dataowner/src/NavBar.js
|
e-nettet/CustomerConsentWallet
|
import React, { Component } from 'react';
class NavBar extends React.Component {
render() {
return (
<nav className="navbar navbar-inverse navbar-fixed-top">
<div className="container">
<div id="navbar" className="navbar-collapse collapse">
<ul className="nav navbar-nav">
<li><a href="/">Home</a></li>
</ul>
</div>
</div>
</nav>
);
}
}
export default NavBar;
|
examples/todomvc/containers/TodoApp.js
|
rt2zz/redux
|
import React, { Component } from 'react';
import { bindActionCreators } from 'redux';
import { Connector } from 'redux/react';
import Header from '../components/Header';
import MainSection from '../components/MainSection';
import * as TodoActions from '../actions/TodoActions';
export default class TodoApp extends Component {
render() {
return (
<Connector select={state => ({ todos: state.todos })}>
{this.renderChild}
</Connector>
);
}
renderChild({ todos, dispatch }) {
const actions = bindActionCreators(TodoActions, dispatch);
return (
<div>
<Header addTodo={actions.addTodo} />
<MainSection todos={todos} actions={actions} />
</div>
);
}
}
|
src/svg-icons/navigation/arrow-drop-up.js
|
kittyjumbalaya/material-components-web
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let NavigationArrowDropUp = (props) => (
<SvgIcon {...props}>
<path d="M7 14l5-5 5 5z"/>
</SvgIcon>
);
NavigationArrowDropUp = pure(NavigationArrowDropUp);
NavigationArrowDropUp.displayName = 'NavigationArrowDropUp';
NavigationArrowDropUp.muiName = 'SvgIcon';
export default NavigationArrowDropUp;
|
src/svg-icons/action/perm-data-setting.js
|
kasra-co/material-ui
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionPermDataSetting = (props) => (
<SvgIcon {...props}>
<path d="M18.99 11.5c.34 0 .67.03 1 .07L20 0 0 20h11.56c-.04-.33-.07-.66-.07-1 0-4.14 3.36-7.5 7.5-7.5zm3.71 7.99c.02-.16.04-.32.04-.49 0-.17-.01-.33-.04-.49l1.06-.83c.09-.08.12-.21.06-.32l-1-1.73c-.06-.11-.19-.15-.31-.11l-1.24.5c-.26-.2-.54-.37-.85-.49l-.19-1.32c-.01-.12-.12-.21-.24-.21h-2c-.12 0-.23.09-.25.21l-.19 1.32c-.3.13-.59.29-.85.49l-1.24-.5c-.11-.04-.24 0-.31.11l-1 1.73c-.06.11-.04.24.06.32l1.06.83c-.02.16-.03.32-.03.49 0 .17.01.33.03.49l-1.06.83c-.09.08-.12.21-.06.32l1 1.73c.06.11.19.15.31.11l1.24-.5c.26.2.54.37.85.49l.19 1.32c.02.12.12.21.25.21h2c.12 0 .23-.09.25-.21l.19-1.32c.3-.13.59-.29.84-.49l1.25.5c.11.04.24 0 .31-.11l1-1.73c.06-.11.03-.24-.06-.32l-1.07-.83zm-3.71 1.01c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"/>
</SvgIcon>
);
ActionPermDataSetting = pure(ActionPermDataSetting);
ActionPermDataSetting.displayName = 'ActionPermDataSetting';
ActionPermDataSetting.muiName = 'SvgIcon';
export default ActionPermDataSetting;
|
app/containers/FeaturePage/index.js
|
shinetimes/web-storm
|
/*
* FeaturePage
*
* List all the features
*/
/* eslint-disable react/prefer-stateless-function */
import React from 'react';
import { connect } from 'react-redux';
import { push } from 'react-router-redux';
import Button from 'components/Button';
import H1 from 'components/H1';
import styles from './styles.css';
export class FeaturePage extends React.Component {
/**
* Changes the route
*
* @param {string} route The route we want to go to
*/
openRoute = (route) => {
this.props.changeRoute(route);
};
/**
* Changed route to '/'
*/
openHomePage = () => {
this.openRoute('/');
};
render() {
return (
<div>
<H1>Features</H1>
<ul className={styles.list}>
<li className={styles.listItem}>
<p className={styles.listItemTitle}>Quick scaffolding</p>
<p>Automate the creation of components, containers, routes, selectors
and sagas - and their tests - right from the CLI!</p>
</li>
<li className={styles.listItem}>
<p className={styles.listItemTitle}>Instant feedback</p>
<p>Enjoy the best DX and code your app at the speed of thought! Your
saved changes to the CSS and JS are reflected instantaneously
without refreshing the page. Preserve application state even when
you update something in the underlying code!</p>
</li>
<li className={styles.listItem}>
<p className={styles.listItemTitle}>Predictable state management</p>
<p>Unidirectional data flow allows for change logging and time travel
debugging.</p>
</li>
<li className={styles.listItem}>
<p className={styles.listItemTitle}>Next generation JavaScript</p>
<p>Use template strings, object destructuring, arrow functions, JSX
syntax and more, today.</p>
</li>
<li className={styles.listItem}>
<p className={styles.listItemTitle}>Next generation CSS</p>
<p>Write composable CSS that's co-located with your components for
complete modularity. Unique generated class names keep the
specificity low while eliminating style clashes. Ship only the
styles that are on the page for the best performance.</p>
</li>
<li className={styles.listItem}>
<p className={styles.listItemTitle}>Industry-standard routing</p>
<p>It's natural to want to add pages (e.g. `/about`) to your
application, and routing makes this possible.</p>
</li>
<li className={styles.listItem}>
<p className={styles.listItemTitle}>Offline-first</p>
<p>The next frontier in performant web apps: availability without a
network connection from the instant your users load the app.</p>
</li>
</ul>
<Button handleRoute={this.openHomePage}>Home</Button>
</div>
);
}
}
FeaturePage.propTypes = {
changeRoute: React.PropTypes.func,
};
function mapDispatchToProps(dispatch) {
return {
changeRoute: (url) => dispatch(push(url)),
};
}
export default connect(null, mapDispatchToProps)(FeaturePage);
|
ajax/libs/react-chartjs-2/2.5.3/react-chartjs-2.js
|
holtkamp/cdnjs
|
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.reactChartjs2 = 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(require,module,exports){
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/
function makeEmptyFunction(arg) {
return function () {
return arg;
};
}
/**
* This function accepts and discards inputs; it has no side effects. This is
* primarily useful idiomatically for overridable function endpoints which
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
*/
var emptyFunction = function emptyFunction() {};
emptyFunction.thatReturns = makeEmptyFunction;
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
emptyFunction.thatReturnsThis = function () {
return this;
};
emptyFunction.thatReturnsArgument = function (arg) {
return arg;
};
module.exports = emptyFunction;
},{}],2:[function(require,module,exports){
(function (process){
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
'use 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 validateFormat = function validateFormat(format) {};
if (process.env.NODE_ENV !== 'production') {
validateFormat = function validateFormat(format) {
if (format === undefined) {
throw new Error('invariant requires an error message argument');
}
};
}
function invariant(condition, format, a, b, c, d, e, f) {
validateFormat(format);
if (!condition) {
var error;
if (format === undefined) {
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
} else {
var args = [a, b, c, d, e, f];
var argIndex = 0;
error = new Error(format.replace(/%s/g, function () {
return args[argIndex++];
}));
error.name = 'Invariant Violation';
}
error.framesToPop = 1; // we don't care about invariant's own frame
throw error;
}
}
module.exports = invariant;
}).call(this,require('_process'))
},{"_process":5}],3:[function(require,module,exports){
(function (process){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
'use strict';
var emptyFunction = require('./emptyFunction');
/**
* Similar to invariant but only logs a warning if the condition is not met.
* This can be used to log issues in development environments in critical
* paths. Removing the logging code for production environments will keep the
* same logic and follow the same code paths.
*/
var warning = emptyFunction;
if (process.env.NODE_ENV !== 'production') {
(function () {
var printWarning = function printWarning(format) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
var argIndex = 0;
var message = 'Warning: ' + format.replace(/%s/g, function () {
return args[argIndex++];
});
if (typeof console !== 'undefined') {
console.error(message);
}
try {
// --- Welcome to debugging React ---
// This error was thrown as a convenience so that you can use this stack
// to find the callsite that caused this warning to fire.
throw new Error(message);
} catch (x) {}
};
warning = function warning(condition, format) {
if (format === undefined) {
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
}
if (format.indexOf('Failed Composite propType: ') === 0) {
return; // Ignore CompositeComponent proptype check.
}
if (!condition) {
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
args[_key2 - 2] = arguments[_key2];
}
printWarning.apply(undefined, [format].concat(args));
}
};
})();
}
module.exports = warning;
}).call(this,require('_process'))
},{"./emptyFunction":1,"_process":5}],4:[function(require,module,exports){
(function (global){
/**
* Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="npm" -o ./`
* Copyright JS Foundation and other contributors <https://js.foundation/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED = '__lodash_hash_undefined__';
/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG = 1,
COMPARE_UNORDERED_FLAG = 2;
/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER = 9007199254740991;
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
arrayTag = '[object Array]',
asyncTag = '[object AsyncFunction]',
boolTag = '[object Boolean]',
dateTag = '[object Date]',
errorTag = '[object Error]',
funcTag = '[object Function]',
genTag = '[object GeneratorFunction]',
mapTag = '[object Map]',
numberTag = '[object Number]',
nullTag = '[object Null]',
objectTag = '[object Object]',
promiseTag = '[object Promise]',
proxyTag = '[object Proxy]',
regexpTag = '[object RegExp]',
setTag = '[object Set]',
stringTag = '[object String]',
symbolTag = '[object Symbol]',
undefinedTag = '[object Undefined]',
weakMapTag = '[object WeakMap]';
var arrayBufferTag = '[object ArrayBuffer]',
dataViewTag = '[object DataView]',
float32Tag = '[object Float32Array]',
float64Tag = '[object Float64Array]',
int8Tag = '[object Int8Array]',
int16Tag = '[object Int16Array]',
int32Tag = '[object Int32Array]',
uint8Tag = '[object Uint8Array]',
uint8ClampedTag = '[object Uint8ClampedArray]',
uint16Tag = '[object Uint16Array]',
uint32Tag = '[object Uint32Array]';
/**
* Used to match `RegExp`
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
*/
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
/** Used to detect host constructors (Safari). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;
/** Used to detect unsigned integer values. */
var reIsUint = /^(?:0|[1-9]\d*)$/;
/** Used to identify `toStringTag` values of typed arrays. */
var typedArrayTags = {};
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
typedArrayTags[uint32Tag] = true;
typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
typedArrayTags[errorTag] = typedArrayTags[funcTag] =
typedArrayTags[mapTag] = typedArrayTags[numberTag] =
typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
typedArrayTags[setTag] = typedArrayTags[stringTag] =
typedArrayTags[weakMapTag] = false;
/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root = freeGlobal || freeSelf || Function('return this')();
/** Detect free variable `exports`. */
var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
/** Detect free variable `module`. */
var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports;
/** Detect free variable `process` from Node.js. */
var freeProcess = moduleExports && freeGlobal.process;
/** Used to access faster Node.js helpers. */
var nodeUtil = (function() {
try {
return freeProcess && freeProcess.binding && freeProcess.binding('util');
} catch (e) {}
}());
/* Node.js helper references. */
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
/**
* A specialized version of `_.filter` for arrays without support for
* iteratee shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
*/
function arrayFilter(array, predicate) {
var index = -1,
length = array == null ? 0 : array.length,
resIndex = 0,
result = [];
while (++index < length) {
var value = array[index];
if (predicate(value, index, array)) {
result[resIndex++] = value;
}
}
return result;
}
/**
* Appends the elements of `values` to `array`.
*
* @private
* @param {Array} array The array to modify.
* @param {Array} values The values to append.
* @returns {Array} Returns `array`.
*/
function arrayPush(array, values) {
var index = -1,
length = values.length,
offset = array.length;
while (++index < length) {
array[offset + index] = values[index];
}
return array;
}
/**
* A specialized version of `_.some` for arrays without support for iteratee
* shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {boolean} Returns `true` if any element passes the predicate check,
* else `false`.
*/
function arraySome(array, predicate) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
if (predicate(array[index], index, array)) {
return true;
}
}
return false;
}
/**
* The base implementation of `_.times` without support for iteratee shorthands
* or max array length checks.
*
* @private
* @param {number} n The number of times to invoke `iteratee`.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the array of results.
*/
function baseTimes(n, iteratee) {
var index = -1,
result = Array(n);
while (++index < n) {
result[index] = iteratee(index);
}
return result;
}
/**
* The base implementation of `_.unary` without support for storing metadata.
*
* @private
* @param {Function} func The function to cap arguments for.
* @returns {Function} Returns the new capped function.
*/
function baseUnary(func) {
return function(value) {
return func(value);
};
}
/**
* Checks if a `cache` value for `key` exists.
*
* @private
* @param {Object} cache The cache to query.
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function cacheHas(cache, key) {
return cache.has(key);
}
/**
* Gets the value at `key` of `object`.
*
* @private
* @param {Object} [object] The object to query.
* @param {string} key The key of the property to get.
* @returns {*} Returns the property value.
*/
function getValue(object, key) {
return object == null ? undefined : object[key];
}
/**
* Converts `map` to its key-value pairs.
*
* @private
* @param {Object} map The map to convert.
* @returns {Array} Returns the key-value pairs.
*/
function mapToArray(map) {
var index = -1,
result = Array(map.size);
map.forEach(function(value, key) {
result[++index] = [key, value];
});
return result;
}
/**
* Creates a unary function that invokes `func` with its argument transformed.
*
* @private
* @param {Function} func The function to wrap.
* @param {Function} transform The argument transform.
* @returns {Function} Returns the new function.
*/
function overArg(func, transform) {
return function(arg) {
return func(transform(arg));
};
}
/**
* Converts `set` to an array of its values.
*
* @private
* @param {Object} set The set to convert.
* @returns {Array} Returns the values.
*/
function setToArray(set) {
var index = -1,
result = Array(set.size);
set.forEach(function(value) {
result[++index] = value;
});
return result;
}
/** Used for built-in method references. */
var arrayProto = Array.prototype,
funcProto = Function.prototype,
objectProto = Object.prototype;
/** Used to detect overreaching core-js shims. */
var coreJsData = root['__core-js_shared__'];
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/** Used to detect methods masquerading as native. */
var maskSrcKey = (function() {
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
return uid ? ('Symbol(src)_1.' + uid) : '';
}());
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString = objectProto.toString;
/** Used to detect if a method is native. */
var reIsNative = RegExp('^' +
funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
);
/** Built-in value references. */
var Buffer = moduleExports ? root.Buffer : undefined,
Symbol = root.Symbol,
Uint8Array = root.Uint8Array,
propertyIsEnumerable = objectProto.propertyIsEnumerable,
splice = arrayProto.splice,
symToStringTag = Symbol ? Symbol.toStringTag : undefined;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeGetSymbols = Object.getOwnPropertySymbols,
nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
nativeKeys = overArg(Object.keys, Object);
/* Built-in method references that are verified to be native. */
var DataView = getNative(root, 'DataView'),
Map = getNative(root, 'Map'),
Promise = getNative(root, 'Promise'),
Set = getNative(root, 'Set'),
WeakMap = getNative(root, 'WeakMap'),
nativeCreate = getNative(Object, 'create');
/** Used to detect maps, sets, and weakmaps. */
var dataViewCtorString = toSource(DataView),
mapCtorString = toSource(Map),
promiseCtorString = toSource(Promise),
setCtorString = toSource(Set),
weakMapCtorString = toSource(WeakMap);
/** Used to convert symbols to primitives and strings. */
var symbolProto = Symbol ? Symbol.prototype : undefined,
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
/**
* Creates a hash object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Hash(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
/**
* Removes all key-value entries from the hash.
*
* @private
* @name clear
* @memberOf Hash
*/
function hashClear() {
this.__data__ = nativeCreate ? nativeCreate(null) : {};
this.size = 0;
}
/**
* Removes `key` and its value from the hash.
*
* @private
* @name delete
* @memberOf Hash
* @param {Object} hash The hash to modify.
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function hashDelete(key) {
var result = this.has(key) && delete this.__data__[key];
this.size -= result ? 1 : 0;
return result;
}
/**
* Gets the hash value for `key`.
*
* @private
* @name get
* @memberOf Hash
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function hashGet(key) {
var data = this.__data__;
if (nativeCreate) {
var result = data[key];
return result === HASH_UNDEFINED ? undefined : result;
}
return hasOwnProperty.call(data, key) ? data[key] : undefined;
}
/**
* Checks if a hash value for `key` exists.
*
* @private
* @name has
* @memberOf Hash
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function hashHas(key) {
var data = this.__data__;
return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
}
/**
* Sets the hash `key` to `value`.
*
* @private
* @name set
* @memberOf Hash
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the hash instance.
*/
function hashSet(key, value) {
var data = this.__data__;
this.size += this.has(key) ? 0 : 1;
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
return this;
}
// Add methods to `Hash`.
Hash.prototype.clear = hashClear;
Hash.prototype['delete'] = hashDelete;
Hash.prototype.get = hashGet;
Hash.prototype.has = hashHas;
Hash.prototype.set = hashSet;
/**
* Creates an list cache object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function ListCache(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
/**
* Removes all key-value entries from the list cache.
*
* @private
* @name clear
* @memberOf ListCache
*/
function listCacheClear() {
this.__data__ = [];
this.size = 0;
}
/**
* Removes `key` and its value from the list cache.
*
* @private
* @name delete
* @memberOf ListCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function listCacheDelete(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
if (index < 0) {
return false;
}
var lastIndex = data.length - 1;
if (index == lastIndex) {
data.pop();
} else {
splice.call(data, index, 1);
}
--this.size;
return true;
}
/**
* Gets the list cache value for `key`.
*
* @private
* @name get
* @memberOf ListCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function listCacheGet(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
return index < 0 ? undefined : data[index][1];
}
/**
* Checks if a list cache value for `key` exists.
*
* @private
* @name has
* @memberOf ListCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function listCacheHas(key) {
return assocIndexOf(this.__data__, key) > -1;
}
/**
* Sets the list cache `key` to `value`.
*
* @private
* @name set
* @memberOf ListCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the list cache instance.
*/
function listCacheSet(key, value) {
var data = this.__data__,
index = assocIndexOf(data, key);
if (index < 0) {
++this.size;
data.push([key, value]);
} else {
data[index][1] = value;
}
return this;
}
// Add methods to `ListCache`.
ListCache.prototype.clear = listCacheClear;
ListCache.prototype['delete'] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;
/**
* Creates a map cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function MapCache(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
/**
* Removes all key-value entries from the map.
*
* @private
* @name clear
* @memberOf MapCache
*/
function mapCacheClear() {
this.size = 0;
this.__data__ = {
'hash': new Hash,
'map': new (Map || ListCache),
'string': new Hash
};
}
/**
* Removes `key` and its value from the map.
*
* @private
* @name delete
* @memberOf MapCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function mapCacheDelete(key) {
var result = getMapData(this, key)['delete'](key);
this.size -= result ? 1 : 0;
return result;
}
/**
* Gets the map value for `key`.
*
* @private
* @name get
* @memberOf MapCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function mapCacheGet(key) {
return getMapData(this, key).get(key);
}
/**
* Checks if a map value for `key` exists.
*
* @private
* @name has
* @memberOf MapCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function mapCacheHas(key) {
return getMapData(this, key).has(key);
}
/**
* Sets the map `key` to `value`.
*
* @private
* @name set
* @memberOf MapCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the map cache instance.
*/
function mapCacheSet(key, value) {
var data = getMapData(this, key),
size = data.size;
data.set(key, value);
this.size += data.size == size ? 0 : 1;
return this;
}
// Add methods to `MapCache`.
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype['delete'] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;
/**
*
* Creates an array cache object to store unique values.
*
* @private
* @constructor
* @param {Array} [values] The values to cache.
*/
function SetCache(values) {
var index = -1,
length = values == null ? 0 : values.length;
this.__data__ = new MapCache;
while (++index < length) {
this.add(values[index]);
}
}
/**
* Adds `value` to the array cache.
*
* @private
* @name add
* @memberOf SetCache
* @alias push
* @param {*} value The value to cache.
* @returns {Object} Returns the cache instance.
*/
function setCacheAdd(value) {
this.__data__.set(value, HASH_UNDEFINED);
return this;
}
/**
* Checks if `value` is in the array cache.
*
* @private
* @name has
* @memberOf SetCache
* @param {*} value The value to search for.
* @returns {number} Returns `true` if `value` is found, else `false`.
*/
function setCacheHas(value) {
return this.__data__.has(value);
}
// Add methods to `SetCache`.
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
SetCache.prototype.has = setCacheHas;
/**
* Creates a stack cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Stack(entries) {
var data = this.__data__ = new ListCache(entries);
this.size = data.size;
}
/**
* Removes all key-value entries from the stack.
*
* @private
* @name clear
* @memberOf Stack
*/
function stackClear() {
this.__data__ = new ListCache;
this.size = 0;
}
/**
* Removes `key` and its value from the stack.
*
* @private
* @name delete
* @memberOf Stack
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function stackDelete(key) {
var data = this.__data__,
result = data['delete'](key);
this.size = data.size;
return result;
}
/**
* Gets the stack value for `key`.
*
* @private
* @name get
* @memberOf Stack
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function stackGet(key) {
return this.__data__.get(key);
}
/**
* Checks if a stack value for `key` exists.
*
* @private
* @name has
* @memberOf Stack
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function stackHas(key) {
return this.__data__.has(key);
}
/**
* Sets the stack `key` to `value`.
*
* @private
* @name set
* @memberOf Stack
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the stack cache instance.
*/
function stackSet(key, value) {
var data = this.__data__;
if (data instanceof ListCache) {
var pairs = data.__data__;
if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
pairs.push([key, value]);
this.size = ++data.size;
return this;
}
data = this.__data__ = new MapCache(pairs);
}
data.set(key, value);
this.size = data.size;
return this;
}
// Add methods to `Stack`.
Stack.prototype.clear = stackClear;
Stack.prototype['delete'] = stackDelete;
Stack.prototype.get = stackGet;
Stack.prototype.has = stackHas;
Stack.prototype.set = stackSet;
/**
* Creates an array of the enumerable property names of the array-like `value`.
*
* @private
* @param {*} value The value to query.
* @param {boolean} inherited Specify returning inherited property names.
* @returns {Array} Returns the array of property names.
*/
function arrayLikeKeys(value, inherited) {
var isArr = isArray(value),
isArg = !isArr && isArguments(value),
isBuff = !isArr && !isArg && isBuffer(value),
isType = !isArr && !isArg && !isBuff && isTypedArray(value),
skipIndexes = isArr || isArg || isBuff || isType,
result = skipIndexes ? baseTimes(value.length, String) : [],
length = result.length;
for (var key in value) {
if ((inherited || hasOwnProperty.call(value, key)) &&
!(skipIndexes && (
// Safari 9 has enumerable `arguments.length` in strict mode.
key == 'length' ||
// Node.js 0.10 has enumerable non-index properties on buffers.
(isBuff && (key == 'offset' || key == 'parent')) ||
// PhantomJS 2 has enumerable non-index properties on typed arrays.
(isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
// Skip index properties.
isIndex(key, length)
))) {
result.push(key);
}
}
return result;
}
/**
* Gets the index at which the `key` is found in `array` of key-value pairs.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} key The key to search for.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function assocIndexOf(array, key) {
var length = array.length;
while (length--) {
if (eq(array[length][0], key)) {
return length;
}
}
return -1;
}
/**
* The base implementation of `getAllKeys` and `getAllKeysIn` which uses
* `keysFunc` and `symbolsFunc` to get the enumerable property names and
* symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {Function} keysFunc The function to get the keys of `object`.
* @param {Function} symbolsFunc The function to get the symbols of `object`.
* @returns {Array} Returns the array of property names and symbols.
*/
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
var result = keysFunc(object);
return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
}
/**
* The base implementation of `getTag` without fallbacks for buggy environments.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
function baseGetTag(value) {
if (value == null) {
return value === undefined ? undefinedTag : nullTag;
}
return (symToStringTag && symToStringTag in Object(value))
? getRawTag(value)
: objectToString(value);
}
/**
* The base implementation of `_.isArguments`.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
*/
function baseIsArguments(value) {
return isObjectLike(value) && baseGetTag(value) == argsTag;
}
/**
* The base implementation of `_.isEqual` which supports partial comparisons
* and tracks traversed objects.
*
* @private
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @param {boolean} bitmask The bitmask flags.
* 1 - Unordered comparison
* 2 - Partial comparison
* @param {Function} [customizer] The function to customize comparisons.
* @param {Object} [stack] Tracks traversed `value` and `other` objects.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
*/
function baseIsEqual(value, other, bitmask, customizer, stack) {
if (value === other) {
return true;
}
if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
return value !== value && other !== other;
}
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
}
/**
* A specialized version of `baseIsEqual` for arrays and objects which performs
* deep comparisons and tracks traversed objects enabling objects with circular
* references to be compared.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
* @param {Function} customizer The function to customize comparisons.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Object} [stack] Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
var objIsArr = isArray(object),
othIsArr = isArray(other),
objTag = objIsArr ? arrayTag : getTag(object),
othTag = othIsArr ? arrayTag : getTag(other);
objTag = objTag == argsTag ? objectTag : objTag;
othTag = othTag == argsTag ? objectTag : othTag;
var objIsObj = objTag == objectTag,
othIsObj = othTag == objectTag,
isSameTag = objTag == othTag;
if (isSameTag && isBuffer(object)) {
if (!isBuffer(other)) {
return false;
}
objIsArr = true;
objIsObj = false;
}
if (isSameTag && !objIsObj) {
stack || (stack = new Stack);
return (objIsArr || isTypedArray(object))
? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
: equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
}
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
if (objIsWrapped || othIsWrapped) {
var objUnwrapped = objIsWrapped ? object.value() : object,
othUnwrapped = othIsWrapped ? other.value() : other;
stack || (stack = new Stack);
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
}
}
if (!isSameTag) {
return false;
}
stack || (stack = new Stack);
return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
}
/**
* The base implementation of `_.isNative` without bad shim checks.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a native function,
* else `false`.
*/
function baseIsNative(value) {
if (!isObject(value) || isMasked(value)) {
return false;
}
var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
return pattern.test(toSource(value));
}
/**
* The base implementation of `_.isTypedArray` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
*/
function baseIsTypedArray(value) {
return isObjectLike(value) &&
isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
}
/**
* The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function baseKeys(object) {
if (!isPrototype(object)) {
return nativeKeys(object);
}
var result = [];
for (var key in Object(object)) {
if (hasOwnProperty.call(object, key) && key != 'constructor') {
result.push(key);
}
}
return result;
}
/**
* A specialized version of `baseIsEqualDeep` for arrays with support for
* partial deep comparisons.
*
* @private
* @param {Array} array The array to compare.
* @param {Array} other The other array to compare.
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
* @param {Function} customizer The function to customize comparisons.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Object} stack Tracks traversed `array` and `other` objects.
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
*/
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
arrLength = array.length,
othLength = other.length;
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
return false;
}
// Assume cyclic values are equal.
var stacked = stack.get(array);
if (stacked && stack.get(other)) {
return stacked == other;
}
var index = -1,
result = true,
seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
stack.set(array, other);
stack.set(other, array);
// Ignore non-index properties.
while (++index < arrLength) {
var arrValue = array[index],
othValue = other[index];
if (customizer) {
var compared = isPartial
? customizer(othValue, arrValue, index, other, array, stack)
: customizer(arrValue, othValue, index, array, other, stack);
}
if (compared !== undefined) {
if (compared) {
continue;
}
result = false;
break;
}
// Recursively compare arrays (susceptible to call stack limits).
if (seen) {
if (!arraySome(other, function(othValue, othIndex) {
if (!cacheHas(seen, othIndex) &&
(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
return seen.push(othIndex);
}
})) {
result = false;
break;
}
} else if (!(
arrValue === othValue ||
equalFunc(arrValue, othValue, bitmask, customizer, stack)
)) {
result = false;
break;
}
}
stack['delete'](array);
stack['delete'](other);
return result;
}
/**
* A specialized version of `baseIsEqualDeep` for comparing objects of
* the same `toStringTag`.
*
* **Note:** This function only supports comparing values with tags of
* `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {string} tag The `toStringTag` of the objects to compare.
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
* @param {Function} customizer The function to customize comparisons.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Object} stack Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
switch (tag) {
case dataViewTag:
if ((object.byteLength != other.byteLength) ||
(object.byteOffset != other.byteOffset)) {
return false;
}
object = object.buffer;
other = other.buffer;
case arrayBufferTag:
if ((object.byteLength != other.byteLength) ||
!equalFunc(new Uint8Array(object), new Uint8Array(other))) {
return false;
}
return true;
case boolTag:
case dateTag:
case numberTag:
// Coerce booleans to `1` or `0` and dates to milliseconds.
// Invalid dates are coerced to `NaN`.
return eq(+object, +other);
case errorTag:
return object.name == other.name && object.message == other.message;
case regexpTag:
case stringTag:
// Coerce regexes to strings and treat strings, primitives and objects,
// as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
// for more details.
return object == (other + '');
case mapTag:
var convert = mapToArray;
case setTag:
var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
convert || (convert = setToArray);
if (object.size != other.size && !isPartial) {
return false;
}
// Assume cyclic values are equal.
var stacked = stack.get(object);
if (stacked) {
return stacked == other;
}
bitmask |= COMPARE_UNORDERED_FLAG;
// Recursively compare objects (susceptible to call stack limits).
stack.set(object, other);
var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
stack['delete'](object);
return result;
case symbolTag:
if (symbolValueOf) {
return symbolValueOf.call(object) == symbolValueOf.call(other);
}
}
return false;
}
/**
* A specialized version of `baseIsEqualDeep` for objects with support for
* partial deep comparisons.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
* @param {Function} customizer The function to customize comparisons.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Object} stack Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
objProps = getAllKeys(object),
objLength = objProps.length,
othProps = getAllKeys(other),
othLength = othProps.length;
if (objLength != othLength && !isPartial) {
return false;
}
var index = objLength;
while (index--) {
var key = objProps[index];
if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
return false;
}
}
// Assume cyclic values are equal.
var stacked = stack.get(object);
if (stacked && stack.get(other)) {
return stacked == other;
}
var result = true;
stack.set(object, other);
stack.set(other, object);
var skipCtor = isPartial;
while (++index < objLength) {
key = objProps[index];
var objValue = object[key],
othValue = other[key];
if (customizer) {
var compared = isPartial
? customizer(othValue, objValue, key, other, object, stack)
: customizer(objValue, othValue, key, object, other, stack);
}
// Recursively compare objects (susceptible to call stack limits).
if (!(compared === undefined
? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
: compared
)) {
result = false;
break;
}
skipCtor || (skipCtor = key == 'constructor');
}
if (result && !skipCtor) {
var objCtor = object.constructor,
othCtor = other.constructor;
// Non `Object` object instances with different constructors are not equal.
if (objCtor != othCtor &&
('constructor' in object && 'constructor' in other) &&
!(typeof objCtor == 'function' && objCtor instanceof objCtor &&
typeof othCtor == 'function' && othCtor instanceof othCtor)) {
result = false;
}
}
stack['delete'](object);
stack['delete'](other);
return result;
}
/**
* Creates an array of own enumerable property names and symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names and symbols.
*/
function getAllKeys(object) {
return baseGetAllKeys(object, keys, getSymbols);
}
/**
* Gets the data for `map`.
*
* @private
* @param {Object} map The map to query.
* @param {string} key The reference key.
* @returns {*} Returns the map data.
*/
function getMapData(map, key) {
var data = map.__data__;
return isKeyable(key)
? data[typeof key == 'string' ? 'string' : 'hash']
: data.map;
}
/**
* Gets the native function at `key` of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {string} key The key of the method to get.
* @returns {*} Returns the function if it's native, else `undefined`.
*/
function getNative(object, key) {
var value = getValue(object, key);
return baseIsNative(value) ? value : undefined;
}
/**
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the raw `toStringTag`.
*/
function getRawTag(value) {
var isOwn = hasOwnProperty.call(value, symToStringTag),
tag = value[symToStringTag];
try {
value[symToStringTag] = undefined;
var unmasked = true;
} catch (e) {}
var result = nativeObjectToString.call(value);
if (unmasked) {
if (isOwn) {
value[symToStringTag] = tag;
} else {
delete value[symToStringTag];
}
}
return result;
}
/**
* Creates an array of the own enumerable symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of symbols.
*/
var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
if (object == null) {
return [];
}
object = Object(object);
return arrayFilter(nativeGetSymbols(object), function(symbol) {
return propertyIsEnumerable.call(object, symbol);
});
};
/**
* Gets the `toStringTag` of `value`.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
var getTag = baseGetTag;
// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
(Map && getTag(new Map) != mapTag) ||
(Promise && getTag(Promise.resolve()) != promiseTag) ||
(Set && getTag(new Set) != setTag) ||
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
getTag = function(value) {
var result = baseGetTag(value),
Ctor = result == objectTag ? value.constructor : undefined,
ctorString = Ctor ? toSource(Ctor) : '';
if (ctorString) {
switch (ctorString) {
case dataViewCtorString: return dataViewTag;
case mapCtorString: return mapTag;
case promiseCtorString: return promiseTag;
case setCtorString: return setTag;
case weakMapCtorString: return weakMapTag;
}
}
return result;
};
}
/**
* Checks if `value` is a valid array-like index.
*
* @private
* @param {*} value The value to check.
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
*/
function isIndex(value, length) {
length = length == null ? MAX_SAFE_INTEGER : length;
return !!length &&
(typeof value == 'number' || reIsUint.test(value)) &&
(value > -1 && value % 1 == 0 && value < length);
}
/**
* Checks if `value` is suitable for use as unique object key.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
*/
function isKeyable(value) {
var type = typeof value;
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
? (value !== '__proto__')
: (value === null);
}
/**
* Checks if `func` has its source masked.
*
* @private
* @param {Function} func The function to check.
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
*/
function isMasked(func) {
return !!maskSrcKey && (maskSrcKey in func);
}
/**
* Checks if `value` is likely a prototype object.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
*/
function isPrototype(value) {
var Ctor = value && value.constructor,
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
return value === proto;
}
/**
* Converts `value` to a string using `Object.prototype.toString`.
*
* @private
* @param {*} value The value to convert.
* @returns {string} Returns the converted string.
*/
function objectToString(value) {
return nativeObjectToString.call(value);
}
/**
* Converts `func` to its source code.
*
* @private
* @param {Function} func The function to convert.
* @returns {string} Returns the source code.
*/
function toSource(func) {
if (func != null) {
try {
return funcToString.call(func);
} catch (e) {}
try {
return (func + '');
} catch (e) {}
}
return '';
}
/**
* Performs a
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* comparison between two values to determine if they are equivalent.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* var object = { 'a': 1 };
* var other = { 'a': 1 };
*
* _.eq(object, object);
* // => true
*
* _.eq(object, other);
* // => false
*
* _.eq('a', 'a');
* // => true
*
* _.eq('a', Object('a'));
* // => false
*
* _.eq(NaN, NaN);
* // => true
*/
function eq(value, other) {
return value === other || (value !== value && other !== other);
}
/**
* Checks if `value` is likely an `arguments` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
* else `false`.
* @example
*
* _.isArguments(function() { return arguments; }());
* // => true
*
* _.isArguments([1, 2, 3]);
* // => false
*/
var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
!propertyIsEnumerable.call(value, 'callee');
};
/**
* Checks if `value` is classified as an `Array` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
* @example
*
* _.isArray([1, 2, 3]);
* // => true
*
* _.isArray(document.body.children);
* // => false
*
* _.isArray('abc');
* // => false
*
* _.isArray(_.noop);
* // => false
*/
var isArray = Array.isArray;
/**
* Checks if `value` is array-like. A value is considered array-like if it's
* not a function and has a `value.length` that's an integer greater than or
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
* @example
*
* _.isArrayLike([1, 2, 3]);
* // => true
*
* _.isArrayLike(document.body.children);
* // => true
*
* _.isArrayLike('abc');
* // => true
*
* _.isArrayLike(_.noop);
* // => false
*/
function isArrayLike(value) {
return value != null && isLength(value.length) && !isFunction(value);
}
/**
* Checks if `value` is a buffer.
*
* @static
* @memberOf _
* @since 4.3.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
* @example
*
* _.isBuffer(new Buffer(2));
* // => true
*
* _.isBuffer(new Uint8Array(2));
* // => false
*/
var isBuffer = nativeIsBuffer || stubFalse;
/**
* Performs a deep comparison between two values to determine if they are
* equivalent.
*
* **Note:** This method supports comparing arrays, array buffers, booleans,
* date objects, error objects, maps, numbers, `Object` objects, regexes,
* sets, strings, symbols, and typed arrays. `Object` objects are compared
* by their own, not inherited, enumerable properties. Functions and DOM
* nodes are compared by strict equality, i.e. `===`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* var object = { 'a': 1 };
* var other = { 'a': 1 };
*
* _.isEqual(object, other);
* // => true
*
* object === other;
* // => false
*/
function isEqual(value, other) {
return baseIsEqual(value, other);
}
/**
* Checks if `value` is classified as a `Function` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
* @example
*
* _.isFunction(_);
* // => true
*
* _.isFunction(/abc/);
* // => false
*/
function isFunction(value) {
if (!isObject(value)) {
return false;
}
// The use of `Object#toString` avoids issues with the `typeof` operator
// in Safari 9 which returns 'object' for typed arrays and other constructors.
var tag = baseGetTag(value);
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
}
/**
* Checks if `value` is a valid array-like length.
*
* **Note:** This method is loosely based on
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
* @example
*
* _.isLength(3);
* // => true
*
* _.isLength(Number.MIN_VALUE);
* // => false
*
* _.isLength(Infinity);
* // => false
*
* _.isLength('3');
* // => false
*/
function isLength(value) {
return typeof value == 'number' &&
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}
/**
* Checks if `value` is the
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(_.noop);
* // => true
*
* _.isObject(null);
* // => false
*/
function isObject(value) {
var type = typeof value;
return value != null && (type == 'object' || type == 'function');
}
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike(value) {
return value != null && typeof value == 'object';
}
/**
* Checks if `value` is classified as a typed array.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
* @example
*
* _.isTypedArray(new Uint8Array);
* // => true
*
* _.isTypedArray([]);
* // => false
*/
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
/**
* Creates an array of the own enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects. See the
* [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
* for more details.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.keys(new Foo);
* // => ['a', 'b'] (iteration order is not guaranteed)
*
* _.keys('hi');
* // => ['0', '1']
*/
function keys(object) {
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
}
/**
* This method returns a new empty array.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {Array} Returns the new empty array.
* @example
*
* var arrays = _.times(2, _.stubArray);
*
* console.log(arrays);
* // => [[], []]
*
* console.log(arrays[0] === arrays[1]);
* // => false
*/
function stubArray() {
return [];
}
/**
* This method returns `false`.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {boolean} Returns `false`.
* @example
*
* _.times(2, _.stubFalse);
* // => [false, false]
*/
function stubFalse() {
return false;
}
module.exports = isEqual;
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{}],5:[function(require,module,exports){
// shim for using process in browser
var process = module.exports = {};
// cached from whatever global is present so that test runners that stub it
// don't break things. But we need to wrap it in a try catch in case it is
// wrapped in strict mode code which doesn't define any globals. It's inside a
// function because try/catches deoptimize in certain engines.
var cachedSetTimeout;
var cachedClearTimeout;
function defaultSetTimout() {
throw new Error('setTimeout has not been defined');
}
function defaultClearTimeout () {
throw new Error('clearTimeout has not been defined');
}
(function () {
try {
if (typeof setTimeout === 'function') {
cachedSetTimeout = setTimeout;
} else {
cachedSetTimeout = defaultSetTimout;
}
} catch (e) {
cachedSetTimeout = defaultSetTimout;
}
try {
if (typeof clearTimeout === 'function') {
cachedClearTimeout = clearTimeout;
} else {
cachedClearTimeout = defaultClearTimeout;
}
} catch (e) {
cachedClearTimeout = defaultClearTimeout;
}
} ())
function runTimeout(fun) {
if (cachedSetTimeout === setTimeout) {
//normal enviroments in sane situations
return setTimeout(fun, 0);
}
// if setTimeout wasn't available but was latter defined
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
cachedSetTimeout = setTimeout;
return setTimeout(fun, 0);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedSetTimeout(fun, 0);
} catch(e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedSetTimeout.call(null, fun, 0);
} catch(e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
return cachedSetTimeout.call(this, fun, 0);
}
}
}
function runClearTimeout(marker) {
if (cachedClearTimeout === clearTimeout) {
//normal enviroments in sane situations
return clearTimeout(marker);
}
// if clearTimeout wasn't available but was latter defined
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
cachedClearTimeout = clearTimeout;
return clearTimeout(marker);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedClearTimeout(marker);
} catch (e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedClearTimeout.call(null, marker);
} catch (e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
return cachedClearTimeout.call(this, marker);
}
}
}
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
if (!draining || !currentQueue) {
return;
}
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}
function drainQueue() {
if (draining) {
return;
}
var timeout = runTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
while (++queueIndex < len) {
if (currentQueue) {
currentQueue[queueIndex].run();
}
}
queueIndex = -1;
len = queue.length;
}
currentQueue = null;
draining = false;
runClearTimeout(timeout);
}
process.nextTick = function (fun) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
runTimeout(drainQueue);
}
};
// v8 likes predictible objects
function Item(fun, array) {
this.fun = fun;
this.array = array;
}
Item.prototype.run = function () {
this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.prependListener = noop;
process.prependOnceListener = noop;
process.listeners = function (name) { return [] }
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };
},{}],6:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
if (process.env.NODE_ENV !== 'production') {
var invariant = require('fbjs/lib/invariant');
var warning = require('fbjs/lib/warning');
var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');
var loggedTypeFailures = {};
}
/**
* Assert that the values match with the type specs.
* Error messages are memorized and will only be shown once.
*
* @param {object} typeSpecs Map of name to a ReactPropType
* @param {object} values Runtime values that need to be type-checked
* @param {string} location e.g. "prop", "context", "child context"
* @param {string} componentName Name of the component for error messages.
* @param {?Function} getStack Returns the component stack.
* @private
*/
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
if (process.env.NODE_ENV !== 'production') {
for (var typeSpecName in typeSpecs) {
if (typeSpecs.hasOwnProperty(typeSpecName)) {
var error;
// Prop type validation may throw. In case they do, we don't want to
// fail the render phase where it didn't fail before. So we log it.
// After these have been cleaned up, we'll let them throw.
try {
// This is intentionally an invariant that gets caught. It's the same
// behavior as without this statement except with a better message.
invariant(typeof typeSpecs[typeSpecName] === 'function', '%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;
}
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);
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
// Only monitor this failure once because there tends to be a lot of the
// same error.
loggedTypeFailures[error.message] = true;
var stack = getStack ? getStack() : '';
warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : '');
}
}
}
}
}
module.exports = checkPropTypes;
}).call(this,require('_process'))
},{"./lib/ReactPropTypesSecret":10,"_process":5,"fbjs/lib/invariant":2,"fbjs/lib/warning":3}],7:[function(require,module,exports){
/**
* Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
var emptyFunction = require('fbjs/lib/emptyFunction');
var invariant = require('fbjs/lib/invariant');
var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');
module.exports = function() {
function shim(props, propName, componentName, location, propFullName, secret) {
if (secret === ReactPropTypesSecret) {
// It is still safe when called from React.
return;
}
invariant(
false,
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
'Use PropTypes.checkPropTypes() to call them. ' +
'Read more at http://fb.me/use-check-prop-types'
);
};
shim.isRequired = shim;
function getShim() {
return shim;
};
// Important!
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
var ReactPropTypes = {
array: shim,
bool: shim,
func: shim,
number: shim,
object: shim,
string: shim,
symbol: shim,
any: shim,
arrayOf: getShim,
element: shim,
instanceOf: getShim,
node: shim,
objectOf: getShim,
oneOf: getShim,
oneOfType: getShim,
shape: getShim
};
ReactPropTypes.checkPropTypes = emptyFunction;
ReactPropTypes.PropTypes = ReactPropTypes;
return ReactPropTypes;
};
},{"./lib/ReactPropTypesSecret":10,"fbjs/lib/emptyFunction":1,"fbjs/lib/invariant":2}],8:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
var emptyFunction = require('fbjs/lib/emptyFunction');
var invariant = require('fbjs/lib/invariant');
var warning = require('fbjs/lib/warning');
var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');
var checkPropTypes = require('./checkPropTypes');
module.exports = function(isValidElement, throwOnDirectAccess) {
/* global Symbol */
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
/**
* Returns the iterator method function contained on the iterable object.
*
* Be sure to invoke the function with the iterable as context:
*
* var iteratorFn = getIteratorFn(myIterable);
* if (iteratorFn) {
* var iterator = iteratorFn.call(myIterable);
* ...
* }
*
* @param {?object} maybeIterable
* @return {?function}
*/
function getIteratorFn(maybeIterable) {
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
if (typeof iteratorFn === 'function') {
return iteratorFn;
}
}
/**
* Collection of methods that allow declaration and validation of props that are
* supplied to React components. Example usage:
*
* var Props = require('ReactPropTypes');
* var MyArticle = React.createClass({
* propTypes: {
* // An optional string prop named "description".
* description: Props.string,
*
* // A required enum prop named "category".
* category: Props.oneOf(['News','Photos']).isRequired,
*
* // A prop named "dialog" that requires an instance of Dialog.
* dialog: Props.instanceOf(Dialog).isRequired
* },
* render: function() { ... }
* });
*
* A more formal specification of how these methods are used:
*
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
* decl := ReactPropTypes.{type}(.isRequired)?
*
* Each and every declaration produces a function with the same signature. This
* allows the creation of custom validation functions. For example:
*
* var MyLink = React.createClass({
* propTypes: {
* // An optional string or URI prop named "href".
* href: function(props, propName, componentName) {
* var propValue = props[propName];
* if (propValue != null && typeof propValue !== 'string' &&
* !(propValue instanceof URI)) {
* return new Error(
* 'Expected a string or an URI for ' + propName + ' in ' +
* componentName
* );
* }
* }
* },
* render: function() {...}
* });
*
* @internal
*/
var ANONYMOUS = '<<anonymous>>';
// Important!
// Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
var ReactPropTypes = {
array: createPrimitiveTypeChecker('array'),
bool: createPrimitiveTypeChecker('boolean'),
func: createPrimitiveTypeChecker('function'),
number: createPrimitiveTypeChecker('number'),
object: createPrimitiveTypeChecker('object'),
string: createPrimitiveTypeChecker('string'),
symbol: createPrimitiveTypeChecker('symbol'),
any: createAnyTypeChecker(),
arrayOf: createArrayOfTypeChecker,
element: createElementTypeChecker(),
instanceOf: createInstanceTypeChecker,
node: createNodeChecker(),
objectOf: createObjectOfTypeChecker,
oneOf: createEnumTypeChecker,
oneOfType: createUnionTypeChecker,
shape: createShapeTypeChecker
};
/**
* inlined Object.is polyfill to avoid requiring consumers ship their own
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
*/
/*eslint-disable no-self-compare*/
function is(x, y) {
// SameValue algorithm
if (x === y) {
// Steps 1-5, 7-10
// Steps 6.b-6.e: +0 != -0
return x !== 0 || 1 / x === 1 / y;
} else {
// Step 6.a: NaN == NaN
return x !== x && y !== y;
}
}
/*eslint-enable no-self-compare*/
/**
* We use an Error-like object for backward compatibility as people may call
* PropTypes directly and inspect their output. However, we don't use real
* Errors anymore. We don't inspect their stack anyway, and creating them
* is prohibitively expensive if they are created too often, such as what
* happens in oneOfType() for any type before the one that matched.
*/
function PropTypeError(message) {
this.message = message;
this.stack = '';
}
// Make `instanceof Error` still work for returned errors.
PropTypeError.prototype = Error.prototype;
function createChainableTypeChecker(validate) {
if (process.env.NODE_ENV !== 'production') {
var manualPropTypeCallCache = {};
var manualPropTypeWarningCount = 0;
}
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
componentName = componentName || ANONYMOUS;
propFullName = propFullName || propName;
if (secret !== ReactPropTypesSecret) {
if (throwOnDirectAccess) {
// New behavior only for users of `prop-types` package
invariant(
false,
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
'Use `PropTypes.checkPropTypes()` to call them. ' +
'Read more at http://fb.me/use-check-prop-types'
);
} else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
// Old behavior for people using React.PropTypes
var cacheKey = componentName + ':' + propName;
if (
!manualPropTypeCallCache[cacheKey] &&
// Avoid spamming the console because they are often not actionable except for lib authors
manualPropTypeWarningCount < 3
) {
warning(
false,
'You are manually calling a React.PropTypes validation ' +
'function for the `%s` prop on `%s`. This is deprecated ' +
'and will throw in the standalone `prop-types` package. ' +
'You may be seeing this warning due to a third-party PropTypes ' +
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.',
propFullName,
componentName
);
manualPropTypeCallCache[cacheKey] = true;
manualPropTypeWarningCount++;
}
}
}
if (props[propName] == null) {
if (isRequired) {
if (props[propName] === null) {
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
}
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
}
return null;
} else {
return validate(props, propName, componentName, location, propFullName);
}
}
var chainedCheckType = checkType.bind(null, false);
chainedCheckType.isRequired = checkType.bind(null, true);
return chainedCheckType;
}
function createPrimitiveTypeChecker(expectedType) {
function validate(props, propName, componentName, location, propFullName, secret) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== expectedType) {
// `propValue` being instance of, say, date/regexp, pass the 'object'
// check, but we can offer a more precise error message here rather than
// 'of type `object`'.
var preciseType = getPreciseType(propValue);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createAnyTypeChecker() {
return createChainableTypeChecker(emptyFunction.thatReturnsNull);
}
function createArrayOfTypeChecker(typeChecker) {
function validate(props, propName, componentName, location, propFullName) {
if (typeof typeChecker !== 'function') {
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
}
var propValue = props[propName];
if (!Array.isArray(propValue)) {
var propType = getPropType(propValue);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
}
for (var i = 0; i < propValue.length; i++) {
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
if (error instanceof Error) {
return error;
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function createElementTypeChecker() {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
if (!isValidElement(propValue)) {
var propType = getPropType(propValue);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createInstanceTypeChecker(expectedClass) {
function validate(props, propName, componentName, location, propFullName) {
if (!(props[propName] instanceof expectedClass)) {
var expectedClassName = expectedClass.name || ANONYMOUS;
var actualClassName = getClassName(props[propName]);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createEnumTypeChecker(expectedValues) {
if (!Array.isArray(expectedValues)) {
process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0;
return emptyFunction.thatReturnsNull;
}
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
for (var i = 0; i < expectedValues.length; i++) {
if (is(propValue, expectedValues[i])) {
return null;
}
}
var valuesString = JSON.stringify(expectedValues);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
}
return createChainableTypeChecker(validate);
}
function createObjectOfTypeChecker(typeChecker) {
function validate(props, propName, componentName, location, propFullName) {
if (typeof typeChecker !== 'function') {
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
}
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
}
for (var key in propValue) {
if (propValue.hasOwnProperty(key)) {
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
if (error instanceof Error) {
return error;
}
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function createUnionTypeChecker(arrayOfTypeCheckers) {
if (!Array.isArray(arrayOfTypeCheckers)) {
process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
return emptyFunction.thatReturnsNull;
}
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
var checker = arrayOfTypeCheckers[i];
if (typeof checker !== 'function') {
warning(
false,
'Invalid argument supplid to oneOfType. Expected an array of check functions, but ' +
'received %s at index %s.',
getPostfixForTypeWarning(checker),
i
);
return emptyFunction.thatReturnsNull;
}
}
function validate(props, propName, componentName, location, propFullName) {
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
var checker = arrayOfTypeCheckers[i];
if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {
return null;
}
}
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
}
return createChainableTypeChecker(validate);
}
function createNodeChecker() {
function validate(props, propName, componentName, location, propFullName) {
if (!isNode(props[propName])) {
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createShapeTypeChecker(shapeTypes) {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
}
for (var key in shapeTypes) {
var checker = shapeTypes[key];
if (!checker) {
continue;
}
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
if (error) {
return error;
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function isNode(propValue) {
switch (typeof propValue) {
case 'number':
case 'string':
case 'undefined':
return true;
case 'boolean':
return !propValue;
case 'object':
if (Array.isArray(propValue)) {
return propValue.every(isNode);
}
if (propValue === null || isValidElement(propValue)) {
return true;
}
var iteratorFn = getIteratorFn(propValue);
if (iteratorFn) {
var iterator = iteratorFn.call(propValue);
var step;
if (iteratorFn !== propValue.entries) {
while (!(step = iterator.next()).done) {
if (!isNode(step.value)) {
return false;
}
}
} else {
// Iterator will provide entry [k,v] tuples rather than values.
while (!(step = iterator.next()).done) {
var entry = step.value;
if (entry) {
if (!isNode(entry[1])) {
return false;
}
}
}
}
} else {
return false;
}
return true;
default:
return false;
}
}
function isSymbol(propType, propValue) {
// Native Symbol.
if (propType === 'symbol') {
return true;
}
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
if (propValue['@@toStringTag'] === 'Symbol') {
return true;
}
// Fallback for non-spec compliant Symbols which are polyfilled.
if (typeof Symbol === 'function' && propValue instanceof Symbol) {
return true;
}
return false;
}
// Equivalent of `typeof` but with special handling for array and regexp.
function getPropType(propValue) {
var propType = typeof propValue;
if (Array.isArray(propValue)) {
return 'array';
}
if (propValue instanceof RegExp) {
// Old webkits (at least until Android 4.0) return 'function' rather than
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
// passes PropTypes.object.
return 'object';
}
if (isSymbol(propType, propValue)) {
return 'symbol';
}
return propType;
}
// This handles more types than `getPropType`. Only used for error messages.
// See `createPrimitiveTypeChecker`.
function getPreciseType(propValue) {
if (typeof propValue === 'undefined' || propValue === null) {
return '' + propValue;
}
var propType = getPropType(propValue);
if (propType === 'object') {
if (propValue instanceof Date) {
return 'date';
} else if (propValue instanceof RegExp) {
return 'regexp';
}
}
return propType;
}
// Returns a string that is postfixed to a warning about an invalid type.
// For example, "undefined" or "of type array"
function getPostfixForTypeWarning(value) {
var type = getPreciseType(value);
switch (type) {
case 'array':
case 'object':
return 'an ' + type;
case 'boolean':
case 'date':
case 'regexp':
return 'a ' + type;
default:
return type;
}
}
// Returns class name of the object, if any.
function getClassName(propValue) {
if (!propValue.constructor || !propValue.constructor.name) {
return ANONYMOUS;
}
return propValue.constructor.name;
}
ReactPropTypes.checkPropTypes = checkPropTypes;
ReactPropTypes.PropTypes = ReactPropTypes;
return ReactPropTypes;
};
}).call(this,require('_process'))
},{"./checkPropTypes":6,"./lib/ReactPropTypesSecret":10,"_process":5,"fbjs/lib/emptyFunction":1,"fbjs/lib/invariant":2,"fbjs/lib/warning":3}],9:[function(require,module,exports){
(function (process){
/**
* Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
if (process.env.NODE_ENV !== 'production') {
var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
Symbol.for &&
Symbol.for('react.element')) ||
0xeac7;
var isValidElement = function(object) {
return typeof object === 'object' &&
object !== null &&
object.$$typeof === REACT_ELEMENT_TYPE;
};
// By explicitly using `prop-types` you are opting into new development behavior.
// http://fb.me/prop-types-in-prod
var throwOnDirectAccess = true;
module.exports = require('./factoryWithTypeCheckers')(isValidElement, throwOnDirectAccess);
} else {
// By explicitly using `prop-types` you are opting into new production behavior.
// http://fb.me/prop-types-in-prod
module.exports = require('./factoryWithThrowingShims')();
}
}).call(this,require('_process'))
},{"./factoryWithThrowingShims":7,"./factoryWithTypeCheckers":8,"_process":5}],10:[function(require,module,exports){
/**
* Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
module.exports = ReactPropTypesSecret;
},{}],11:[function(require,module,exports){
(function (global){
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Chart = exports.defaults = exports.Scatter = exports.Bubble = exports.Polar = exports.Radar = exports.HorizontalBar = exports.Bar = exports.Line = exports.Pie = exports.Doughnut = undefined;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _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 _react = (typeof window !== "undefined" ? window['React'] : typeof global !== "undefined" ? global['React'] : null);
var _react2 = _interopRequireDefault(_react);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _chart = (typeof window !== "undefined" ? window['Chart'] : typeof global !== "undefined" ? global['Chart'] : null);
var _chart2 = _interopRequireDefault(_chart);
var _lodash = require('lodash.isequal');
var _lodash2 = _interopRequireDefault(_lodash);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
//Taken from MDN
if (!Array.prototype.find) {
Object.defineProperty(Array.prototype, 'find', {
value: function value(predicate) {
// 1. Let O be ? ToObject(this value).
if (this == null) {
throw new TypeError('"this" is null or not defined');
}
var o = Object(this);
// 2. Let len be ? ToLength(? Get(O, "length")).
var len = o.length >>> 0;
// 3. If IsCallable(predicate) is false, throw a TypeError exception.
if (typeof predicate !== 'function') {
throw new TypeError('predicate must be a function');
}
// 4. If thisArg was supplied, let T be thisArg; else let T be undefined.
var thisArg = arguments[1];
// 5. Let k be 0.
var k = 0;
// 6. Repeat, while k < len
while (k < len) {
// a. Let Pk be ! ToString(k).
// b. Let kValue be ? Get(O, Pk).
// c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
// d. If testResult is true, return kValue.
var kValue = o[k];
if (predicate.call(thisArg, kValue, k, o)) {
return kValue;
}
// e. Increase k by 1.
k++;
}
// 7. Return undefined.
return undefined;
}
});
}
var ChartComponent = function (_React$Component) {
_inherits(ChartComponent, _React$Component);
function ChartComponent() {
var _ref;
var _temp, _this, _ret;
_classCallCheck(this, ChartComponent);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = ChartComponent.__proto__ || Object.getPrototypeOf(ChartComponent)).call.apply(_ref, [this].concat(args))), _this), _this.handleOnClick = function (event) {
var instance = _this.chart_instance;
var _this$props = _this.props,
getDatasetAtEvent = _this$props.getDatasetAtEvent,
getElementAtEvent = _this$props.getElementAtEvent,
getElementsAtEvent = _this$props.getElementsAtEvent,
onElementsClick = _this$props.onElementsClick;
getDatasetAtEvent && getDatasetAtEvent(instance.getDatasetAtEvent(event), event);
getElementAtEvent && getElementAtEvent(instance.getElementAtEvent(event), event);
getElementsAtEvent && getElementsAtEvent(instance.getElementsAtEvent(event), event);
onElementsClick && onElementsClick(instance.getElementsAtEvent(event), event); // Backward compatibility
}, _this.ref = function (element) {
_this.element = element;
}, _temp), _possibleConstructorReturn(_this, _ret);
}
_createClass(ChartComponent, [{
key: 'componentWillMount',
value: function componentWillMount() {
this.chart_instance = undefined;
}
}, {
key: 'componentDidMount',
value: function componentDidMount() {
this.renderChart();
}
}, {
key: 'componentDidUpdate',
value: function componentDidUpdate() {
if (this.props.redraw) {
this.chart_instance.destroy();
this.renderChart();
return;
}
this.updateChart();
}
}, {
key: 'shouldComponentUpdate',
value: function shouldComponentUpdate(nextProps) {
var _props = this.props,
redraw = _props.redraw,
type = _props.type,
options = _props.options,
plugins = _props.plugins,
legend = _props.legend,
height = _props.height,
width = _props.width;
if (nextProps.redraw === true) {
return true;
}
if (height !== nextProps.height || width !== nextProps.width) {
return true;
}
if (type !== nextProps.type) {
return true;
}
if (!(0, _lodash2.default)(legend, nextProps.legend)) {
return true;
}
if (!(0, _lodash2.default)(options, nextProps.options)) {
return true;
}
var nextData = this.transformDataProp(nextProps);
if (!(0, _lodash2.default)(this.shadowDataProp, nextData)) {
return true;
}
return !(0, _lodash2.default)(plugins, nextProps.plugins);
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
this.chart_instance.destroy();
}
}, {
key: 'transformDataProp',
value: function transformDataProp(props) {
var data = props.data;
if (typeof data == 'function') {
var node = this.element;
return data(node);
} else {
return data;
}
}
// Chart.js directly mutates the data.dataset objects by adding _meta proprerty
// this makes impossible to compare the current and next data changes
// therefore we memoize the data prop while sending a fake to Chart.js for mutation.
// see https://github.com/chartjs/Chart.js/blob/master/src/core/core.controller.js#L615-L617
}, {
key: 'memoizeDataProps',
value: function memoizeDataProps() {
if (!this.props.data) {
return;
}
var data = this.transformDataProp(this.props);
this.shadowDataProp = _extends({}, data, {
datasets: data.datasets && data.datasets.map(function (set) {
return _extends({}, set);
})
});
return data;
}
}, {
key: 'updateChart',
value: function updateChart() {
var _this2 = this;
var options = this.props.options;
var data = this.memoizeDataProps(this.props);
if (!this.chart_instance) return;
if (options) {
this.chart_instance.options = _chart2.default.helpers.configMerge(this.chart_instance.options, options);
}
// Pipe datasets to chart instance datasets enabling
// seamless transitions
var currentDatasets = this.chart_instance.config.data && this.chart_instance.config.data.datasets || [];
var nextDatasets = data.datasets || [];
// use the key provider to work out which series have been added/removed/changed
var currentDatasetKeys = currentDatasets.map(this.props.datasetKeyProvider);
var nextDatasetKeys = nextDatasets.map(this.props.datasetKeyProvider);
var newDatasets = nextDatasets.filter(function (d) {
return currentDatasetKeys.indexOf(_this2.props.datasetKeyProvider(d)) === -1;
});
// process the updates (via a reverse for loop so we can safely splice deleted datasets out of the array
var _loop = function _loop(idx) {
var currentDatasetKey = _this2.props.datasetKeyProvider(currentDatasets[idx]);
if (nextDatasetKeys.indexOf(currentDatasetKey) === -1) {
// deleted series
currentDatasets.splice(idx, 1);
} else {
var retainedDataset = nextDatasets.find(function (d) {
return _this2.props.datasetKeyProvider(d) === currentDatasetKey;
});
if (retainedDataset) {
// update it in place if it is a retained dataset
currentDatasets[idx].data.splice(retainedDataset.data.length);
retainedDataset.data.forEach(function (point, pid) {
currentDatasets[idx].data[pid] = retainedDataset.data[pid];
});
var _data = retainedDataset.data,
otherProps = _objectWithoutProperties(retainedDataset, ['data']);
currentDatasets[idx] = _extends({
data: currentDatasets[idx].data
}, currentDatasets[idx], otherProps);
}
}
};
for (var idx = currentDatasets.length - 1; idx >= 0; idx -= 1) {
_loop(idx);
}
// finally add any new series
newDatasets.forEach(function (d) {
return currentDatasets.push(d);
});
var datasets = data.datasets,
rest = _objectWithoutProperties(data, ['datasets']);
this.chart_instance.config.data = _extends({}, this.chart_instance.config.data, rest);
this.chart_instance.update();
}
}, {
key: 'renderChart',
value: function renderChart() {
var _props2 = this.props,
options = _props2.options,
legend = _props2.legend,
type = _props2.type,
redraw = _props2.redraw,
plugins = _props2.plugins;
var node = this.element;
var data = this.memoizeDataProps();
if (typeof legend !== 'undefined' && !(0, _lodash2.default)(ChartComponent.defaultProps.legend, legend)) {
options.legend = legend;
}
this.chart_instance = new _chart2.default(node, {
type: type,
data: data,
options: options,
plugins: plugins
});
}
}, {
key: 'render',
value: function render() {
var _props3 = this.props,
height = _props3.height,
width = _props3.width,
onElementsClick = _props3.onElementsClick;
return _react2.default.createElement('canvas', {
ref: this.ref,
height: height,
width: width,
onClick: this.handleOnClick
});
}
}]);
return ChartComponent;
}(_react2.default.Component);
ChartComponent.getLabelAsKey = function (d) {
return d.label;
};
ChartComponent.propTypes = {
data: _propTypes2.default.oneOfType([_propTypes2.default.object, _propTypes2.default.func]).isRequired,
getDatasetAtEvent: _propTypes2.default.func,
getElementAtEvent: _propTypes2.default.func,
getElementsAtEvent: _propTypes2.default.func,
height: _propTypes2.default.number,
legend: _propTypes2.default.object,
onElementsClick: _propTypes2.default.func,
options: _propTypes2.default.object,
plugins: _propTypes2.default.arrayOf(_propTypes2.default.object),
redraw: _propTypes2.default.bool,
type: function type(props, propName, componentName) {
if (!Object.keys(_chart2.default.controllers).find(function (chartType) {
return chartType === props[propName];
})) {
return new Error('Invalid chart type `' + props[propName] + '` supplied to' + ' `' + componentName + '`.');
}
},
width: _propTypes2.default.number,
datasetKeyProvider: _propTypes2.default.func
};
ChartComponent.defaultProps = {
legend: {
display: true,
position: 'bottom'
},
type: 'doughnut',
height: 150,
width: 300,
redraw: false,
options: {},
datasetKeyProvider: ChartComponent.getLabelAsKey
};
exports.default = ChartComponent;
var Doughnut = exports.Doughnut = function (_React$Component2) {
_inherits(Doughnut, _React$Component2);
function Doughnut() {
_classCallCheck(this, Doughnut);
return _possibleConstructorReturn(this, (Doughnut.__proto__ || Object.getPrototypeOf(Doughnut)).apply(this, arguments));
}
_createClass(Doughnut, [{
key: 'render',
value: function render() {
var _this4 = this;
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref2) {
return _this4.chart_instance = _ref2 && _ref2.chart_instance;
},
type: 'doughnut'
}));
}
}]);
return Doughnut;
}(_react2.default.Component);
var Pie = exports.Pie = function (_React$Component3) {
_inherits(Pie, _React$Component3);
function Pie() {
_classCallCheck(this, Pie);
return _possibleConstructorReturn(this, (Pie.__proto__ || Object.getPrototypeOf(Pie)).apply(this, arguments));
}
_createClass(Pie, [{
key: 'render',
value: function render() {
var _this6 = this;
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref3) {
return _this6.chart_instance = _ref3 && _ref3.chart_instance;
},
type: 'pie'
}));
}
}]);
return Pie;
}(_react2.default.Component);
var Line = exports.Line = function (_React$Component4) {
_inherits(Line, _React$Component4);
function Line() {
_classCallCheck(this, Line);
return _possibleConstructorReturn(this, (Line.__proto__ || Object.getPrototypeOf(Line)).apply(this, arguments));
}
_createClass(Line, [{
key: 'render',
value: function render() {
var _this8 = this;
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref4) {
return _this8.chart_instance = _ref4 && _ref4.chart_instance;
},
type: 'line'
}));
}
}]);
return Line;
}(_react2.default.Component);
var Bar = exports.Bar = function (_React$Component5) {
_inherits(Bar, _React$Component5);
function Bar() {
_classCallCheck(this, Bar);
return _possibleConstructorReturn(this, (Bar.__proto__ || Object.getPrototypeOf(Bar)).apply(this, arguments));
}
_createClass(Bar, [{
key: 'render',
value: function render() {
var _this10 = this;
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref5) {
return _this10.chart_instance = _ref5 && _ref5.chart_instance;
},
type: 'bar'
}));
}
}]);
return Bar;
}(_react2.default.Component);
var HorizontalBar = exports.HorizontalBar = function (_React$Component6) {
_inherits(HorizontalBar, _React$Component6);
function HorizontalBar() {
_classCallCheck(this, HorizontalBar);
return _possibleConstructorReturn(this, (HorizontalBar.__proto__ || Object.getPrototypeOf(HorizontalBar)).apply(this, arguments));
}
_createClass(HorizontalBar, [{
key: 'render',
value: function render() {
var _this12 = this;
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref6) {
return _this12.chart_instance = _ref6 && _ref6.chart_instance;
},
type: 'horizontalBar'
}));
}
}]);
return HorizontalBar;
}(_react2.default.Component);
var Radar = exports.Radar = function (_React$Component7) {
_inherits(Radar, _React$Component7);
function Radar() {
_classCallCheck(this, Radar);
return _possibleConstructorReturn(this, (Radar.__proto__ || Object.getPrototypeOf(Radar)).apply(this, arguments));
}
_createClass(Radar, [{
key: 'render',
value: function render() {
var _this14 = this;
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref7) {
return _this14.chart_instance = _ref7 && _ref7.chart_instance;
},
type: 'radar'
}));
}
}]);
return Radar;
}(_react2.default.Component);
var Polar = exports.Polar = function (_React$Component8) {
_inherits(Polar, _React$Component8);
function Polar() {
_classCallCheck(this, Polar);
return _possibleConstructorReturn(this, (Polar.__proto__ || Object.getPrototypeOf(Polar)).apply(this, arguments));
}
_createClass(Polar, [{
key: 'render',
value: function render() {
var _this16 = this;
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref8) {
return _this16.chart_instance = _ref8 && _ref8.chart_instance;
},
type: 'polarArea'
}));
}
}]);
return Polar;
}(_react2.default.Component);
var Bubble = exports.Bubble = function (_React$Component9) {
_inherits(Bubble, _React$Component9);
function Bubble() {
_classCallCheck(this, Bubble);
return _possibleConstructorReturn(this, (Bubble.__proto__ || Object.getPrototypeOf(Bubble)).apply(this, arguments));
}
_createClass(Bubble, [{
key: 'render',
value: function render() {
var _this18 = this;
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref9) {
return _this18.chart_instance = _ref9 && _ref9.chart_instance;
},
type: 'bubble'
}));
}
}]);
return Bubble;
}(_react2.default.Component);
var Scatter = exports.Scatter = function (_React$Component10) {
_inherits(Scatter, _React$Component10);
function Scatter() {
_classCallCheck(this, Scatter);
return _possibleConstructorReturn(this, (Scatter.__proto__ || Object.getPrototypeOf(Scatter)).apply(this, arguments));
}
_createClass(Scatter, [{
key: 'render',
value: function render() {
var _this20 = this;
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
ref: function ref(_ref10) {
return _this20.chart_instance = _ref10 && _ref10.chart_instance;
},
type: 'scatter'
}));
}
}]);
return Scatter;
}(_react2.default.Component);
var defaults = exports.defaults = _chart2.default.defaults;
exports.Chart = _chart2.default;
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"lodash.isequal":4,"prop-types":9}]},{},[11])(11)
});
|
js/vendor/jquery-1.11.1.min.js
|
entepe85/turbomotor.rocks
|
/*! 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});
|
src/routes/Configs/components/Configs.js
|
TheModevShop/craft-app
|
import React from 'react';
import AddConfig from 'components/AddConfig/AddConfig.js'
import _ from 'lodash';
import {Link} from 'react-router';
import './configs.less';
class Configs extends React.Component {
constructor(...args) {
super(...args);
this.state = {
};
}
componentDidMount() {
const resourceId = _.get(this.props.membership, 'membership_id');
if (resourceId && _.get(this.props.membership, 'membership_type') === 'resource') {
this.props.getConfigsForResource(resourceId);
}
}
render() {
const {membership} = this.props;
return (
<div className="configs-page-wrapper page-wrapper">
{
!_.get(this.props.configs, 'items.length') ?
<div className="banner card">
<span>
<h2 className="bold" style={{marginTop: '5px'}}>Linking Your First Report.</h2>
<h5 style={{maxWidth: 500}}>Linking a report configuration to your current distribution data allows us to automatically map where your products can be found. After you link the report, you will then setup the fields.</h5>
<h5 style={{margin: '20px 0 20px 0'}}><a className="secondary-link" target="_blank" href="https://docs.google.com/document/d/1c_ltkjJCpVcaCVIaJFY7GtETHGg2ZvxLnJtI4nkJlGM/edit?usp=sharing">HOW TO SETUP YOUR REPORT (encompass users only)</a></h5>
<h4 style={{marginBottom: '10px'}}></h4>
</span>
{
!this.state.showForm ?
<button style={{minWidth: '210px', marginLeft: '0px'}} className="primary-btn-large" onClick={() => this.setState({showForm: !this.state.showForm})}>
Add Your First Report Config
</button> : null
}
</div> : null
}
<div className="add-a-config">
{
_.get(this.props.configs, 'items.length') && !_.find(_.get(this.props.configs, 'items'), (item) => item.vip_id) ?
<div className="dotted-button" onClick={() => this.setState({showForm: !this.state.showForm})}>
<span className="plus"></span>
<span>{!this.state.showForm ? 'Add a New Report' : 'Hide Report Form'}</span>
</div> : null
}
{
this.state.showForm ?
<AddConfig hideForm={() => this.setState({showForm: false})} {...this.props} membership={membership} /> : null
}
</div>
{
_.map(_.orderBy(_.take(_.get(this.props.configs, 'items', []), 100), 'created_at', 'desc'), (c, i) => {
return (
<div className="card" key={i}>
<Link className="secondary-link" to={`/admin/configs/${c.id}`}>
<h4 className="bold">{c.report_name}</h4>
<h4>{c.distribution_platform}</h4>
<h4>{c.report_url}</h4>
{
c.new ?
<h4 className="tag">new</h4> : null
}
</Link>
</div>
)
})
}
</div>
);
}
}
Configs.propTypes = {
membership: React.PropTypes.object.isRequired,
configs: React.PropTypes.object,
getConfigsForResource: React.PropTypes.func.isRequired,
};
export default Configs;
|
5.2.1/src/components/DevTools.js
|
erikras/redux-form-docs
|
import React from 'react'
import { createDevTools } from 'redux-devtools'
import LogMonitor from 'redux-devtools-log-monitor'
import DockMonitor from 'redux-devtools-dock-monitor'
import { toggleVisibilityKey, changePositionKey } from './devToolsConfig'
export default createDevTools(
<DockMonitor
{...{ toggleVisibilityKey, changePositionKey }}
defaultIsVisible={false}
defaultPosition="right">
<LogMonitor/>
</DockMonitor>
)
|
STAR.Originations.MegaRunbook.Website/app/components/applications/ApplicationSearch.js
|
DaveStoneDotNet/React.MegaRunbookCreator
|
import React from 'react'
import PropTypes from 'prop-types';
import _ from 'lodash';
import MrcDropDownButton from '../common/MrcDropDownButton'
import DebouncedInput from '../common/DebouncedInput'
class ApplicationSearch extends React.Component {
constructor(props, context) {
super(props, context)
this.appNameRef = null
this.initializeAppNameRef = this.initializeAppNameRef.bind(this)
}
componentWillMount () {
}
componentDidMount () {
}
componentWillUnmount() {
}
componentDidUpdate() {
if (this.appNameRef) {
this.appNameRef.focus();
}
}
initializeAppNameRef(c) {
this.appNameRef = c;
}
render() {
const {
applicationName,
applicationGroups,
applicationTypes,
selectAppGroup,
selectAppType,
clearSelections,
onAppNameChange
} = this.props
return (
<div className="mrc-forms">
<table>
<tbody>
<tr>
<td className="td">
<DebouncedInput value={applicationName}
minLength={2}
debounceTimeout={500}
className="width-100"
onChange={e => onAppNameChange(e.target.value)}
inputRef={this.initializeAppNameRef}
autoFocus /><br/>
</td>
<td>
<MrcDropDownButton title="Groups" lookups={applicationGroups} onSelect={selectAppGroup} />
</td>
<td>
<MrcDropDownButton title="Types" lookups={applicationTypes} onSelect={selectAppType} />
</td>
<td>
<div>
<button className="btn btn-sm btn-primary" onClick={clearSelections}>Clear</button>
</div>
</td>
</tr>
</tbody>
</table>
</div>
)
}
}
ApplicationSearch.propTypes = {
applicationGroups: PropTypes.arrayOf(PropTypes.shape({ Code: PropTypes.string, Description: PropTypes.string, active: PropTypes.bool })).isRequired,
applicationTypes: PropTypes.arrayOf(PropTypes.shape({ Code: PropTypes.string, Description: PropTypes.string, active: PropTypes.bool })).isRequired,
selectAppGroup: PropTypes.func,
selectAppType: PropTypes.func,
clearSelections: PropTypes.func
}
export default ApplicationSearch
|
src/main.js
|
nchathu2014/reactApp
|
import React from 'react';
import ReactDOM from 'react-dom';
import App from './components/App';
ReactDOM.render(
<App/>,
document.getElementById('container')
);
setTimeout(()=>{
ReactDOM.unmountComponentAtNode(
document.getElementById('container')
)
},11100000);
|
actor-apps/app-web/src/app/components/modals/AppCacheUpdate.react.js
|
webwlsong/actor-platform
|
import React from 'react';
import Modal from 'react-modal';
//import pureRender from 'pure-render-decorator';
import { Styles, FlatButton } from 'material-ui';
import AppCacheStore from 'stores/AppCacheStore';
import AppCacheActionCreators from 'actions/AppCacheActionCreators';
import { KeyCodes } from 'constants/ActorAppConstants';
import ActorTheme from 'constants/ActorTheme';
const ThemeManager = new Styles.ThemeManager();
const appElement = document.getElementById('actor-web-app');
Modal.setAppElement(appElement);
const getStateFromStores = () => {
return {
isShown: AppCacheStore.isModalOpen()
};
};
class AddContact extends React.Component {
static childContextTypes = {
muiTheme: React.PropTypes.object
};
getChildContext() {
return {
muiTheme: ThemeManager.getCurrentTheme()
};
}
constructor(props) {
super(props);
this.state = getStateFromStores();
AppCacheStore.addChangeListener(this.onChange);
document.addEventListener('keydown', this.onKeyDown, false);
ThemeManager.setTheme(ActorTheme);
}
componentWillUnmount() {
AppCacheStore.removeChangeListener(this.onChange);
document.removeEventListener('keydown', this.onKeyDown, false);
}
render() {
return (
<Modal className="modal-new modal-new--update"
closeTimeoutMS={150}
isOpen={this.state.isShown}
style={{width: 400}}>
<div className="modal-new__body">
<h1>Update available</h1>
<h3>New version of Actor Web App available.</h3>
<p>It's already downloaded to your browser, you just need to reload tab.</p>
</div>
<footer className="modal-new__footer text-right">
<FlatButton hoverColor="rgba(74,144,226,.12)"
label="Cancel"
onClick={this.onClose}
secondary={true} />
<FlatButton hoverColor="rgba(74,144,226,.12)"
label="Reload"
onClick={this.onConfirm}
secondary={true} />
</footer>
</Modal>
);
}
onClose = () => {
AppCacheActionCreators.closeModal();
}
onConfirm = () => {
AppCacheActionCreators.confirmUpdate();
}
onChange = () => {
this.setState(getStateFromStores());
}
onKeyDown = (event) => {
if (event.keyCode === KeyCodes.ESC) {
event.preventDefault();
this.onClose();
}
}
}
export default AddContact;
|
tests/components/Spinner.spec.js
|
voicebase/voicebase-end-user-experience
|
import React from 'react';
import { shallowRender } from '../../app/common/Test'
import { Spinner } from '../../app/components/Spinner'
describe('Spinner component', function () {
let component;
it('should render component in div container', function() {
component = shallowRender(<Spinner />);
assert.equal(component.type, 'div');
});
it('should render component with class item-medium ', function() {
component = shallowRender(<Spinner isMediumItem/>);
assert.equal(component.props.className, 'spinner item-medium');
});
it('should render component with class item-small ', function() {
component = shallowRender(<Spinner isSmallItem/>);
assert.equal(component.props.className, 'spinner item-small');
});
});
|
ajax/libs/react-router/0.5.0/react-router.js
|
mikelambert/cdnjs
|
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.ReactRouter=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null);
var warning = _dereq_('react/lib/warning');
function Router(route) {
warning(
false,
'The Router(<Route>).renderComponent(container) interface is deprecated and ' +
'will be removed soon. Use React.renderComponent(<Route>, container) instead'
);
return {
renderComponent: function (container, callback) {
return React.renderComponent(route, container, callback);
}
};
}
module.exports = Router;
},{"react/lib/warning":51}],2:[function(_dereq_,module,exports){
var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null);
var ActiveState = _dereq_('../mixins/ActiveState');
var withoutProperties = _dereq_('../helpers/withoutProperties');
var transitionTo = _dereq_('../helpers/transitionTo');
var makeHref = _dereq_('../helpers/makeHref');
/**
* A map of <Link> component props that are reserved for use by the
* router and/or React. All other props are used as params that are
* interpolated into the link's path.
*/
var RESERVED_PROPS = {
to: true,
className: true,
activeClassName: true,
query: true,
children: true // ReactChildren
};
/**
* <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" postId="123"/>
*
* In addition to params, links may pass along query string parameters
* using the `query` prop.
*
* <Link to="showPost" postId="123" query={{show:true}}/>
*/
var Link = React.createClass({
displayName: 'Link',
mixins: [ ActiveState ],
statics: {
getUnreservedProps: function (props) {
return withoutProperties(props, RESERVED_PROPS);
}
},
propTypes: {
to: React.PropTypes.string.isRequired,
activeClassName: React.PropTypes.string.isRequired,
query: React.PropTypes.object
},
getDefaultProps: function () {
return {
activeClassName: 'active'
};
},
getInitialState: function () {
return {
isActive: false
};
},
/**
* Returns a hash of URL parameters to use in this <Link>'s path.
*/
getParams: function () {
return Link.getUnreservedProps(this.props);
},
/**
* Returns the value of the "href" attribute to use on the DOM element.
*/
getHref: function () {
return makeHref(this.props.to, this.getParams(), this.props.query);
},
/**
* 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.
*/
getClassName: function () {
var className = this.props.className || '';
if (this.state.isActive)
return className + ' ' + this.props.activeClassName;
return className;
},
componentWillReceiveProps: function (nextProps) {
var params = Link.getUnreservedProps(nextProps);
this.setState({
isActive: Link.isActive(nextProps.to, params, nextProps.query)
});
},
updateActiveState: function () {
this.setState({
isActive: Link.isActive(this.props.to, this.getParams(), this.props.query)
});
},
handleClick: function (event) {
if (isModifiedEvent(event))
return;
event.preventDefault();
transitionTo(this.props.to, this.getParams(), this.props.query);
},
render: function () {
var props = {
href: this.getHref(),
className: this.getClassName(),
onClick: this.handleClick
};
return React.DOM.a(props, this.props.children);
}
});
function isModifiedEvent(event) {
return !!(event.metaKey || event.ctrlKey || event.shiftKey);
}
module.exports = Link;
},{"../helpers/makeHref":8,"../helpers/transitionTo":12,"../helpers/withoutProperties":13,"../mixins/ActiveState":15}],3:[function(_dereq_,module,exports){
var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null);
var withoutProperties = _dereq_('../helpers/withoutProperties');
/**
* A map of <Route> component props that are reserved for use by the
* router and/or React. All other props are considered "static" and
* are passed through to the route handler.
*/
var RESERVED_PROPS = {
handler: true,
name: true,
path: true,
children: true // ReactChildren
};
/**
* <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.
*
* Unlike Ember, a nested route's path does not build upon that of its parents.
* This may seem like it creates more work up front in specifying URLs, but it
* has the nice benefit of decoupling nested UI from "nested" URLs.
*
* 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.
*
* React.renderComponent((
* <Routes handler={App}>
* <Route name="login" handler={Login}/>
* <Route name="logout" handler={Logout}/>
* <Route name="about" handler={About}/>
* </Routes>
* ), document.body);
*
* If you don't use JSX, you can also assemble a Router programmatically using
* the standard React component JavaScript API.
*
* React.renderComponent((
* Routes({ handler: App },
* Route({ name: 'login', handler: Login }),
* Route({ name: 'logout', handler: Logout }),
* Route({ name: 'about', handler: About })
* )
* ), document.body);
*
* Handlers for Route components that contain children can render their active
* child route using the activeRouteHandler prop.
*
* var App = React.createClass({
* render: function () {
* return (
* <div class="application">
* {this.props.activeRouteHandler()}
* </div>
* );
* }
* });
*/
var Route = React.createClass({
displayName: 'Route',
statics: {
getUnreservedProps: function (props) {
return withoutProperties(props, RESERVED_PROPS);
},
},
propTypes: {
handler: React.PropTypes.any.isRequired,
path: React.PropTypes.string,
name: React.PropTypes.string
},
render: function () {
throw new Error(
'The <Route> component should not be rendered directly. You may be ' +
'missing a <Routes> wrapper around your list of routes.');
}
});
module.exports = Route;
},{"../helpers/withoutProperties":13}],4:[function(_dereq_,module,exports){
var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null);
var warning = _dereq_('react/lib/warning');
var ExecutionEnvironment = _dereq_('react/lib/ExecutionEnvironment');
var mergeProperties = _dereq_('../helpers/mergeProperties');
var goBack = _dereq_('../helpers/goBack');
var replaceWith = _dereq_('../helpers/replaceWith');
var transitionTo = _dereq_('../helpers/transitionTo');
var withoutProperties = _dereq_('../helpers/withoutProperties');
var Route = _dereq_('../components/Route');
var Path = _dereq_('../helpers/Path');
var ActiveStore = _dereq_('../stores/ActiveStore');
var RouteStore = _dereq_('../stores/RouteStore');
var URLStore = _dereq_('../stores/URLStore');
var Promise = _dereq_('es6-promise').Promise;
/**
* The ref name that can be used to reference the active route component.
*/
var REF_NAME = '__activeRoute__';
/**
* The <Routes> component configures the route hierarchy and renders the
* route matching the current location when rendered into a document.
*
* See the <Route> component for more details.
*/
var Routes = React.createClass({
displayName: 'Routes',
statics: {
getUnreservedProps: function (props) {
return withoutProperties(props, RESERVED_PROPS);
},
/**
* Handles errors that were thrown asynchronously. By default, the
* error is re-thrown so we don't swallow them silently.
*/
handleAsyncError: function (error, route) {
throw error; // This error probably originated in a transition hook.
},
/**
* Handles cancelled transitions. By default, redirects replace the
* current URL and aborts roll it back.
*/
handleCancelledTransition: function (transition, routes) {
var reason = transition.cancelReason;
if (reason instanceof Redirect) {
replaceWith(reason.to, reason.params, reason.query);
} else if (reason instanceof Abort) {
goBack();
}
}
},
propTypes: {
location: React.PropTypes.oneOf([ 'hash', 'history' ]).isRequired,
},
getDefaultProps: function () {
return {
location: 'hash'
};
},
getInitialState: function () {
return {};
},
componentWillMount: function () {
React.Children.forEach(this.props.children, function (child) {
RouteStore.registerRoute(child);
});
if (!URLStore.isSetup() && ExecutionEnvironment.canUseDOM)
URLStore.setup(this.props.location);
URLStore.addChangeListener(this.handleRouteChange);
},
componentDidMount: function () {
this.dispatch(URLStore.getCurrentPath());
},
componentWillUnmount: function () {
URLStore.removeChangeListener(this.handleRouteChange);
},
handleRouteChange: function () {
this.dispatch(URLStore.getCurrentPath());
},
/**
* Performs a depth-first search for the first route in the tree that matches
* on the given path. Returns an array of all routes in the tree leading to
* the one that matched in the format { route, params } where params is an
* object that contains the URL parameters relevant to that route. Returns
* null if no route in the tree matches the path.
*
* ( <Routes handler={App}>
* <Route name="posts" handler={Posts}>
* <Route name="newPost" path="/posts/new" handler={NewPost}/>
* <Route name="showPost" path="/posts/:id" handler={Post}/>
* </Route>
* </Routes>
* ).match('/posts/123'); => [ { route: <AppRoute>, params: {} },
* { route: <PostsRoute>, params: {} },
* { route: <PostRoute>, params: { id: '123' } } ]
*/
match: function (path) {
var rootRoutes = this.props.children;
if (!Array.isArray(rootRoutes)) {
rootRoutes = [rootRoutes];
}
var matches = null;
for (var i = 0; matches == null && i < rootRoutes.length; i++) {
matches = findMatches(Path.withoutQuery(path), rootRoutes[i]);
}
return matches;
},
/**
* Performs a transition to the given path and returns a promise for the
* Transition object that was used.
*
* In order to do this, the router first determines which routes are involved
* in the transition 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 static
* method is invoked on all route handlers we're transitioning away from, in
* reverse nesting order. Likewise, the willTransitionTo static method
* is invoked on all route handlers we're transitioning to.
*
* Both willTransitionFrom and willTransitionTo hooks may either abort or
* redirect the transition. If they need to resolve asynchronously, they may
* return a promise.
*
* Any error that occurs asynchronously during the transition is re-thrown in
* the top-level scope unless returnRejectedPromise is true, in which case a
* rejected promise is returned so the caller may handle the error.
*
* Note: This function does not update the URL in a browser's location bar.
* If you want to keep the URL in sync with transitions, use Router.transitionTo,
* Router.replaceWith, or Router.goBack instead.
*/
dispatch: function (path, returnRejectedPromise) {
var transition = new Transition(path);
var routes = this;
var promise = syncWithTransition(routes, transition).then(function (newState) {
if (transition.isCancelled) {
Routes.handleCancelledTransition(transition, routes);
} else if (newState) {
ActiveStore.updateState(newState);
}
return transition;
});
if (!returnRejectedPromise) {
promise = promise.then(undefined, function (error) {
// Use setTimeout to break the promise chain.
setTimeout(function () {
Routes.handleAsyncError(error, routes);
});
});
}
return promise;
},
render: function () {
if (!this.state.path)
return null;
var matches = this.state.matches;
if (matches.length) {
// matches[0] corresponds to the top-most match
return matches[0].route.props.handler(computeHandlerProps(matches, this.state.activeQuery));
} else {
return null;
}
}
});
function Transition(path) {
this.path = path;
this.cancelReason = null;
this.isCancelled = false;
}
mergeProperties(Transition.prototype, {
abort: function () {
this.cancelReason = new Abort();
this.isCancelled = true;
},
redirect: function (to, params, query) {
this.cancelReason = new Redirect(to, params, query);
this.isCancelled = true;
},
retry: function () {
transitionTo(this.path);
}
});
function Abort() {}
function Redirect(to, params, query) {
this.to = to;
this.params = params;
this.query = query;
}
function findMatches(path, route) {
var children = route.props.children, matches;
var params;
// Check the subtree first to find the most deeply-nested match.
if (Array.isArray(children)) {
for (var i = 0, len = children.length; matches == null && i < len; ++i) {
matches = findMatches(path, children[i]);
}
} else if (children) {
matches = findMatches(path, children);
}
if (matches) {
var rootParams = getRootMatch(matches).params;
params = {};
Path.extractParamNames(route.props.path).forEach(function (paramName) {
params[paramName] = rootParams[paramName];
});
matches.unshift(makeMatch(route, params));
return matches;
}
// No routes in the subtree matched, so check this route.
params = Path.extractParams(route.props.path, path);
if (params)
return [ makeMatch(route, params) ];
return null;
}
function makeMatch(route, params) {
return { route: route, params: params };
}
function hasMatch(matches, match) {
return matches.some(function (m) {
if (m.route !== match.route)
return false;
for (var property in m.params) {
if (m.params[property] !== match.params[property])
return false;
}
return true;
});
}
function getRootMatch(matches) {
return matches[matches.length - 1];
}
function updateMatchComponents(matches, refs) {
var i = 0, component;
while (component = refs[REF_NAME]) {
matches[i++].component = component;
refs = component.refs;
}
}
/**
* Runs all transition hooks that are required to get from the current state
* to the state specified by the given transition and updates the current state
* if they all pass successfully. Returns a promise that resolves to the new
* state if it needs to be updated, or undefined if not.
*/
function syncWithTransition(routes, transition) {
if (routes.state.path === transition.path)
return Promise.resolve(); // Nothing to do!
var currentMatches = routes.state.matches;
var nextMatches = routes.match(transition.path);
warning(
nextMatches,
'No route matches path "' + transition.path + '". Make sure you have ' +
'<Route path="' + transition.path + '"> somewhere in your routes'
);
if (!nextMatches)
nextMatches = [];
var fromMatches, toMatches;
if (currentMatches) {
updateMatchComponents(currentMatches, routes.refs);
fromMatches = currentMatches.filter(function (match) {
return !hasMatch(nextMatches, match);
});
toMatches = nextMatches.filter(function (match) {
return !hasMatch(currentMatches, match);
});
} else {
fromMatches = [];
toMatches = nextMatches;
}
return checkTransitionFromHooks(fromMatches, transition).then(function () {
if (transition.isCancelled)
return; // No need to continue.
return checkTransitionToHooks(toMatches, transition).then(function () {
if (transition.isCancelled)
return; // No need to continue.
var rootMatch = getRootMatch(nextMatches);
var params = (rootMatch && rootMatch.params) || {};
var query = Path.extractQuery(transition.path) || {};
var state = {
path: transition.path,
matches: nextMatches,
activeParams: params,
activeQuery: query,
activeRoutes: nextMatches.map(function (match) {
return match.route;
})
};
routes.setState(state);
return state;
});
});
}
/**
* Calls the willTransitionFrom hook of all handlers in the given matches
* serially in reverse with the transition object and the current instance of
* the route's handler, so that the deepest nested handlers are called first.
* Returns a promise that resolves after the last handler.
*/
function checkTransitionFromHooks(matches, transition) {
var promise = Promise.resolve();
reversedArray(matches).forEach(function (match) {
promise = promise.then(function () {
var handler = match.route.props.handler;
if (!transition.isCancelled && handler.willTransitionFrom)
return handler.willTransitionFrom(transition, match.component);
});
});
return promise;
}
/**
* Calls the willTransitionTo hook of all handlers in the given matches serially
* with the transition object and any params that apply to that handler. Returns
* a promise that resolves after the last handler.
*/
function checkTransitionToHooks(matches, transition) {
var promise = Promise.resolve();
matches.forEach(function (match, index) {
promise = promise.then(function () {
var handler = match.route.props.handler;
if (!transition.isCancelled && handler.willTransitionTo)
return handler.willTransitionTo(transition, match.params);
});
});
return promise;
}
/**
* Given an array of matches as returned by findMatches, return a descriptor for
* the handler hierarchy specified by the route.
*/
function computeHandlerProps(matches, query) {
var props = {
ref: null,
key: null,
params: null,
query: null,
activeRouteHandler: returnNull
};
var childHandler;
reversedArray(matches).forEach(function (match) {
var route = match.route;
props = Route.getUnreservedProps(route.props);
props.ref = REF_NAME;
props.key = Path.injectParams(route.props.path, match.params);
props.params = match.params;
props.query = query;
if (childHandler) {
props.activeRouteHandler = childHandler;
} else {
props.activeRouteHandler = returnNull;
}
childHandler = function (props, addedProps) {
if (arguments.length > 2 && typeof arguments[2] !== 'undefined')
throw new Error('Passing children to a route handler is not supported');
return route.props.handler(mergeProperties(props, addedProps));
}.bind(this, props);
});
return props;
}
function returnNull() {
return null;
}
function reversedArray(array) {
return array.slice(0).reverse();
}
module.exports = Routes;
},{"../components/Route":3,"../helpers/Path":5,"../helpers/goBack":7,"../helpers/mergeProperties":10,"../helpers/replaceWith":11,"../helpers/transitionTo":12,"../helpers/withoutProperties":13,"../stores/ActiveStore":16,"../stores/RouteStore":17,"../stores/URLStore":18,"es6-promise":22,"react/lib/ExecutionEnvironment":47,"react/lib/warning":51}],5:[function(_dereq_,module,exports){
var invariant = _dereq_('react/lib/invariant');
var qs = _dereq_('querystring');
var mergeProperties = _dereq_('./mergeProperties');
var URL = _dereq_('./URL');
var paramMatcher = /((?::[a-z_$][a-z0-9_$]*)|\*)/ig;
var queryMatcher = /\?(.+)/;
function getParamName(pathSegment) {
return pathSegment === '*' ? 'splat' : pathSegment.substr(1);
}
var _compiledPatterns = {};
function compilePattern(pattern) {
if (_compiledPatterns[pattern])
return _compiledPatterns[pattern];
var compiled = _compiledPatterns[pattern] = {};
var paramNames = compiled.paramNames = [];
var source = pattern.replace(paramMatcher, function (match, pathSegment) {
paramNames.push(getParamName(pathSegment));
return pathSegment === '*' ? '(.*?)' : '([^/?#]+)';
});
compiled.matcher = new RegExp('^' + source + '$', 'i');
return compiled;
}
function isDynamicPattern(pattern) {
return pattern.indexOf(':') !== -1 || pattern.indexOf('*') !== -1;
}
var Path = {
/**
* 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 (pattern, path) {
if (!pattern)
return null;
if (!isDynamicPattern(pattern)) {
if (pattern === URL.decode(path))
return {}; // No dynamic segments, but the paths match.
return null;
}
var compiled = compilePattern(pattern);
var match = URL.decode(path).match(compiled.matcher);
if (!match)
return null;
var params = {};
compiled.paramNames.forEach(function (paramName, index) {
params[paramName] = match[index + 1];
});
return params;
},
/**
* Returns an array of the names of all parameters in the given pattern.
*/
extractParamNames: function (pattern) {
if (!pattern)
return [];
return compilePattern(pattern).paramNames;
},
/**
* 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 (pattern, params) {
if (!pattern)
return null;
if (!isDynamicPattern(pattern))
return pattern;
params = params || {};
return pattern.replace(paramMatcher, function (match, pathSegment) {
var paramName = getParamName(pathSegment);
invariant(
params[paramName] != null,
'Missing "' + paramName + '" parameter for path "' + pattern + '"'
);
// Preserve forward slashes.
return String(params[paramName]).split('/').map(URL.encode).join('/');
});
},
/**
* 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 (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 (path) {
return path.replace(queryMatcher, '');
},
/**
* Returns a version of the given path with the parameters in the given query
* added to the query string.
*/
withQuery: function (path, query) {
var existingQuery = Path.extractQuery(path);
if (existingQuery)
query = query ? mergeProperties(existingQuery, query) : existingQuery;
var queryString = query && qs.stringify(query);
if (queryString)
return Path.withoutQuery(path) + '?' + queryString;
return path;
},
/**
* Returns a normalized version of the given path.
*/
normalize: function (path) {
return path.replace(/^\/*/, '/');
}
};
module.exports = Path;
},{"./URL":6,"./mergeProperties":10,"querystring":21,"react/lib/invariant":50}],6:[function(_dereq_,module,exports){
var urlEncodedSpaceRE = /\+/g;
var encodedSpaceRE = /%20/g;
var URL = {
/* These functions were copied from the https://github.com/cujojs/rest source, MIT licensed */
decode: function (str) {
// spec says space should be encoded as '+'
str = str.replace(urlEncodedSpaceRE, ' ');
return decodeURIComponent(str);
},
encode: function (str) {
str = encodeURIComponent(str);
// spec says space should be encoded as '+'
return str.replace(encodedSpaceRE, '+');
}
};
module.exports = URL;
},{}],7:[function(_dereq_,module,exports){
var URLStore = _dereq_('../stores/URLStore');
function goBack() {
URLStore.back();
}
module.exports = goBack;
},{"../stores/URLStore":18}],8:[function(_dereq_,module,exports){
var URLStore = _dereq_('../stores/URLStore');
var makePath = _dereq_('./makePath');
/**
* Returns a string that may safely be used as the href of a
* link to the route with the given name.
*/
function makeHref(routeName, params, query) {
var path = makePath(routeName, params, query);
if (URLStore.getLocation() === 'hash')
return '#' + path;
return path;
}
module.exports = makeHref;
},{"../stores/URLStore":18,"./makePath":9}],9:[function(_dereq_,module,exports){
var invariant = _dereq_('react/lib/invariant');
var RouteStore = _dereq_('../stores/RouteStore');
var Path = _dereq_('./Path');
/**
* Returns an absolute URL path created from the given route name, URL
* parameters, and query values.
*/
function makePath(to, params, query) {
var path;
if (to.charAt(0) === '/') {
path = Path.normalize(to); // Absolute path.
} else {
var route = RouteStore.getRouteByName(to);
invariant(
route,
'Unable to find a route named "' + to + '". Make sure you have ' +
'a <Route name="' + to + '"> defined somewhere in your routes'
);
path = route.props.path;
}
return Path.withQuery(Path.injectParams(path, params), query);
}
module.exports = makePath;
},{"../stores/RouteStore":17,"./Path":5,"react/lib/invariant":50}],10:[function(_dereq_,module,exports){
function mergeProperties(object, properties) {
for (var property in properties) {
if (properties.hasOwnProperty(property))
object[property] = properties[property];
}
return object;
}
module.exports = mergeProperties;
},{}],11:[function(_dereq_,module,exports){
var URLStore = _dereq_('../stores/URLStore');
var makePath = _dereq_('./makePath');
/**
* Transitions to the URL specified in the arguments by replacing
* the current URL in the history stack.
*/
function replaceWith(to, params, query) {
URLStore.replace(makePath(to, params, query));
}
module.exports = replaceWith;
},{"../stores/URLStore":18,"./makePath":9}],12:[function(_dereq_,module,exports){
var URLStore = _dereq_('../stores/URLStore');
var makePath = _dereq_('./makePath');
/**
* Transitions to the URL specified in the arguments by pushing
* a new URL onto the history stack.
*/
function transitionTo(to, params, query) {
URLStore.push(makePath(to, params, query));
}
module.exports = transitionTo;
},{"../stores/URLStore":18,"./makePath":9}],13:[function(_dereq_,module,exports){
function withoutProperties(object, properties) {
var result = {};
for (var property in object) {
if (object.hasOwnProperty(property) && !properties[property])
result[property] = object[property];
}
return result;
}
module.exports = withoutProperties;
},{}],14:[function(_dereq_,module,exports){
exports.Link = _dereq_('./components/Link');
exports.Route = _dereq_('./components/Route');
exports.Routes = _dereq_('./components/Routes');
exports.goBack = _dereq_('./helpers/goBack');
exports.replaceWith = _dereq_('./helpers/replaceWith');
exports.transitionTo = _dereq_('./helpers/transitionTo');
exports.ActiveState = _dereq_('./mixins/ActiveState');
// Backwards compat with 0.1. We should
// remove this when we ship 1.0.
exports.Router = _dereq_('./Router');
},{"./Router":1,"./components/Link":2,"./components/Route":3,"./components/Routes":4,"./helpers/goBack":7,"./helpers/replaceWith":11,"./helpers/transitionTo":12,"./mixins/ActiveState":15}],15:[function(_dereq_,module,exports){
var ActiveStore = _dereq_('../stores/ActiveStore');
/**
* A mixin for components that need to know about the routes, params,
* and query that are currently active. Components that use it get two
* things:
*
* 1. An `isActive` static method they can use to check if a route,
* params, and query are active.
* 2. An `updateActiveState` instance method that is called when the
* active state changes.
*
* Example:
*
* var Tab = React.createClass({
*
* mixins: [ Router.ActiveState ],
*
* getInitialState: function () {
* return {
* isActive: false
* };
* },
*
* updateActiveState: function () {
* this.setState({
* isActive: Tab.isActive(routeName, params, query)
* })
* }
*
* });
*/
var ActiveState = {
statics: {
/**
* Returns true if the route with the given name, URL parameters, and query
* are all currently active.
*/
isActive: ActiveStore.isActive
},
componentWillMount: function () {
ActiveStore.addChangeListener(this.handleActiveStateChange);
},
componentDidMount: function () {
if (this.updateActiveState)
this.updateActiveState();
},
componentWillUnmount: function () {
ActiveStore.removeChangeListener(this.handleActiveStateChange);
},
handleActiveStateChange: function () {
if (this.isMounted() && this.updateActiveState)
this.updateActiveState();
}
};
module.exports = ActiveState;
},{"../stores/ActiveStore":16}],16:[function(_dereq_,module,exports){
var _activeRoutes = [];
var _activeParams = {};
var _activeQuery = {};
function routeIsActive(routeName) {
return _activeRoutes.some(function (route) {
return route.props.name === routeName;
});
}
function paramsAreActive(params) {
for (var property in params) {
if (_activeParams[property] !== String(params[property]))
return false;
}
return true;
}
function queryIsActive(query) {
for (var property in query) {
if (_activeQuery[property] !== String(query[property]))
return false;
}
return true;
}
var EventEmitter = _dereq_('event-emitter');
var _events = EventEmitter();
function notifyChange() {
_events.emit('change');
}
/**
* The ActiveStore keeps track of which routes, URL and query parameters are
* currently active on a page. <Link>s subscribe to the ActiveStore to know
* whether or not they are active.
*/
var ActiveStore = {
/**
* Adds a listener that will be called when this store changes.
*/
addChangeListener: function (listener) {
_events.on('change', listener);
},
/**
* Removes the given change listener.
*/
removeChangeListener: function (listener) {
_events.off('change', listener);
},
/**
* Updates the currently active state and notifies all listeners.
* This is automatically called by routes as they become active.
*/
updateState: function (state) {
state = state || {};
_activeRoutes = state.activeRoutes || [];
_activeParams = state.activeParams || {};
_activeQuery = state.activeQuery || {};
notifyChange();
},
/**
* Returns true if the route with the given name, URL parameters, and query
* are all currently active.
*/
isActive: function (routeName, params, query) {
var isActive = routeIsActive(routeName) && paramsAreActive(params);
if (query)
return isActive && queryIsActive(query);
return isActive;
}
};
module.exports = ActiveStore;
},{"event-emitter":32}],17:[function(_dereq_,module,exports){
var React = (typeof window !== "undefined" ? window.React : typeof global !== "undefined" ? global.React : null);
var invariant = _dereq_('react/lib/invariant');
var warning = _dereq_('react/lib/warning');
var Path = _dereq_('../helpers/Path');
var _namedRoutes = {};
/**
* The RouteStore contains a directory of all <Route>s in the system. It is
* used primarily for looking up routes by name so that <Link>s can use a
* route name in the "to" prop and users can use route names in `Router.transitionTo`
* and other high-level utility methods.
*/
var RouteStore = {
/**
* Registers a <Route> and all of its children with the RouteStore. Also,
* does some normalization and validation on route props.
*/
registerRoute: function (route, _parentRoute) {
// Make sure the <Route>'s path begins with a slash. Default to its name.
// We can't do this in getDefaultProps because it may not be called on
// <Route>s that are never actually mounted.
if (route.props.path || route.props.name) {
route.props.path = Path.normalize(route.props.path || route.props.name);
} else {
route.props.path = '/';
}
// Make sure the <Route> has a valid React component for a handler.
invariant(
React.isValidClass(route.props.handler),
'The handler for Route "' + (route.props.name || route.props.path) + '" ' +
'must be a valid React component'
);
// Make sure the <Route> has all params that its parent needs.
if (_parentRoute) {
var paramNames = Path.extractParamNames(route.props.path);
Path.extractParamNames(_parentRoute.props.path).forEach(function (paramName) {
invariant(
paramNames.indexOf(paramName) !== -1,
'The nested route path "' + route.props.path + '" is missing the "' + paramName + '" ' +
'parameter of its parent path "' + _parentRoute.props.path + '"'
);
});
}
// Make sure the <Route> can be looked up by <Link>s.
if (route.props.name) {
var existingRoute = _namedRoutes[route.props.name];
invariant(
!existingRoute || route === existingRoute,
'You cannot use the name "' + route.props.name + '" for more than one route'
);
_namedRoutes[route.props.name] = route;
}
React.Children.forEach(route.props.children, function (child) {
RouteStore.registerRoute(child, route);
});
},
/**
* Removes the reference to the given <Route> and all of its children from
* the RouteStore.
*/
unregisterRoute: function (route) {
if (route.props.name)
delete _namedRoutes[route.props.name];
React.Children.forEach(route.props.children, function (child) {
RouteStore.unregisterRoute(route);
});
},
/**
* Returns the Route object with the given name, if one exists.
*/
getRouteByName: function (routeName) {
return _namedRoutes[routeName] || null;
}
};
module.exports = RouteStore;
},{"../helpers/Path":5,"react/lib/invariant":50,"react/lib/warning":51}],18:[function(_dereq_,module,exports){
var ExecutionEnvironment = _dereq_('react/lib/ExecutionEnvironment');
var invariant = _dereq_('react/lib/invariant');
var warning = _dereq_('react/lib/warning');
var CHANGE_EVENTS = {
hash: (window.addEventListener) ? 'hashchange' : 'onhashchange',
history: 'popstate'
};
var _location;
var _currentPath = '/';
var _lastPath = null;
function getWindowPath() {
return window.location.pathname + window.location.search;
}
var EventEmitter = _dereq_('event-emitter');
var _events = EventEmitter();
function notifyChange() {
_events.emit('change');
}
/**
* The URLStore keeps track of the current URL. In DOM environments, it may be
* attached to window.location to automatically sync with the URL in a browser's
* location bar. <Route>s subscribe to the URLStore to know when the URL changes.
*/
var URLStore = {
/**
* Adds a listener that will be called when this store changes.
*/
addChangeListener: function (listener) {
_events.on('change', listener);
},
/**
* Removes the given change listener.
*/
removeChangeListener: function (listener) {
_events.off('change', listener);
},
/**
* Returns the type of navigation that is currently being used.
*/
getLocation: function () {
return _location || 'hash';
},
/**
* Returns the value of the current URL path.
*/
getCurrentPath: function () {
if (_location === 'history')
return getWindowPath();
if (_location === 'hash')
return window.location.hash.substr(1);
return _currentPath;
},
/**
* Pushes the given path onto the browser navigation stack.
*/
push: function (path) {
if (_location === 'history') {
window.history.pushState({ path: path }, '', path);
notifyChange();
} else if (_location === 'hash') {
window.location.hash = path;
} else {
_lastPath = _currentPath;
_currentPath = path;
notifyChange();
}
},
/**
* Replaces the current URL path with the given path without adding an entry
* to the browser's history.
*/
replace: function (path) {
if (_location === 'history') {
window.history.replaceState({ path: path }, '', path);
notifyChange();
} else if (_location === 'hash') {
window.location.replace(getWindowPath() + '#' + path);
} else {
_currentPath = path;
notifyChange();
}
},
/**
* Reverts the URL to whatever it was before the last update.
*/
back: function () {
if (_location != null) {
window.history.back();
} else {
invariant(
_lastPath,
'You cannot make the URL store go back more than once when it does not use the DOM'
);
_currentPath = _lastPath;
_lastPath = null;
notifyChange();
}
},
/**
* Returns true if the URL store has already been setup.
*/
isSetup: function () {
return _location != null;
},
/**
* Sets up the URL store to get the value of the current path from window.location
* as it changes. The location argument may be either "hash" or "history".
*/
setup: function (location) {
invariant(
ExecutionEnvironment.canUseDOM,
'You cannot setup the URL store in an environment with no DOM'
);
if (_location != null) {
warning(
_location === location,
'The URL store was already setup using ' + _location + ' location. ' +
'You cannot use ' + location + ' location on the same page'
);
return; // Don't setup twice.
}
var changeEvent = CHANGE_EVENTS[location];
invariant(
changeEvent,
'The URL store location "' + location + '" is not valid. ' +
'It must be either "hash" or "history"'
);
_location = location;
if (location === 'hash' && window.location.hash === '')
URLStore.replace('/');
if (window.addEventListener) {
window.addEventListener(changeEvent, notifyChange, false);
} else {
window.attachEvent(changeEvent, notifyChange);
}
notifyChange();
},
/**
* Stops listening for changes to window.location.
*/
teardown: function () {
if (_location == null)
return;
var changeEvent = CHANGE_EVENTS[_location];
if (window.removeEventListener) {
window.removeEventListener(changeEvent, notifyChange, false);
} else {
window.detachEvent(changeEvent, notifyChange);
}
_location = null;
}
};
module.exports = URLStore;
},{"event-emitter":32,"react/lib/ExecutionEnvironment":47,"react/lib/invariant":50,"react/lib/warning":51}],19:[function(_dereq_,module,exports){
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
'use strict';
// If obj.hasOwnProperty has been overridden, then calling
// obj.hasOwnProperty(prop) will break.
// See: https://github.com/joyent/node/issues/1707
function hasOwnProperty(obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
}
module.exports = function(qs, sep, eq, options) {
sep = sep || '&';
eq = eq || '=';
var obj = {};
if (typeof qs !== 'string' || qs.length === 0) {
return obj;
}
var regexp = /\+/g;
qs = qs.split(sep);
var maxKeys = 1000;
if (options && typeof options.maxKeys === 'number') {
maxKeys = options.maxKeys;
}
var len = qs.length;
// maxKeys <= 0 means that we should not limit keys count
if (maxKeys > 0 && len > maxKeys) {
len = maxKeys;
}
for (var i = 0; i < len; ++i) {
var x = qs[i].replace(regexp, '%20'),
idx = x.indexOf(eq),
kstr, vstr, k, v;
if (idx >= 0) {
kstr = x.substr(0, idx);
vstr = x.substr(idx + 1);
} else {
kstr = x;
vstr = '';
}
k = decodeURIComponent(kstr);
v = decodeURIComponent(vstr);
if (!hasOwnProperty(obj, k)) {
obj[k] = v;
} else if (isArray(obj[k])) {
obj[k].push(v);
} else {
obj[k] = [obj[k], v];
}
}
return obj;
};
var isArray = Array.isArray || function (xs) {
return Object.prototype.toString.call(xs) === '[object Array]';
};
},{}],20:[function(_dereq_,module,exports){
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
'use strict';
var stringifyPrimitive = function(v) {
switch (typeof v) {
case 'string':
return v;
case 'boolean':
return v ? 'true' : 'false';
case 'number':
return isFinite(v) ? v : '';
default:
return '';
}
};
module.exports = function(obj, sep, eq, name) {
sep = sep || '&';
eq = eq || '=';
if (obj === null) {
obj = undefined;
}
if (typeof obj === 'object') {
return map(objectKeys(obj), function(k) {
var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
if (isArray(obj[k])) {
return map(obj[k], function(v) {
return ks + encodeURIComponent(stringifyPrimitive(v));
}).join(sep);
} else {
return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
}
}).join(sep);
}
if (!name) return '';
return encodeURIComponent(stringifyPrimitive(name)) + eq +
encodeURIComponent(stringifyPrimitive(obj));
};
var isArray = Array.isArray || function (xs) {
return Object.prototype.toString.call(xs) === '[object Array]';
};
function map (xs, f) {
if (xs.map) return xs.map(f);
var res = [];
for (var i = 0; i < xs.length; i++) {
res.push(f(xs[i], i));
}
return res;
}
var objectKeys = Object.keys || function (obj) {
var res = [];
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);
}
return res;
};
},{}],21:[function(_dereq_,module,exports){
'use strict';
exports.decode = exports.parse = _dereq_('./decode');
exports.encode = exports.stringify = _dereq_('./encode');
},{"./decode":19,"./encode":20}],22:[function(_dereq_,module,exports){
"use strict";
var Promise = _dereq_("./promise/promise").Promise;
var polyfill = _dereq_("./promise/polyfill").polyfill;
exports.Promise = Promise;
exports.polyfill = polyfill;
},{"./promise/polyfill":26,"./promise/promise":27}],23:[function(_dereq_,module,exports){
"use strict";
/* global toString */
var isArray = _dereq_("./utils").isArray;
var isFunction = _dereq_("./utils").isFunction;
/**
Returns a promise that is fulfilled when all the given promises have been
fulfilled, or rejected if any of them become rejected. The return promise
is fulfilled with an array that gives all the values in the order they were
passed in the `promises` array argument.
Example:
```javascript
var promise1 = RSVP.resolve(1);
var promise2 = RSVP.resolve(2);
var promise3 = RSVP.resolve(3);
var promises = [ promise1, promise2, promise3 ];
RSVP.all(promises).then(function(array){
// The array here would be [ 1, 2, 3 ];
});
```
If any of the `promises` given to `RSVP.all` are rejected, the first promise
that is rejected will be given as an argument to the returned promises's
rejection handler. For example:
Example:
```javascript
var promise1 = RSVP.resolve(1);
var promise2 = RSVP.reject(new Error("2"));
var promise3 = RSVP.reject(new Error("3"));
var promises = [ promise1, promise2, promise3 ];
RSVP.all(promises).then(function(array){
// Code here never runs because there are rejected promises!
}, function(error) {
// error.message === "2"
});
```
@method all
@for RSVP
@param {Array} promises
@param {String} label
@return {Promise} promise that is fulfilled when all `promises` have been
fulfilled, or rejected if any of them become rejected.
*/
function all(promises) {
/*jshint validthis:true */
var Promise = this;
if (!isArray(promises)) {
throw new TypeError('You must pass an array to all.');
}
return new Promise(function(resolve, reject) {
var results = [], remaining = promises.length,
promise;
if (remaining === 0) {
resolve([]);
}
function resolver(index) {
return function(value) {
resolveAll(index, value);
};
}
function resolveAll(index, value) {
results[index] = value;
if (--remaining === 0) {
resolve(results);
}
}
for (var i = 0; i < promises.length; i++) {
promise = promises[i];
if (promise && isFunction(promise.then)) {
promise.then(resolver(i), reject);
} else {
resolveAll(i, promise);
}
}
});
}
exports.all = all;
},{"./utils":31}],24:[function(_dereq_,module,exports){
"use strict";
var browserGlobal = (typeof window !== 'undefined') ? window : {};
var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
var local = (typeof global !== 'undefined') ? global : (this === undefined? window:this);
// node
function useNextTick() {
return function() {
process.nextTick(flush);
};
}
function useMutationObserver() {
var iterations = 0;
var observer = new BrowserMutationObserver(flush);
var node = document.createTextNode('');
observer.observe(node, { characterData: true });
return function() {
node.data = (iterations = ++iterations % 2);
};
}
function useSetTimeout() {
return function() {
local.setTimeout(flush, 1);
};
}
var queue = [];
function flush() {
for (var i = 0; i < queue.length; i++) {
var tuple = queue[i];
var callback = tuple[0], arg = tuple[1];
callback(arg);
}
queue = [];
}
var scheduleFlush;
// Decide what async method to use to triggering processing of queued callbacks:
if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') {
scheduleFlush = useNextTick();
} else if (BrowserMutationObserver) {
scheduleFlush = useMutationObserver();
} else {
scheduleFlush = useSetTimeout();
}
function asap(callback, arg) {
var length = queue.push([callback, arg]);
if (length === 1) {
// If length is 1, that means that we need to schedule an async flush.
// If additional callbacks are queued before the queue is flushed, they
// will be processed by this flush that we are scheduling.
scheduleFlush();
}
}
exports.asap = asap;
},{}],25:[function(_dereq_,module,exports){
"use strict";
var config = {
instrument: false
};
function configure(name, value) {
if (arguments.length === 2) {
config[name] = value;
} else {
return config[name];
}
}
exports.config = config;
exports.configure = configure;
},{}],26:[function(_dereq_,module,exports){
"use strict";
/*global self*/
var RSVPPromise = _dereq_("./promise").Promise;
var isFunction = _dereq_("./utils").isFunction;
function polyfill() {
var local;
if (typeof global !== 'undefined') {
local = global;
} else if (typeof window !== 'undefined' && window.document) {
local = window;
} else {
local = self;
}
var es6PromiseSupport =
"Promise" in local &&
// Some of these methods are missing from
// Firefox/Chrome experimental implementations
"resolve" in local.Promise &&
"reject" in local.Promise &&
"all" in local.Promise &&
"race" in local.Promise &&
// Older version of the spec had a resolver object
// as the arg rather than a function
(function() {
var resolve;
new local.Promise(function(r) { resolve = r; });
return isFunction(resolve);
}());
if (!es6PromiseSupport) {
local.Promise = RSVPPromise;
}
}
exports.polyfill = polyfill;
},{"./promise":27,"./utils":31}],27:[function(_dereq_,module,exports){
"use strict";
var config = _dereq_("./config").config;
var configure = _dereq_("./config").configure;
var objectOrFunction = _dereq_("./utils").objectOrFunction;
var isFunction = _dereq_("./utils").isFunction;
var now = _dereq_("./utils").now;
var all = _dereq_("./all").all;
var race = _dereq_("./race").race;
var staticResolve = _dereq_("./resolve").resolve;
var staticReject = _dereq_("./reject").reject;
var asap = _dereq_("./asap").asap;
var counter = 0;
config.async = asap; // default async is asap;
function Promise(resolver) {
if (!isFunction(resolver)) {
throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
}
if (!(this instanceof Promise)) {
throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
}
this._subscribers = [];
invokeResolver(resolver, this);
}
function invokeResolver(resolver, promise) {
function resolvePromise(value) {
resolve(promise, value);
}
function rejectPromise(reason) {
reject(promise, reason);
}
try {
resolver(resolvePromise, rejectPromise);
} catch(e) {
rejectPromise(e);
}
}
function invokeCallback(settled, promise, callback, detail) {
var hasCallback = isFunction(callback),
value, error, succeeded, failed;
if (hasCallback) {
try {
value = callback(detail);
succeeded = true;
} catch(e) {
failed = true;
error = e;
}
} else {
value = detail;
succeeded = true;
}
if (handleThenable(promise, value)) {
return;
} else if (hasCallback && succeeded) {
resolve(promise, value);
} else if (failed) {
reject(promise, error);
} else if (settled === FULFILLED) {
resolve(promise, value);
} else if (settled === REJECTED) {
reject(promise, value);
}
}
var PENDING = void 0;
var SEALED = 0;
var FULFILLED = 1;
var REJECTED = 2;
function subscribe(parent, child, onFulfillment, onRejection) {
var subscribers = parent._subscribers;
var length = subscribers.length;
subscribers[length] = child;
subscribers[length + FULFILLED] = onFulfillment;
subscribers[length + REJECTED] = onRejection;
}
function publish(promise, settled) {
var child, callback, subscribers = promise._subscribers, detail = promise._detail;
for (var i = 0; i < subscribers.length; i += 3) {
child = subscribers[i];
callback = subscribers[i + settled];
invokeCallback(settled, child, callback, detail);
}
promise._subscribers = null;
}
Promise.prototype = {
constructor: Promise,
_state: undefined,
_detail: undefined,
_subscribers: undefined,
then: function(onFulfillment, onRejection) {
var promise = this;
var thenPromise = new this.constructor(function() {});
if (this._state) {
var callbacks = arguments;
config.async(function invokePromiseCallback() {
invokeCallback(promise._state, thenPromise, callbacks[promise._state - 1], promise._detail);
});
} else {
subscribe(this, thenPromise, onFulfillment, onRejection);
}
return thenPromise;
},
'catch': function(onRejection) {
return this.then(null, onRejection);
}
};
Promise.all = all;
Promise.race = race;
Promise.resolve = staticResolve;
Promise.reject = staticReject;
function handleThenable(promise, value) {
var then = null,
resolved;
try {
if (promise === value) {
throw new TypeError("A promises callback cannot return that same promise.");
}
if (objectOrFunction(value)) {
then = value.then;
if (isFunction(then)) {
then.call(value, function(val) {
if (resolved) { return true; }
resolved = true;
if (value !== val) {
resolve(promise, val);
} else {
fulfill(promise, val);
}
}, function(val) {
if (resolved) { return true; }
resolved = true;
reject(promise, val);
});
return true;
}
}
} catch (error) {
if (resolved) { return true; }
reject(promise, error);
return true;
}
return false;
}
function resolve(promise, value) {
if (promise === value) {
fulfill(promise, value);
} else if (!handleThenable(promise, value)) {
fulfill(promise, value);
}
}
function fulfill(promise, value) {
if (promise._state !== PENDING) { return; }
promise._state = SEALED;
promise._detail = value;
config.async(publishFulfillment, promise);
}
function reject(promise, reason) {
if (promise._state !== PENDING) { return; }
promise._state = SEALED;
promise._detail = reason;
config.async(publishRejection, promise);
}
function publishFulfillment(promise) {
publish(promise, promise._state = FULFILLED);
}
function publishRejection(promise) {
publish(promise, promise._state = REJECTED);
}
exports.Promise = Promise;
},{"./all":23,"./asap":24,"./config":25,"./race":28,"./reject":29,"./resolve":30,"./utils":31}],28:[function(_dereq_,module,exports){
"use strict";
/* global toString */
var isArray = _dereq_("./utils").isArray;
/**
`RSVP.race` allows you to watch a series of promises and act as soon as the
first promise given to the `promises` argument fulfills or rejects.
Example:
```javascript
var promise1 = new RSVP.Promise(function(resolve, reject){
setTimeout(function(){
resolve("promise 1");
}, 200);
});
var promise2 = new RSVP.Promise(function(resolve, reject){
setTimeout(function(){
resolve("promise 2");
}, 100);
});
RSVP.race([promise1, promise2]).then(function(result){
// result === "promise 2" because it was resolved before promise1
// was resolved.
});
```
`RSVP.race` is deterministic in that only the state of the first completed
promise matters. For example, even if other promises given to the `promises`
array argument are resolved, but the first completed promise has become
rejected before the other promises became fulfilled, the returned promise
will become rejected:
```javascript
var promise1 = new RSVP.Promise(function(resolve, reject){
setTimeout(function(){
resolve("promise 1");
}, 200);
});
var promise2 = new RSVP.Promise(function(resolve, reject){
setTimeout(function(){
reject(new Error("promise 2"));
}, 100);
});
RSVP.race([promise1, promise2]).then(function(result){
// Code here never runs because there are rejected promises!
}, function(reason){
// reason.message === "promise2" because promise 2 became rejected before
// promise 1 became fulfilled
});
```
@method race
@for RSVP
@param {Array} promises array of promises to observe
@param {String} label optional string for describing the promise returned.
Useful for tooling.
@return {Promise} a promise that becomes fulfilled with the value the first
completed promises is resolved with if the first completed promise was
fulfilled, or rejected with the reason that the first completed promise
was rejected with.
*/
function race(promises) {
/*jshint validthis:true */
var Promise = this;
if (!isArray(promises)) {
throw new TypeError('You must pass an array to race.');
}
return new Promise(function(resolve, reject) {
var results = [], promise;
for (var i = 0; i < promises.length; i++) {
promise = promises[i];
if (promise && typeof promise.then === 'function') {
promise.then(resolve, reject);
} else {
resolve(promise);
}
}
});
}
exports.race = race;
},{"./utils":31}],29:[function(_dereq_,module,exports){
"use strict";
/**
`RSVP.reject` returns a promise that will become rejected with the passed
`reason`. `RSVP.reject` is essentially shorthand for the following:
```javascript
var promise = new RSVP.Promise(function(resolve, reject){
reject(new Error('WHOOPS'));
});
promise.then(function(value){
// Code here doesn't run because the promise is rejected!
}, function(reason){
// reason.message === 'WHOOPS'
});
```
Instead of writing the above, your code now simply becomes the following:
```javascript
var promise = RSVP.reject(new Error('WHOOPS'));
promise.then(function(value){
// Code here doesn't run because the promise is rejected!
}, function(reason){
// reason.message === 'WHOOPS'
});
```
@method reject
@for RSVP
@param {Any} reason value that the returned promise will be rejected with.
@param {String} label optional string for identifying the returned promise.
Useful for tooling.
@return {Promise} a promise that will become rejected with the given
`reason`.
*/
function reject(reason) {
/*jshint validthis:true */
var Promise = this;
return new Promise(function (resolve, reject) {
reject(reason);
});
}
exports.reject = reject;
},{}],30:[function(_dereq_,module,exports){
"use strict";
function resolve(value) {
/*jshint validthis:true */
if (value && typeof value === 'object' && value.constructor === this) {
return value;
}
var Promise = this;
return new Promise(function(resolve) {
resolve(value);
});
}
exports.resolve = resolve;
},{}],31:[function(_dereq_,module,exports){
"use strict";
function objectOrFunction(x) {
return isFunction(x) || (typeof x === "object" && x !== null);
}
function isFunction(x) {
return typeof x === "function";
}
function isArray(x) {
return Object.prototype.toString.call(x) === "[object Array]";
}
// Date.now is not available in browsers < IE9
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now#Compatibility
var now = Date.now || function() { return new Date().getTime(); };
exports.objectOrFunction = objectOrFunction;
exports.isFunction = isFunction;
exports.isArray = isArray;
exports.now = now;
},{}],32:[function(_dereq_,module,exports){
'use strict';
var d = _dereq_('d')
, callable = _dereq_('es5-ext/object/valid-callable')
, apply = Function.prototype.apply, call = Function.prototype.call
, create = Object.create, defineProperty = Object.defineProperty
, defineProperties = Object.defineProperties
, hasOwnProperty = Object.prototype.hasOwnProperty
, descriptor = { configurable: true, enumerable: false, writable: true }
, on, once, off, emit, methods, descriptors, base;
on = function (type, listener) {
var data;
callable(listener);
if (!hasOwnProperty.call(this, '__ee__')) {
data = descriptor.value = create(null);
defineProperty(this, '__ee__', descriptor);
descriptor.value = null;
} else {
data = this.__ee__;
}
if (!data[type]) data[type] = listener;
else if (typeof data[type] === 'object') data[type].push(listener);
else data[type] = [data[type], listener];
return this;
};
once = function (type, listener) {
var once, self;
callable(listener);
self = this;
on.call(this, type, once = function () {
off.call(self, type, once);
apply.call(listener, this, arguments);
});
once.__eeOnceListener__ = listener;
return this;
};
off = function (type, listener) {
var data, listeners, candidate, i;
callable(listener);
if (!hasOwnProperty.call(this, '__ee__')) return this;
data = this.__ee__;
if (!data[type]) return this;
listeners = data[type];
if (typeof listeners === 'object') {
for (i = 0; (candidate = listeners[i]); ++i) {
if ((candidate === listener) ||
(candidate.__eeOnceListener__ === listener)) {
if (listeners.length === 2) data[type] = listeners[i ? 0 : 1];
else listeners.splice(i, 1);
}
}
} else {
if ((listeners === listener) ||
(listeners.__eeOnceListener__ === listener)) {
delete data[type];
}
}
return this;
};
emit = function (type) {
var i, l, listener, listeners, args;
if (!hasOwnProperty.call(this, '__ee__')) return;
listeners = this.__ee__[type];
if (!listeners) return;
if (typeof listeners === 'object') {
l = arguments.length;
args = new Array(l - 1);
for (i = 1; i < l; ++i) args[i - 1] = arguments[i];
listeners = listeners.slice();
for (i = 0; (listener = listeners[i]); ++i) {
apply.call(listener, this, args);
}
} else {
switch (arguments.length) {
case 1:
call.call(listeners, this);
break;
case 2:
call.call(listeners, this, arguments[1]);
break;
case 3:
call.call(listeners, this, arguments[1], arguments[2]);
break;
default:
l = arguments.length;
args = new Array(l - 1);
for (i = 1; i < l; ++i) {
args[i - 1] = arguments[i];
}
apply.call(listeners, this, args);
}
}
};
methods = {
on: on,
once: once,
off: off,
emit: emit
};
descriptors = {
on: d(on),
once: d(once),
off: d(off),
emit: d(emit)
};
base = defineProperties({}, descriptors);
module.exports = exports = function (o) {
return (o == null) ? create(base) : defineProperties(Object(o), descriptors);
};
exports.methods = methods;
},{"d":33,"es5-ext/object/valid-callable":42}],33:[function(_dereq_,module,exports){
'use strict';
var assign = _dereq_('es5-ext/object/assign')
, normalizeOpts = _dereq_('es5-ext/object/normalize-options')
, isCallable = _dereq_('es5-ext/object/is-callable')
, contains = _dereq_('es5-ext/string/#/contains')
, d;
d = module.exports = function (dscr, value/*, options*/) {
var c, e, w, options, desc;
if ((arguments.length < 2) || (typeof dscr !== 'string')) {
options = value;
value = dscr;
dscr = null;
} else {
options = arguments[2];
}
if (dscr == null) {
c = w = true;
e = false;
} else {
c = contains.call(dscr, 'c');
e = contains.call(dscr, 'e');
w = contains.call(dscr, 'w');
}
desc = { value: value, configurable: c, enumerable: e, writable: w };
return !options ? desc : assign(normalizeOpts(options), desc);
};
d.gs = function (dscr, get, set/*, options*/) {
var c, e, options, desc;
if (typeof dscr !== 'string') {
options = set;
set = get;
get = dscr;
dscr = null;
} else {
options = arguments[3];
}
if (get == null) {
get = undefined;
} else if (!isCallable(get)) {
options = get;
get = set = undefined;
} else if (set == null) {
set = undefined;
} else if (!isCallable(set)) {
options = set;
set = undefined;
}
if (dscr == null) {
c = true;
e = false;
} else {
c = contains.call(dscr, 'c');
e = contains.call(dscr, 'e');
}
desc = { get: get, set: set, configurable: c, enumerable: e };
return !options ? desc : assign(normalizeOpts(options), desc);
};
},{"es5-ext/object/assign":34,"es5-ext/object/is-callable":37,"es5-ext/object/normalize-options":41,"es5-ext/string/#/contains":44}],34:[function(_dereq_,module,exports){
'use strict';
module.exports = _dereq_('./is-implemented')()
? Object.assign
: _dereq_('./shim');
},{"./is-implemented":35,"./shim":36}],35:[function(_dereq_,module,exports){
'use strict';
module.exports = function () {
var assign = Object.assign, obj;
if (typeof assign !== 'function') return false;
obj = { foo: 'raz' };
assign(obj, { bar: 'dwa' }, { trzy: 'trzy' });
return (obj.foo + obj.bar + obj.trzy) === 'razdwatrzy';
};
},{}],36:[function(_dereq_,module,exports){
'use strict';
var keys = _dereq_('../keys')
, value = _dereq_('../valid-value')
, max = Math.max;
module.exports = function (dest, src/*, …srcn*/) {
var error, i, l = max(arguments.length, 2), assign;
dest = Object(value(dest));
assign = function (key) {
try { dest[key] = src[key]; } catch (e) {
if (!error) error = e;
}
};
for (i = 1; i < l; ++i) {
src = arguments[i];
keys(src).forEach(assign);
}
if (error !== undefined) throw error;
return dest;
};
},{"../keys":38,"../valid-value":43}],37:[function(_dereq_,module,exports){
// Deprecated
'use strict';
module.exports = function (obj) { return typeof obj === 'function'; };
},{}],38:[function(_dereq_,module,exports){
'use strict';
module.exports = _dereq_('./is-implemented')()
? Object.keys
: _dereq_('./shim');
},{"./is-implemented":39,"./shim":40}],39:[function(_dereq_,module,exports){
'use strict';
module.exports = function () {
try {
Object.keys('primitive');
return true;
} catch (e) { return false; }
};
},{}],40:[function(_dereq_,module,exports){
'use strict';
var keys = Object.keys;
module.exports = function (object) {
return keys(object == null ? object : Object(object));
};
},{}],41:[function(_dereq_,module,exports){
'use strict';
var assign = _dereq_('./assign')
, forEach = Array.prototype.forEach
, create = Object.create, getPrototypeOf = Object.getPrototypeOf
, process;
process = function (src, obj) {
var proto = getPrototypeOf(src);
return assign(proto ? process(proto, obj) : obj, src);
};
module.exports = function (options/*, …options*/) {
var result = create(null);
forEach.call(arguments, function (options) {
if (options == null) return;
process(Object(options), result);
});
return result;
};
},{"./assign":34}],42:[function(_dereq_,module,exports){
'use strict';
module.exports = function (fn) {
if (typeof fn !== 'function') throw new TypeError(fn + " is not a function");
return fn;
};
},{}],43:[function(_dereq_,module,exports){
'use strict';
module.exports = function (value) {
if (value == null) throw new TypeError("Cannot use null or undefined");
return value;
};
},{}],44:[function(_dereq_,module,exports){
'use strict';
module.exports = _dereq_('./is-implemented')()
? String.prototype.contains
: _dereq_('./shim');
},{"./is-implemented":45,"./shim":46}],45:[function(_dereq_,module,exports){
'use strict';
var str = 'razdwatrzy';
module.exports = function () {
if (typeof str.contains !== 'function') return false;
return ((str.contains('dwa') === true) && (str.contains('foo') === false));
};
},{}],46:[function(_dereq_,module,exports){
'use strict';
var indexOf = String.prototype.indexOf;
module.exports = function (searchString/*, position*/) {
return indexOf.call(this, searchString, arguments[1]) > -1;
};
},{}],47:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @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;
},{}],48:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule copyProperties
*/
/**
* Copy properties from one or more objects (up to 5) into the first object.
* This is a shallow copy. It mutates the first object and also returns it.
*
* NOTE: `arguments` has a very significant performance penalty, which is why
* we don't support unlimited arguments.
*/
function copyProperties(obj, a, b, c, d, e, f) {
obj = obj || {};
if ("production" !== "production") {
if (f) {
throw new Error('Too many arguments passed to copyProperties');
}
}
var args = [a, b, c, d, e];
var ii = 0, v;
while (args[ii]) {
v = args[ii++];
for (var k in v) {
obj[k] = v[k];
}
// IE ignores toString in object iteration.. See:
// webreflection.blogspot.com/2007/07/quick-fix-internet-explorer-and.html
if (v.hasOwnProperty && v.hasOwnProperty('toString') &&
(typeof v.toString != 'undefined') && (obj.toString !== v.toString)) {
obj.toString = v.toString;
}
}
return obj;
}
module.exports = copyProperties;
},{}],49:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule emptyFunction
*/
var copyProperties = _dereq_("./copyProperties");
function makeEmptyFunction(arg) {
return function() {
return arg;
};
}
/**
* This function accepts and discards inputs; it has no side effects. This is
* primarily useful idiomatically for overridable function endpoints which
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
*/
function emptyFunction() {}
copyProperties(emptyFunction, {
thatReturns: makeEmptyFunction,
thatReturnsFalse: makeEmptyFunction(false),
thatReturnsTrue: makeEmptyFunction(true),
thatReturnsNull: makeEmptyFunction(null),
thatReturnsThis: function() { return this; },
thatReturnsArgument: function(arg) { return arg; }
});
module.exports = emptyFunction;
},{"./copyProperties":48}],50:[function(_dereq_,module,exports){
/**
* Copyright 2013-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.
*
* @providesModule invariant
*/
"use strict";
/**
* Use invariant() to assert state which your program assumes to be true.
*
* Provide sprintf-style format (only %s is supported) and arguments
* to provide information about what broke and what you were
* expecting.
*
* The invariant message will be stripped in production, but the invariant
* will remain to ensure logic does not differ in production.
*/
var invariant = function(condition, format, a, b, c, d, e, f) {
if ("production" !== "production") {
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;
},{}],51:[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.
*
* @providesModule warning
*/
"use strict";
var emptyFunction = _dereq_("./emptyFunction");
/**
* Similar to invariant but only logs a warning if the condition is not met.
* This can be used to log issues in development environments in critical
* paths. Removing the logging code for production environments will keep the
* same logic and follow the same code paths.
*/
var warning = emptyFunction;
if ("production" !== "production") {
warning = function(condition, format ) {var args=Array.prototype.slice.call(arguments,2);
if (format === undefined) {
throw new Error(
'`warning(condition, format, ...args)` requires a warning ' +
'message argument'
);
}
if (!condition) {
var argIndex = 0;
console.warn('Warning: ' + format.replace(/%s/g, function() {return args[argIndex++];}));
}
};
}
module.exports = warning;
},{"./emptyFunction":49}]},{},[14])
(14)
});
|
tools/bundle.js
|
antklim/tanya_klimenko
|
/**
* React Starter Kit (http://www.reactstarterkit.com/)
*
* Copyright © 2014-2015 Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
import webpack from 'webpack';
import webpackConfig from './webpack.config';
/**
* Bundles JavaScript, CSS and images into one or more packages
* ready to be used in a browser.
*/
function bundle() {
return new Promise((resolve, reject) => {
const bundler = webpack(webpackConfig);
let bundlerRunCount = 0;
function onComplete(err, stats) {
if (err) {
return reject(err);
}
console.log(stats.toString(webpackConfig[0].stats));
if (++bundlerRunCount === (global.WATCH ? webpackConfig.length : 1)) {
return resolve();
}
}
if (global.WATCH) {
bundler.watch(200, onComplete);
} else {
bundler.run(onComplete);
}
});
}
export default bundle;
|
components/TopBar.js
|
DanFoad/Memento
|
import React, { Component } from 'react';
import {
Text,
View,
TouchableHighlight,
Image,
} from 'react-native';
import styles from '../styles'
export default class TopBar extends Component {
constructor(props) {
super(props);
// Initial state
this.state = {
viewType: props.type, // Type of view, e.g. weekly view, semester view etc
size: 64, // Default height of topbar
buttons: [], // Container for topbar buttons
}
// If weekly view
if (this.state.viewType == 'week') {
this.state.size = 96; // Accomodate 32px high buttons
// Create and add buttons to state
this.state.buttons.push(
<View key={'topbar__navigation'} style={styles.topbar__navigation}>
<TouchableHighlight style={styles.topbar__previous} onPress={() => this.props.previous()} underlayColor={'#E0E0E0'}>
<Image style={styles.topbar__button} source={require('../img/previous.png')} />
</TouchableHighlight>
<TouchableHighlight style={styles.topbar__next} onPress={() => this.props.next()} underlayColor={'#E0E0E0'}>
<Image style={styles.topbar__button} source={require('../img/next.png')} />
</TouchableHighlight>
</View>
);
}
}
render() {
return (
<View style={[styles.topbar, {height: this.state.size}]}>
<TouchableHighlight style={styles.topbar__menubuttoncontainer} onPress={() => this.props.openMenu()} underlayColor={'#E0E0E0'}>
<Image style={styles.topbar__menubutton} source={require('../img/menu.png')} />
</TouchableHighlight>
<View style={styles.topbar__titlecontainer}>
<Text style={styles.topbar__title}>M E M E N T O</Text>
</View>
{this.state.buttons}
</View>
);
}
}
|
eventkit_cloud/ui/static/ui/app/containers/logoutContainer.js
|
venicegeo/eventkit-cloud
|
import PropTypes from 'prop-types';
import React from 'react';
import { connect } from 'react-redux';
import { logout } from '../actions/userActions';
const createHandlers = (dispatch) => {
const handleLogout = () => {
dispatch(logout());
};
return {
handleLogout,
};
};
class Logout extends React.Component {
constructor(props) {
super(props);
this.handlers = createHandlers(this.props.dispatch);
}
componentDidMount() {
this.handlers.handleLogout();
}
render() {
const styles = {
wholeDiv: {
width: '100%',
height: '100%',
backgroundColor: 'black',
marginBottom: '0px',
},
root: {
justifyContent: 'space-around',
display: 'flex',
flexWrap: 'wrap',
height: 'calc(100vh - 95px)',
},
};
return (
<div style={styles.wholeDiv}>
<div style={styles.root} />
</div>
);
}
}
Logout.propTypes = {
dispatch: PropTypes.func.isRequired,
};
export default connect()(Logout);
|
packages/flow-upgrade/src/upgrades/0.53.0/ReactComponentExplicitTypeArgs/__tests__/fixtures/State.js
|
AgentME/flow
|
// @flow
import React from 'react';
class MyComponent extends React.Component {
props: Props;
state: State = {};
defaultProps: T;
static props: T;
static state: T;
a: T;
b = 5;
c: T = 5;
method() {}
}
const expression = () =>
class extends React.Component {
props: Props;
state: State = {};
defaultProps: T;
static props: T;
static state: T;
a: T;
b = 5;
c: T = 5;
method() {}
}
|
app/view/android/DoKitchenPager/KitchenList.js
|
1598692232/rn-xcf
|
/**
* Created by bll on 2017/7/21.
*/
import React from 'react';
import {
Text,
Button,
View
} from 'react-native';
export default class DoKitchenPager extends React.Component {
render() {
const { navigate } = this.props.navigation;
return (
<View>
<Text>Hello, DoKitchenPager!</Text>
<Button
onPress={() => navigate('Chat',{user:'Sybil'})}
title="Chat with Lucy"
/>
</View>
);
}
}
|
src/__tests__/AutoComplete.spec.js
|
mauriciojovel/redux-form-material-ui
|
import React from 'react'
import TestUtils from 'react-addons-test-utils'
import expect, { createSpy } from 'expect'
import expectJsx from 'expect-jsx'
import AutoComplete from 'material-ui/AutoComplete'
import getMuiTheme from 'material-ui/styles/getMuiTheme'
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'
import noop from 'lodash.noop'
import ReduxFormMaterialUIAutoComplete from '../AutoComplete'
expect.extend(expectJsx)
describe('AutoComplete', () => {
const dataSource = [
'One',
'Two',
'Three'
]
it('has a display name', () => {
expect(ReduxFormMaterialUIAutoComplete.displayName)
.toBe('ReduxFormMaterialUIAutoComplete')
})
it('renders an AutoComplete', () => {
expect(new ReduxFormMaterialUIAutoComplete({
dataSource,
input: {
name: 'myAutoComplete',
value: 'Foo'
}
}).render())
.toEqualJSX(<AutoComplete dataSource={dataSource} name="myAutoComplete" searchText="Foo"
onNewRequest={noop} ref="component"/>)
})
it('renders an AutoComplete with no error when not touched', () => {
expect(new ReduxFormMaterialUIAutoComplete({
dataSource,
input: {
name: 'myAutoComplete',
value: 'Foo'
},
meta: {
error: 'FooError'
}
}).render())
.toEqualJSX(<AutoComplete dataSource={dataSource} name="myAutoComplete" searchText="Foo"
onNewRequest={noop} ref="component"/>)
})
it('renders an AutoComplete with an error', () => {
expect(new ReduxFormMaterialUIAutoComplete({
dataSource,
input: {
name: 'myAutoComplete',
value: 'Foo'
},
meta: {
error: 'FooError',
touched: true
}
}).render())
.toEqualJSX(<AutoComplete dataSource={dataSource} name="myAutoComplete" searchText="Foo"
errorText="FooError" onNewRequest={noop} ref="component"/>)
})
it('renders an AutoComplete with no warning when not touched', () => {
expect(new ReduxFormMaterialUIAutoComplete({
dataSource,
input: {
name: 'myAutoComplete',
value: 'Foo'
},
meta: {
warning: 'FooWarning'
}
}).render())
.toEqualJSX(<AutoComplete dataSource={dataSource} name="myAutoComplete" searchText="Foo"
onNewRequest={noop} ref="component"/>)
})
it('renders an AutoComplete with an warning', () => {
expect(new ReduxFormMaterialUIAutoComplete({
dataSource,
input: {
name: 'myAutoComplete',
value: 'Foo'
},
meta: {
warning: 'FooWarning',
touched: true
}
}).render())
.toEqualJSX(<AutoComplete dataSource={dataSource} name="myAutoComplete" searchText="Foo"
errorText="FooWarning" onNewRequest={noop} ref="component"/>)
})
it('maps onNewRequest properly', () => {
const onChange = createSpy()
const dom = TestUtils.renderIntoDocument(
<MuiThemeProvider muiTheme={getMuiTheme()}>
<ReduxFormMaterialUIAutoComplete dataSource={dataSource} name="myAutoComplete"
input={{ onChange, value: 'Foo' }}/>
</MuiThemeProvider>
)
const autocomplete = TestUtils.findRenderedComponentWithType(dom, AutoComplete)
expect(onChange).toNotHaveBeenCalled()
autocomplete.props.onNewRequest('TheValue')
expect(onChange)
.toHaveBeenCalled()
.toHaveBeenCalledWith('TheValue')
})
it('provides getRenderedComponent', () => {
const dom = TestUtils.renderIntoDocument(
<MuiThemeProvider muiTheme={getMuiTheme()}>
<ReduxFormMaterialUIAutoComplete dataSource={dataSource}
input={{ name: 'myAutoComplete' }}/>
</MuiThemeProvider>
)
const element =
TestUtils.findRenderedComponentWithType(dom, ReduxFormMaterialUIAutoComplete)
expect(element.getRenderedComponent).toBeA('function')
expect(element.getRenderedComponent()).toExist()
})
})
|
docs/src/pages/components/breadcrumbs/IconBreadcrumbs.js
|
kybarg/material-ui
|
import React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import Paper from '@material-ui/core/Paper';
import Typography from '@material-ui/core/Typography';
import Breadcrumbs from '@material-ui/core/Breadcrumbs';
import Link from '@material-ui/core/Link';
import HomeIcon from '@material-ui/icons/Home';
import WhatshotIcon from '@material-ui/icons/Whatshot';
import GrainIcon from '@material-ui/icons/Grain';
const useStyles = makeStyles(theme => ({
root: {
padding: theme.spacing(1, 2),
},
link: {
display: 'flex',
},
icon: {
marginRight: theme.spacing(0.5),
width: 20,
height: 20,
},
}));
function handleClick(event) {
event.preventDefault();
alert('You clicked a breadcrumb.');
}
export default function IconBreadcrumbs() {
const classes = useStyles();
return (
<Paper elevation={0} className={classes.root}>
<Breadcrumbs aria-label="breadcrumb">
<Link color="inherit" href="/" onClick={handleClick} className={classes.link}>
<HomeIcon className={classes.icon} />
Material-UI
</Link>
<Link
color="inherit"
href="/getting-started/installation/"
onClick={handleClick}
className={classes.link}
>
<WhatshotIcon className={classes.icon} />
Core
</Link>
<Typography color="textPrimary" className={classes.link}>
<GrainIcon className={classes.icon} />
Breadcrumb
</Typography>
</Breadcrumbs>
</Paper>
);
}
|
src/components/Search/Search.js
|
worknation/client.work.nation
|
import {d} from 'lightsaber/lib/log'
import React from 'react'
import {SearchForPeople} from '..'
import Auth from '../../models/Authentication'
export default class Search extends React.Component {
componentWillMount() {
Auth.redirectUnlessLoggedIn(this.props)
}
render() {
if (!Auth.getCurrentUser()) return null
return <SearchForPeople
title="Search"
subtitle="Search for people by contribution"
/>
}
}
|
pootle/static/js/editor/components/UnitSource.js
|
evernote/zing
|
/*
* Copyright (C) Pootle contributors.
*
* This file is a part of the Pootle project. It is distributed under the GPL3
* or later license. See the LICENSE file for a copy of the license and the
* AUTHORS file for copyright and authorship information.
*/
import cx from 'classnames';
import React from 'react';
import { t } from 'utils/i18n';
import { highlightRW } from '../../utils';
const UnitSource = React.createClass({
propTypes: {
canEdit: React.PropTypes.bool.isRequired,
id: React.PropTypes.number.isRequired,
values: React.PropTypes.array.isRequired,
hasPlurals: React.PropTypes.bool.isRequired,
sourceLocaleCode: React.PropTypes.string,
sourceLocaleDir: React.PropTypes.string,
},
createItem(sourceValue, index) {
const props = {
lang: this.props.sourceLocaleCode,
dir: this.props.sourceLocaleDir,
};
const placeablesExtraClassName = this.props.canEdit ? 'js-editor-copytext' : '';
return (
<div key={`source-value-${index}`}>
{this.props.hasPlurals && (
<div className="plural-form-label">
{t('Plural form %(index)s', { index })}
</div>
)}
<div
className="translation-text js-translation-text"
data-string={sourceValue}
dangerouslySetInnerHTML={{
__html: highlightRW(sourceValue, placeablesExtraClassName),
}}
{...props}
></div>
</div>
);
},
render() {
const classNames = cx('translate-original', {
'translate-plural': this.props.hasPlurals,
});
return (
<div id={`js-unit-${this.props.id}`} className={classNames}>
{this.props.values.map(this.createItem)}
</div>
);
},
});
export default UnitSource;
|
src/helpers/__tests__/makeRouteHooksSafe-test.js
|
mull/require_hacker_error_reproduction
|
import { expect } from 'chai';
import React from 'react';
import { IndexRoute, Route } from 'react-router';
import makeRouteHooksSafe from '../makeRouteHooksSafe';
describe('makeRouteHooksSafe', () => {
it('should work with JSX routes', () => {
const onEnter = () => {
throw new Error('Shouldn\'t call onEnter');
};
const getRoutes = makeRouteHooksSafe(() => {
return (
<Route path="/" >
<IndexRoute onEnter={onEnter} />
<Route path="1" />
<Route onEnter={onEnter}>
<Route path="2" />
<Route path="3" onEnter={onEnter}/>
</Route>
</Route>
);
});
const routes = getRoutes(null);
expect(routes[0].indexRoute.onEnter).to.not.throw(Error);
expect(routes[0].childRoutes[1].onEnter).to.not.throw(Error);
expect(routes[0].childRoutes[1].childRoutes[1].onEnter).to.not.throw(Error);
});
it('should work with JS routes', () => {
const onEnter = () => {
throw new Error('Shouldn\'t call onEnter');
};
const getRoutes = makeRouteHooksSafe(() => {
return {
path: '/',
indexRoute: {
onEnter: onEnter
},
onEnter: onEnter,
childRoutes: [
{path: '1'},
{
onEnter: onEnter,
childRoutes: [
{path: '2'},
{path: '3'}
],
}
]
};
});
const routes = getRoutes(null);
expect(routes[0].indexRoute.onEnter).to.not.throw(Error);
expect(routes[0].onEnter).to.not.throw(Error);
expect(routes[0].childRoutes[1].onEnter).to.not.throw(Error);
});
it('should call onEnter if store is initialised', (done) => {
const store = {
getState: () => {}
};
const getRoutes = makeRouteHooksSafe(() => {
return {
onEnter: () => {
done();
}
};
});
const routes = getRoutes(store);
routes[0].onEnter();
});
it('should call callback', (done) => {
const getRoutes = makeRouteHooksSafe(() => {
return {
onEnter: (nextState, replaceState, cb) => {} // eslint-disable-line no-unused-vars
};
});
const routes = getRoutes(null);
routes[0].onEnter(null, null, done);
});
it('should not call callback', () => {
const callback = () => {
throw new Error('Should not be called');
};
const getRoutes = makeRouteHooksSafe(() => {
return {
onEnter: (nextState, replaceState) => {} // eslint-disable-line no-unused-vars
};
});
const routes = getRoutes(null);
routes[0].onEnter(null, null, callback);
});
});
|
ajax/libs/redux-little-router/13.0.0-0/redux-little-router.js
|
hare1039/cdnjs
|
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("react"));
else if(typeof define === 'function' && define.amd)
define(["react"], factory);
else if(typeof exports === 'object')
exports["ReduxLittleRouter"] = factory(require("react"));
else
root["ReduxLittleRouter"] = factory(root["React"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_35__) {
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';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.GO_BACK = exports.GO_FORWARD = exports.GO = exports.REPLACE = exports.PUSH = exports.LOCATION_CHANGED = exports.goForward = exports.goBack = exports.go = exports.replace = exports.push = exports.Fragment = exports.PersistentQueryLink = exports.Link = exports.RouterProvider = exports.provideRouter = exports.initializeCurrentLocation = exports.routerForHapi = exports.routerForExpress = exports.routerForBrowser = undefined;
var _types = __webpack_require__(1);
var _actions = __webpack_require__(2);
var _browserRouter = __webpack_require__(8);
var _browserRouter2 = _interopRequireDefault(_browserRouter);
var _expressRouter = __webpack_require__(31);
var _expressRouter2 = _interopRequireDefault(_expressRouter);
var _hapiRouter = __webpack_require__(33);
var _hapiRouter2 = _interopRequireDefault(_hapiRouter);
var _provider = __webpack_require__(34);
var _provider2 = _interopRequireDefault(_provider);
var _link = __webpack_require__(65);
var _fragment = __webpack_require__(67);
var _fragment2 = _interopRequireDefault(_fragment);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.routerForBrowser = _browserRouter2.default;
exports.routerForExpress = _expressRouter2.default;
exports.routerForHapi = _hapiRouter2.default;
exports.initializeCurrentLocation = _actions.initializeCurrentLocation;
exports.provideRouter = _provider2.default;
exports.RouterProvider = _provider.RouterProvider;
exports.Link = _link.Link;
exports.PersistentQueryLink = _link.PersistentQueryLink;
exports.Fragment = _fragment2.default;
exports.push = _actions.push;
exports.replace = _actions.replace;
exports.go = _actions.go;
exports.goBack = _actions.goBack;
exports.goForward = _actions.goForward;
exports.LOCATION_CHANGED = _types.LOCATION_CHANGED;
exports.PUSH = _types.PUSH;
exports.REPLACE = _types.REPLACE;
exports.GO = _types.GO;
exports.GO_FORWARD = _types.GO_FORWARD;
exports.GO_BACK = _types.GO_BACK;
/***/ },
/* 1 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var LOCATION_CHANGED = exports.LOCATION_CHANGED = 'ROUTER_LOCATION_CHANGED';
var PUSH = exports.PUSH = 'ROUTER_PUSH';
var REPLACE = exports.REPLACE = 'ROUTER_REPLACE';
var GO = exports.GO = 'ROUTER_GO';
var GO_BACK = exports.GO_BACK = 'ROUTER_GO_BACK';
var GO_FORWARD = exports.GO_FORWARD = 'ROUTER_GO_FORWARD';
/***/ },
/* 2 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.initializeCurrentLocation = exports.locationDidChange = exports.goForward = exports.goBack = exports.go = exports.replace = exports.push = undefined;
var _types = __webpack_require__(1);
var _normalizeHref = __webpack_require__(3);
var _normalizeHref2 = _interopRequireDefault(_normalizeHref);
var _locationState = __webpack_require__(7);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var push = exports.push = function push(href, options) {
return {
type: _types.PUSH,
payload: (0, _locationState.packState)((0, _normalizeHref2.default)(href), options)
};
};
var replace = exports.replace = function replace(href, options) {
return {
type: _types.REPLACE,
payload: (0, _locationState.packState)((0, _normalizeHref2.default)(href), options)
};
};
var go = exports.go = function go(index) {
return {
type: _types.GO,
payload: index
};
};
var goBack = exports.goBack = function goBack() {
return { type: _types.GO_BACK };
};
var goForward = exports.goForward = function goForward() {
return { type: _types.GO_FORWARD };
};
var locationDidChange = exports.locationDidChange = function locationDidChange(location) {
return {
type: _types.LOCATION_CHANGED,
payload: location
};
};
var initializeCurrentLocation = exports.initializeCurrentLocation = function initializeCurrentLocation(location) {
return {
type: _types.LOCATION_CHANGED,
payload: location
};
};
/***/ },
/* 3 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _queryString = __webpack_require__(4);
var _queryString2 = _interopRequireDefault(_queryString);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = function (href) {
if (typeof href === 'string') {
var pathnameAndSearch = href.split('?');
var pathname = pathnameAndSearch[0];
var _search = pathnameAndSearch[1];
var _query = _search && _queryString2.default.parse(_search);
return _query ? { pathname: pathname, query: _query, search: '?' + _search } : { pathname: pathname };
}
var search = href.search,
query = href.query;
var resolvedSearch = search || query && Object.keys(query).length && '?' + _queryString2.default.stringify(query) || '';
var resolvedQuery = query || _queryString2.default.parse(search);
return _extends({}, href, {
search: resolvedSearch,
query: resolvedQuery
});
};
/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var strictUriEncode = __webpack_require__(5);
var objectAssign = __webpack_require__(6);
function encoderForArrayFormat(opts) {
switch (opts.arrayFormat) {
case 'index':
return function (key, value, index) {
return value === null ? [
encode(key, opts),
'[',
index,
']'
].join('') : [
encode(key, opts),
'[',
encode(index, opts),
']=',
encode(value, opts)
].join('');
};
case 'bracket':
return function (key, value) {
return value === null ? encode(key, opts) : [
encode(key, opts),
'[]=',
encode(value, opts)
].join('');
};
default:
return function (key, value) {
return value === null ? encode(key, opts) : [
encode(key, opts),
'=',
encode(value, opts)
].join('');
};
}
}
function parserForArrayFormat(opts) {
var result;
switch (opts.arrayFormat) {
case 'index':
return function (key, value, accumulator) {
result = /\[(\d*)\]$/.exec(key);
key = key.replace(/\[\d*\]$/, '');
if (!result) {
accumulator[key] = value;
return;
}
if (accumulator[key] === undefined) {
accumulator[key] = {};
}
accumulator[key][result[1]] = value;
};
case 'bracket':
return function (key, value, accumulator) {
result = /(\[\])$/.exec(key);
key = key.replace(/\[\]$/, '');
if (!result || accumulator[key] === undefined) {
accumulator[key] = value;
return;
}
accumulator[key] = [].concat(accumulator[key], value);
};
default:
return function (key, value, accumulator) {
if (accumulator[key] === undefined) {
accumulator[key] = value;
return;
}
accumulator[key] = [].concat(accumulator[key], value);
};
}
}
function encode(value, opts) {
if (opts.encode) {
return opts.strict ? strictUriEncode(value) : encodeURIComponent(value);
}
return value;
}
function keysSorter(input) {
if (Array.isArray(input)) {
return input.sort();
} else if (typeof input === 'object') {
return keysSorter(Object.keys(input)).sort(function (a, b) {
return Number(a) - Number(b);
}).map(function (key) {
return input[key];
});
}
return input;
}
exports.extract = function (str) {
return str.split('?')[1] || '';
};
exports.parse = function (str, opts) {
opts = objectAssign({arrayFormat: 'none'}, opts);
var formatter = parserForArrayFormat(opts);
// Create an object with no prototype
// https://github.com/sindresorhus/query-string/issues/47
var ret = Object.create(null);
if (typeof str !== 'string') {
return ret;
}
str = str.trim().replace(/^(\?|#|&)/, '');
if (!str) {
return ret;
}
str.split('&').forEach(function (param) {
var parts = param.replace(/\+/g, ' ').split('=');
// Firefox (pre 40) decodes `%3D` to `=`
// https://github.com/sindresorhus/query-string/pull/37
var key = parts.shift();
var val = parts.length > 0 ? parts.join('=') : undefined;
// missing `=` should be `null`:
// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
val = val === undefined ? null : decodeURIComponent(val);
formatter(decodeURIComponent(key), val, ret);
});
return Object.keys(ret).sort().reduce(function (result, key) {
var val = ret[key];
if (Boolean(val) && typeof val === 'object' && !Array.isArray(val)) {
// Sort object keys, not values
result[key] = keysSorter(val);
} else {
result[key] = val;
}
return result;
}, Object.create(null));
};
exports.stringify = function (obj, opts) {
var defaults = {
encode: true,
strict: true,
arrayFormat: 'none'
};
opts = objectAssign(defaults, opts);
var formatter = encoderForArrayFormat(opts);
return obj ? Object.keys(obj).sort().map(function (key) {
var val = obj[key];
if (val === undefined) {
return '';
}
if (val === null) {
return encode(key, opts);
}
if (Array.isArray(val)) {
var result = [];
val.slice().forEach(function (val2) {
if (val2 === undefined) {
return;
}
result.push(formatter(key, val2, result.length));
});
return result.join('&');
}
return encode(key, opts) + '=' + encode(val, opts);
}).filter(function (x) {
return x.length > 0;
}).join('&') : '';
};
/***/ },
/* 5 */
/***/ function(module, exports) {
'use strict';
module.exports = function (str) {
return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {
return '%' + c.charCodeAt(0).toString(16).toUpperCase();
});
};
/***/ },
/* 6 */
/***/ function(module, exports) {
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/
'use strict';
/* eslint-disable no-unused-vars */
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var hasOwnProperty = Object.prototype.hasOwnProperty;
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
function toObject(val) {
if (val === null || val === undefined) {
throw new TypeError('Object.assign cannot be called with null or undefined');
}
return Object(val);
}
function shouldUseNative() {
try {
if (!Object.assign) {
return false;
}
// Detect buggy property enumeration order in older V8 versions.
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
test1[5] = 'de';
if (Object.getOwnPropertyNames(test1)[0] === '5') {
return false;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test2 = {};
for (var i = 0; i < 10; i++) {
test2['_' + String.fromCharCode(i)] = i;
}
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
return test2[n];
});
if (order2.join('') !== '0123456789') {
return false;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test3 = {};
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
test3[letter] = letter;
});
if (Object.keys(Object.assign({}, test3)).join('') !==
'abcdefghijklmnopqrst') {
return false;
}
return true;
} catch (err) {
// We don't expect any of the above to throw, but better to be safe.
return false;
}
}
module.exports = shouldUseNative() ? Object.assign : function (target, source) {
var from;
var to = toObject(target);
var symbols;
for (var s = 1; s < arguments.length; s++) {
from = Object(arguments[s]);
for (var key in from) {
if (hasOwnProperty.call(from, key)) {
to[key] = from[key];
}
}
if (getOwnPropertySymbols) {
symbols = getOwnPropertySymbols(from);
for (var i = 0; i < symbols.length; i++) {
if (propIsEnumerable.call(from, symbols[i])) {
to[symbols[i]] = from[symbols[i]];
}
}
}
}
return to;
};
/***/ },
/* 7 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
var packState = function packState(location) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
// eslint-disable-next-line no-unused-vars
var query = location.query,
rest = _objectWithoutProperties(location, ['query']);
return _extends({}, rest, {
state: _extends({}, rest.state || {}, {
// Namespace our state to prevent interference
// with user-provided state
reduxLittleRouter: {
query: query || {},
options: options
}
})
});
};
exports.packState = packState;
var unpackState = function unpackState(location) {
var _location$state = location.state,
state = _location$state === undefined ? {} : _location$state,
restLocation = _objectWithoutProperties(location, ['state']);
var _state$reduxLittleRou = state.reduxLittleRouter,
reduxLittleRouter = _state$reduxLittleRou === undefined ? {} : _state$reduxLittleRou,
restState = _objectWithoutProperties(state, ['reduxLittleRouter']);
var _reduxLittleRouter$qu = reduxLittleRouter.query,
query = _reduxLittleRouter$qu === undefined ? {} : _reduxLittleRouter$qu,
_reduxLittleRouter$op = reduxLittleRouter.options,
options = _reduxLittleRouter$op === undefined ? {} : _reduxLittleRouter$op;
return _extends({}, restLocation, {
state: restState,
query: query,
options: options
});
};
exports.unpackState = unpackState;
/***/ },
/* 8 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createBrowserHistory = __webpack_require__(9);
var _createBrowserHistory2 = _interopRequireDefault(_createBrowserHistory);
var _normalizeHref = __webpack_require__(3);
var _normalizeHref2 = _interopRequireDefault(_normalizeHref);
var _install = __webpack_require__(20);
var _install2 = _interopRequireDefault(_install);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next: unstubbable! */
var realLocation = function realLocation() {
return window.location;
};
exports.default = function (_ref) {
var routes = _ref.routes,
basename = _ref.basename,
_ref$getLocation = _ref.getLocation,
getLocation = _ref$getLocation === undefined ? realLocation : _ref$getLocation;
var history = (0, _createBrowserHistory2.default)({ basename: basename });
var _getLocation = getLocation(),
fullPathname = _getLocation.pathname,
search = _getLocation.search;
// Strip the basename from the initial pathname
var pathname = basename ? fullPathname.replace(basename, '') : fullPathname;
var descriptor = basename ? { pathname: pathname, basename: basename, search: search } : { pathname: pathname, search: search };
var location = (0, _normalizeHref2.default)(descriptor);
return (0, _install2.default)({ routes: routes, history: history, location: location });
};
/***/ },
/* 9 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {'use strict';
exports.__esModule = true;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _warning = __webpack_require__(11);
var _warning2 = _interopRequireDefault(_warning);
var _invariant = __webpack_require__(12);
var _invariant2 = _interopRequireDefault(_invariant);
var _LocationUtils = __webpack_require__(13);
var _PathUtils = __webpack_require__(16);
var _createTransitionManager = __webpack_require__(17);
var _createTransitionManager2 = _interopRequireDefault(_createTransitionManager);
var _ExecutionEnvironment = __webpack_require__(18);
var _DOMUtils = __webpack_require__(19);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var PopStateEvent = 'popstate';
var HashChangeEvent = 'hashchange';
var getHistoryState = function getHistoryState() {
try {
return window.history.state || {};
} catch (e) {
// IE 11 sometimes throws when accessing window.history.state
// See https://github.com/mjackson/history/pull/289
return {};
}
};
/**
* Creates a history object that uses the HTML5 history API including
* pushState, replaceState, and the popstate event.
*/
var createBrowserHistory = function createBrowserHistory() {
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
!_ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? (0, _invariant2.default)(false, 'Browser history needs a DOM') : (0, _invariant2.default)(false) : void 0;
var globalHistory = window.history;
var canUseHistory = (0, _DOMUtils.supportsHistory)();
var needsHashChangeListener = !(0, _DOMUtils.supportsPopStateOnHashChange)();
var _props$basename = props.basename,
basename = _props$basename === undefined ? '' : _props$basename,
_props$forceRefresh = props.forceRefresh,
forceRefresh = _props$forceRefresh === undefined ? false : _props$forceRefresh,
_props$getUserConfirm = props.getUserConfirmation,
getUserConfirmation = _props$getUserConfirm === undefined ? _DOMUtils.getConfirmation : _props$getUserConfirm,
_props$keyLength = props.keyLength,
keyLength = _props$keyLength === undefined ? 6 : _props$keyLength;
var getDOMLocation = function getDOMLocation(historyState) {
var _ref = historyState || {},
key = _ref.key,
state = _ref.state;
var _window$location = window.location,
pathname = _window$location.pathname,
search = _window$location.search,
hash = _window$location.hash;
var path = pathname + search + hash;
if (basename) path = (0, _PathUtils.stripPrefix)(path, basename);
return _extends({}, (0, _PathUtils.parsePath)(path), {
state: state,
key: key
});
};
var createKey = function createKey() {
return Math.random().toString(36).substr(2, keyLength);
};
var transitionManager = (0, _createTransitionManager2.default)();
var setState = function setState(nextState) {
_extends(history, nextState);
history.length = globalHistory.length;
transitionManager.notifyListeners(history.location, history.action);
};
var handlePopState = function handlePopState(event) {
// Ignore extraneous popstate events in WebKit.
if ((0, _DOMUtils.isExtraneousPopstateEvent)(event)) return;
handlePop(getDOMLocation(event.state));
};
var handleHashChange = function handleHashChange() {
handlePop(getDOMLocation(getHistoryState()));
};
var forceNextPop = false;
var handlePop = function handlePop(location) {
if (forceNextPop) {
forceNextPop = false;
setState();
} else {
(function () {
var action = 'POP';
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
if (ok) {
setState({ action: action, location: location });
} else {
revertPop(location);
}
});
})();
}
};
var revertPop = function revertPop(fromLocation) {
var toLocation = history.location;
// TODO: We could probably make this more reliable by
// keeping a list of keys we've seen in sessionStorage.
// Instead, we just default to 0 for keys we don't know.
var toIndex = allKeys.indexOf(toLocation.key);
if (toIndex === -1) toIndex = 0;
var fromIndex = allKeys.indexOf(fromLocation.key);
if (fromIndex === -1) fromIndex = 0;
var delta = toIndex - fromIndex;
if (delta) {
forceNextPop = true;
go(delta);
}
};
var initialLocation = getDOMLocation(getHistoryState());
var allKeys = [initialLocation.key];
// Public interface
var createHref = function createHref(location) {
return basename + (0, _PathUtils.createPath)(location);
};
var push = function push(path, state) {
process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(!((typeof path === 'undefined' ? 'undefined' : _typeof(path)) === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to push when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : void 0;
var action = 'PUSH';
var location = (0, _LocationUtils.createLocation)(path, state, createKey(), history.location);
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
if (!ok) return;
var href = createHref(location);
var key = location.key,
state = location.state;
if (canUseHistory) {
globalHistory.pushState({ key: key, state: state }, null, href);
if (forceRefresh) {
window.location.href = href;
} else {
var prevIndex = allKeys.indexOf(history.location.key);
var nextKeys = allKeys.slice(0, prevIndex === -1 ? 0 : prevIndex + 1);
nextKeys.push(location.key);
allKeys = nextKeys;
setState({ action: action, location: location });
}
} else {
process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(state === undefined, 'Browser history cannot push state in browsers that do not support HTML5 history') : void 0;
window.location.href = href;
}
});
};
var replace = function replace(path, state) {
process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(!((typeof path === 'undefined' ? 'undefined' : _typeof(path)) === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to replace when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : void 0;
var action = 'REPLACE';
var location = (0, _LocationUtils.createLocation)(path, state, createKey(), history.location);
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
if (!ok) return;
var href = createHref(location);
var key = location.key,
state = location.state;
if (canUseHistory) {
globalHistory.replaceState({ key: key, state: state }, null, href);
if (forceRefresh) {
window.location.replace(href);
} else {
var prevIndex = allKeys.indexOf(history.location.key);
if (prevIndex !== -1) allKeys[prevIndex] = location.key;
setState({ action: action, location: location });
}
} else {
process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(state === undefined, 'Browser history cannot replace state in browsers that do not support HTML5 history') : void 0;
window.location.replace(href);
}
});
};
var go = function go(n) {
globalHistory.go(n);
};
var goBack = function goBack() {
return go(-1);
};
var goForward = function goForward() {
return go(1);
};
var listenerCount = 0;
var checkDOMListeners = function checkDOMListeners(delta) {
listenerCount += delta;
if (listenerCount === 1) {
(0, _DOMUtils.addEventListener)(window, PopStateEvent, handlePopState);
if (needsHashChangeListener) (0, _DOMUtils.addEventListener)(window, HashChangeEvent, handleHashChange);
} else if (listenerCount === 0) {
(0, _DOMUtils.removeEventListener)(window, PopStateEvent, handlePopState);
if (needsHashChangeListener) (0, _DOMUtils.removeEventListener)(window, HashChangeEvent, handleHashChange);
}
};
var isBlocked = false;
var block = function block() {
var prompt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
var unblock = transitionManager.setPrompt(prompt);
if (!isBlocked) {
checkDOMListeners(1);
isBlocked = true;
}
return function () {
if (isBlocked) {
isBlocked = false;
checkDOMListeners(-1);
}
return unblock();
};
};
var listen = function listen(listener) {
var unlisten = transitionManager.appendListener(listener);
checkDOMListeners(1);
return function () {
checkDOMListeners(-1);
return unlisten();
};
};
var history = {
length: globalHistory.length,
action: 'POP',
location: initialLocation,
createHref: createHref,
push: push,
replace: replace,
go: go,
goBack: goBack,
goForward: goForward,
block: block,
listen: listen
};
return history;
};
exports.default = createBrowserHistory;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10)))
/***/ },
/* 10 */
/***/ function(module, exports) {
// shim for using process in browser
var process = module.exports = {};
// cached from whatever global is present so that test runners that stub it
// don't break things. But we need to wrap it in a try catch in case it is
// wrapped in strict mode code which doesn't define any globals. It's inside a
// function because try/catches deoptimize in certain engines.
var cachedSetTimeout;
var cachedClearTimeout;
function defaultSetTimout() {
throw new Error('setTimeout has not been defined');
}
function defaultClearTimeout () {
throw new Error('clearTimeout has not been defined');
}
(function () {
try {
if (typeof setTimeout === 'function') {
cachedSetTimeout = setTimeout;
} else {
cachedSetTimeout = defaultSetTimout;
}
} catch (e) {
cachedSetTimeout = defaultSetTimout;
}
try {
if (typeof clearTimeout === 'function') {
cachedClearTimeout = clearTimeout;
} else {
cachedClearTimeout = defaultClearTimeout;
}
} catch (e) {
cachedClearTimeout = defaultClearTimeout;
}
} ())
function runTimeout(fun) {
if (cachedSetTimeout === setTimeout) {
//normal enviroments in sane situations
return setTimeout(fun, 0);
}
// if setTimeout wasn't available but was latter defined
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
cachedSetTimeout = setTimeout;
return setTimeout(fun, 0);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedSetTimeout(fun, 0);
} catch(e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedSetTimeout.call(null, fun, 0);
} catch(e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
return cachedSetTimeout.call(this, fun, 0);
}
}
}
function runClearTimeout(marker) {
if (cachedClearTimeout === clearTimeout) {
//normal enviroments in sane situations
return clearTimeout(marker);
}
// if clearTimeout wasn't available but was latter defined
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
cachedClearTimeout = clearTimeout;
return clearTimeout(marker);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedClearTimeout(marker);
} catch (e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedClearTimeout.call(null, marker);
} catch (e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
return cachedClearTimeout.call(this, marker);
}
}
}
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
if (!draining || !currentQueue) {
return;
}
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}
function drainQueue() {
if (draining) {
return;
}
var timeout = runTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
while (++queueIndex < len) {
if (currentQueue) {
currentQueue[queueIndex].run();
}
}
queueIndex = -1;
len = queue.length;
}
currentQueue = null;
draining = false;
runClearTimeout(timeout);
}
process.nextTick = function (fun) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
runTimeout(drainQueue);
}
};
// v8 likes predictible objects
function Item(fun, array) {
this.fun = fun;
this.array = array;
}
Item.prototype.run = function () {
this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.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; };
/***/ },
/* 11 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
/**
* Similar to invariant but only logs a warning if the condition is not met.
* This can be used to log issues in development environments in critical
* paths. Removing the logging code for production environments will keep the
* same logic and follow the same code paths.
*/
var warning = function() {};
if (process.env.NODE_ENV !== 'production') {
warning = function(condition, format, args) {
var len = arguments.length;
args = new Array(len > 2 ? len - 2 : 0);
for (var key = 2; key < len; key++) {
args[key - 2] = arguments[key];
}
if (format === undefined) {
throw new Error(
'`warning(condition, format, ...args)` requires a warning ' +
'message argument'
);
}
if (format.length < 10 || (/^[s\W]*$/).test(format)) {
throw new Error(
'The warning format should be able to uniquely identify this ' +
'warning. Please, use a more descriptive format than: ' + format
);
}
if (!condition) {
var argIndex = 0;
var message = 'Warning: ' +
format.replace(/%s/g, function() {
return args[argIndex++];
});
if (typeof console !== 'undefined') {
console.error(message);
}
try {
// This error was thrown as a convenience so that you can use this stack
// to find the callsite that caused this warning to fire.
throw new Error(message);
} catch(x) {}
}
};
}
module.exports = warning;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10)))
/***/ },
/* 12 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
/**
* Use invariant() to assert state which your program assumes to be true.
*
* Provide sprintf-style format (only %s is supported) and arguments
* to provide information about what broke and what you were
* expecting.
*
* The invariant message will be stripped in production, but the invariant
* will remain to ensure logic does not differ in production.
*/
var invariant = function(condition, format, a, b, c, d, e, f) {
if (process.env.NODE_ENV !== 'production') {
if (format === undefined) {
throw new Error('invariant requires an error message argument');
}
}
if (!condition) {
var error;
if (format === undefined) {
error = new Error(
'Minified exception occurred; use the non-minified dev environment ' +
'for the full error message and additional helpful warnings.'
);
} else {
var args = [a, b, c, d, e, f];
var argIndex = 0;
error = new Error(
format.replace(/%s/g, function() { return args[argIndex++]; })
);
error.name = 'Invariant Violation';
}
error.framesToPop = 1; // we don't care about invariant's own frame
throw error;
}
};
module.exports = invariant;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10)))
/***/ },
/* 13 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports.locationsAreEqual = exports.createLocation = undefined;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _resolvePathname = __webpack_require__(14);
var _resolvePathname2 = _interopRequireDefault(_resolvePathname);
var _valueEqual = __webpack_require__(15);
var _valueEqual2 = _interopRequireDefault(_valueEqual);
var _PathUtils = __webpack_require__(16);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var createLocation = exports.createLocation = function createLocation(path, state, key, currentLocation) {
var location = void 0;
if (typeof path === 'string') {
// Two-arg form: push(path, state)
location = (0, _PathUtils.parsePath)(path);
location.state = state;
} else {
// One-arg form: push(location)
location = _extends({}, path);
if (location.pathname === undefined) location.pathname = '';
if (location.search) {
if (location.search.charAt(0) !== '?') location.search = '?' + location.search;
} else {
location.search = '';
}
if (location.hash) {
if (location.hash.charAt(0) !== '#') location.hash = '#' + location.hash;
} else {
location.hash = '';
}
if (state !== undefined && location.state === undefined) location.state = state;
}
location.key = key;
if (currentLocation) {
// Resolve incomplete/relative pathname relative to current location.
if (!location.pathname) {
location.pathname = currentLocation.pathname;
} else if (location.pathname.charAt(0) !== '/') {
location.pathname = (0, _resolvePathname2.default)(location.pathname, currentLocation.pathname);
}
}
return location;
};
var locationsAreEqual = exports.locationsAreEqual = function locationsAreEqual(a, b) {
return a.pathname === b.pathname && a.search === b.search && a.hash === b.hash && a.key === b.key && (0, _valueEqual2.default)(a.state, b.state);
};
/***/ },
/* 14 */
/***/ function(module, exports) {
'use strict';
var isAbsolute = function isAbsolute(pathname) {
return pathname.charAt(0) === '/';
};
// About 1.5x faster than the two-arg version of Array#splice()
var spliceOne = function spliceOne(list, index) {
for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {
list[i] = list[k];
}list.pop();
};
// This implementation is based heavily on node's url.parse
var resolvePathname = function resolvePathname(to) {
var from = arguments.length <= 1 || arguments[1] === undefined ? '' : arguments[1];
var toParts = to && to.split('/') || [];
var fromParts = from && from.split('/') || [];
var isToAbs = to && isAbsolute(to);
var isFromAbs = from && isAbsolute(from);
var mustEndAbs = isToAbs || isFromAbs;
if (to && isAbsolute(to)) {
// to is absolute
fromParts = toParts;
} else if (toParts.length) {
// to is relative, drop the filename
fromParts.pop();
fromParts = fromParts.concat(toParts);
}
if (!fromParts.length) return '/';
var hasTrailingSlash = void 0;
if (fromParts.length) {
var last = fromParts[fromParts.length - 1];
hasTrailingSlash = last === '.' || last === '..' || last === '';
} else {
hasTrailingSlash = false;
}
var up = 0;
for (var i = fromParts.length; i >= 0; i--) {
var part = fromParts[i];
if (part === '.') {
spliceOne(fromParts, i);
} else if (part === '..') {
spliceOne(fromParts, i);
up++;
} else if (up) {
spliceOne(fromParts, i);
up--;
}
}
if (!mustEndAbs) for (; up--; up) {
fromParts.unshift('..');
}if (mustEndAbs && fromParts[0] !== '' && (!fromParts[0] || !isAbsolute(fromParts[0]))) fromParts.unshift('');
var result = fromParts.join('/');
if (hasTrailingSlash && result.substr(-1) !== '/') result += '/';
return result;
};
module.exports = resolvePathname;
/***/ },
/* 15 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var valueEqual = function valueEqual(a, b) {
if (a === b) return true;
if (a == null || b == null) return false;
if (Array.isArray(a)) {
if (!Array.isArray(b) || a.length !== b.length) return false;
return a.every(function (item, index) {
return valueEqual(item, b[index]);
});
}
var aType = typeof a === 'undefined' ? 'undefined' : _typeof(a);
var bType = typeof b === 'undefined' ? 'undefined' : _typeof(b);
if (aType !== bType) return false;
if (aType === 'object') {
var aValue = a.valueOf();
var bValue = b.valueOf();
if (aValue !== a || bValue !== b) return valueEqual(aValue, bValue);
var aKeys = Object.keys(a);
var bKeys = Object.keys(b);
if (aKeys.length !== bKeys.length) return false;
return aKeys.every(function (key) {
return valueEqual(a[key], b[key]);
});
}
return false;
};
exports.default = valueEqual;
/***/ },
/* 16 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
var addLeadingSlash = exports.addLeadingSlash = function addLeadingSlash(path) {
return path.charAt(0) === '/' ? path : '/' + path;
};
var stripLeadingSlash = exports.stripLeadingSlash = function stripLeadingSlash(path) {
return path.charAt(0) === '/' ? path.substr(1) : path;
};
var stripPrefix = exports.stripPrefix = function stripPrefix(path, prefix) {
return path.indexOf(prefix) === 0 ? path.substr(prefix.length) : path;
};
var parsePath = exports.parsePath = function parsePath(path) {
var pathname = path || '/';
var search = '';
var hash = '';
var hashIndex = pathname.indexOf('#');
if (hashIndex !== -1) {
hash = pathname.substr(hashIndex);
pathname = pathname.substr(0, hashIndex);
}
var searchIndex = pathname.indexOf('?');
if (searchIndex !== -1) {
search = pathname.substr(searchIndex);
pathname = pathname.substr(0, searchIndex);
}
return {
pathname: pathname,
search: search === '?' ? '' : search,
hash: hash === '#' ? '' : hash
};
};
var createPath = exports.createPath = function createPath(location) {
var pathname = location.pathname,
search = location.search,
hash = location.hash;
var path = pathname || '/';
if (search && search !== '?') path += search.charAt(0) === '?' ? search : '?' + search;
if (hash && hash !== '#') path += hash.charAt(0) === '#' ? hash : '#' + hash;
return path;
};
/***/ },
/* 17 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {'use strict';
exports.__esModule = true;
var _warning = __webpack_require__(11);
var _warning2 = _interopRequireDefault(_warning);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var createTransitionManager = function createTransitionManager() {
var prompt = null;
var setPrompt = function setPrompt(nextPrompt) {
process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(prompt == null, 'A history supports only one prompt at a time') : void 0;
prompt = nextPrompt;
return function () {
if (prompt === nextPrompt) prompt = null;
};
};
var confirmTransitionTo = function confirmTransitionTo(location, action, getUserConfirmation, callback) {
// TODO: If another transition starts while we're still confirming
// the previous one, we may end up in a weird state. Figure out the
// best way to handle this.
if (prompt != null) {
var result = typeof prompt === 'function' ? prompt(location, action) : prompt;
if (typeof result === 'string') {
if (typeof getUserConfirmation === 'function') {
getUserConfirmation(result, callback);
} else {
process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(false, 'A history needs a getUserConfirmation function in order to use a prompt message') : void 0;
callback(true);
}
} else {
// Return false from a transition hook to cancel the transition.
callback(result !== false);
}
} else {
callback(true);
}
};
var listeners = [];
var appendListener = function appendListener(fn) {
var isActive = true;
var listener = function listener() {
if (isActive) fn.apply(undefined, arguments);
};
listeners.push(listener);
return function () {
isActive = false;
listeners = listeners.filter(function (item) {
return item !== listener;
});
};
};
var notifyListeners = function notifyListeners() {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
listeners.forEach(function (listener) {
return listener.apply(undefined, args);
});
};
return {
setPrompt: setPrompt,
confirmTransitionTo: confirmTransitionTo,
appendListener: appendListener,
notifyListeners: notifyListeners
};
};
exports.default = createTransitionManager;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10)))
/***/ },
/* 18 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
var canUseDOM = exports.canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
/***/ },
/* 19 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
var addEventListener = exports.addEventListener = function addEventListener(node, event, listener) {
return node.addEventListener ? node.addEventListener(event, listener, false) : node.attachEvent('on' + event, listener);
};
var removeEventListener = exports.removeEventListener = function removeEventListener(node, event, listener) {
return node.removeEventListener ? node.removeEventListener(event, listener, false) : node.detachEvent('on' + event, listener);
};
var getConfirmation = exports.getConfirmation = function getConfirmation(message, callback) {
return callback(window.confirm(message));
}; // eslint-disable-line no-alert
/**
* Returns true if the HTML5 history API is supported. Taken from Modernizr.
*
* https://github.com/Modernizr/Modernizr/blob/master/LICENSE
* https://github.com/Modernizr/Modernizr/blob/master/feature-detects/history.js
* changed to avoid false negatives for Windows Phones: https://github.com/reactjs/react-router/issues/586
*/
var supportsHistory = exports.supportsHistory = function supportsHistory() {
var ua = window.navigator.userAgent;
if ((ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1) return false;
return window.history && 'pushState' in window.history;
};
/**
* Returns true if browser fires popstate on hash change.
* IE10 and IE11 do not.
*/
var supportsPopStateOnHashChange = exports.supportsPopStateOnHashChange = function supportsPopStateOnHashChange() {
return window.navigator.userAgent.indexOf('Trident') === -1;
};
/**
* Returns false if using go(n) with hash history causes a full page reload.
*/
var supportsGoWithoutReloadUsingHash = exports.supportsGoWithoutReloadUsingHash = function supportsGoWithoutReloadUsingHash() {
return window.navigator.userAgent.indexOf('Firefox') === -1;
};
/**
* Returns true if a given popstate event is an extraneous WebKit event.
* Accounts for the fact that Chrome on iOS fires real popstate events
* containing undefined state when pressing the back button.
*/
var isExtraneousPopstateEvent = exports.isExtraneousPopstateEvent = function isExtraneousPopstateEvent(event) {
return event.state === undefined && navigator.userAgent.indexOf('CriOS') === -1;
};
/***/ },
/* 20 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _reducer = __webpack_require__(21);
var _reducer2 = _interopRequireDefault(_reducer);
var _middleware = __webpack_require__(22);
var _middleware2 = _interopRequireDefault(_middleware);
var _enhancer = __webpack_require__(23);
var _enhancer2 = _interopRequireDefault(_enhancer);
var _createMatcher = __webpack_require__(25);
var _createMatcher2 = _interopRequireDefault(_createMatcher);
var _validateRoutes = __webpack_require__(28);
var _validateRoutes2 = _interopRequireDefault(_validateRoutes);
var _flattenRoutes = __webpack_require__(29);
var _flattenRoutes2 = _interopRequireDefault(_flattenRoutes);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = function (_ref) {
var nestedRoutes = _ref.routes,
history = _ref.history,
location = _ref.location,
_ref$createMatcher = _ref.createMatcher,
createMatcher = _ref$createMatcher === undefined ? _createMatcher2.default : _ref$createMatcher;
(0, _validateRoutes2.default)(nestedRoutes);
var routes = (0, _flattenRoutes2.default)(nestedRoutes);
var matchRoute = createMatcher(routes);
var matchWildcardRoute = createMatcher(routes, true);
return {
reducer: (0, _reducer2.default)(_extends({}, location, matchRoute(location.pathname))),
middleware: (0, _middleware2.default)({ history: history }),
enhancer: (0, _enhancer2.default)({
routes: routes,
history: history,
matchRoute: matchRoute,
matchWildcardRoute: matchWildcardRoute
})
};
};
/***/ },
/* 21 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _types = __webpack_require__(1);
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
var flow = function flow() {
for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) {
funcs[_key] = arguments[_key];
}
return funcs.reduce(function (prev, curr) {
return function () {
return curr(prev.apply(undefined, arguments));
};
});
};
var resolveQuery = function resolveQuery(_ref) {
var oldLocation = _ref.oldLocation,
newLocation = _ref.newLocation,
options = _ref.options;
var oldQuery = oldLocation.query,
oldSearch = oldLocation.search;
// Only use the query from state if it exists
// and the href doesn't provide its own query
if (options.persistQuery && oldQuery && !newLocation.search && !newLocation.query) {
return {
oldLocation: oldLocation,
newLocation: _extends({}, newLocation, {
query: oldQuery,
search: oldSearch
}),
options: options
};
}
return { oldLocation: oldLocation, newLocation: newLocation, options: options };
};
var resolveBasename = function resolveBasename(_ref2) {
var oldLocation = _ref2.oldLocation,
newLocation = _ref2.newLocation,
options = _ref2.options;
var basename = oldLocation.basename;
if (basename) {
return {
oldLocation: oldLocation,
newLocation: _extends({ basename: basename }, newLocation),
options: options
};
}
return { oldLocation: oldLocation, newLocation: newLocation, options: options };
};
var resolvePrevious = function resolvePrevious(_ref3) {
var oldLocation = _ref3.oldLocation,
newLocation = _ref3.newLocation,
options = _ref3.options;
return {
oldLocation: oldLocation,
newLocation: _extends({}, newLocation, {
previous: oldLocation
}),
options: options
};
};
exports.default = function (initialLocation) {
return function () {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialLocation;
var action = arguments[1];
if (action.type === _types.LOCATION_CHANGED) {
// No-op the initial route action
if (state.pathname === action.payload.pathname && state.search === action.payload.search) {
return state;
}
// Extract the previous state, but dump the
// previous state's previous state so that the
// state tree doesn't keep growing indefinitely
// eslint-disable-next-line no-unused-vars
var previous = state.previous,
_oldLocation = _objectWithoutProperties(state, ['previous']);
var _options = action.payload.options;
var resolveLocation = flow(resolveQuery, resolveBasename, resolvePrevious);
return resolveLocation({
oldLocation: _oldLocation,
newLocation: action.payload,
options: _options || {}
}).newLocation;
}
return state;
};
};
/***/ },
/* 22 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _types = __webpack_require__(1);
/* eslint-disable consistent-return */
exports.default = function (_ref) {
var history = _ref.history;
return function () {
return function (next) {
return function (action) {
switch (action.type) {
case _types.PUSH:
history.push(action.payload);
// No return, no next() here
// We stop all history events from progressing further through the dispatch chain...
break;
case _types.REPLACE:
history.replace(action.payload);
break;
case _types.GO:
history.go(action.payload);
break;
case _types.GO_BACK:
history.goBack();
break;
case _types.GO_FORWARD:
history.goForward();
break;
default:
// ...but we want to leave all events we don't care about undisturbed
return next(action);
}
};
};
};
};
/***/ },
/* 23 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _actions = __webpack_require__(2);
var _locationState = __webpack_require__(7);
var _matchCache = __webpack_require__(24);
var _matchCache2 = _interopRequireDefault(_matchCache);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = function (_ref) {
var routes = _ref.routes,
history = _ref.history,
matchRoute = _ref.matchRoute,
matchWildcardRoute = _ref.matchWildcardRoute;
return function (createStore) {
return function (userReducer, initialState, enhancer) {
var store = createStore(userReducer, initialState, enhancer);
history.listen(function (location) {
_matchCache2.default.clear();
store.dispatch((0, _actions.locationDidChange)(_extends({}, (0, _locationState.unpackState)(location), matchRoute(location.pathname))));
});
return _extends({}, store, {
routes: routes,
matchRoute: matchRoute,
matchWildcardRoute: matchWildcardRoute
});
};
};
};
/***/ },
/* 24 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
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; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var ROUTE_FALLBACK = '@ROUTE_FALLBACK';
var MatchCache = exports.MatchCache = function () {
function MatchCache() {
_classCallCheck(this, MatchCache);
this._data = {};
}
_createClass(MatchCache, [{
key: 'add',
value: function add(parentId, route) {
this._data[parentId] = route || ROUTE_FALLBACK;
}
}, {
key: 'get',
value: function get(parentId) {
return this._data[parentId] || null;
}
}, {
key: 'clear',
value: function clear() {
this._data = {};
}
}]);
return MatchCache;
}();
exports.default = new MatchCache();
/***/ },
/* 25 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _urlPattern = __webpack_require__(26);
var _urlPattern2 = _interopRequireDefault(_urlPattern);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var find = function find(list, predicate) {
for (var i = 0; i < list.length; i++) {
var item = list[i];
if (predicate(item)) {
return item;
}
}
return null;
};
var wildcardMatcher = function wildcardMatcher(routeList) {
return function (incomingUrl) {
var routeToMatch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
// Discard query strings
var pathname = incomingUrl.split('?')[0];
var storedRoute = find(routeList, function (route) {
return route.route === routeToMatch;
});
if (!storedRoute) {
return null;
}
var match = storedRoute.pattern.match(pathname);
if (match) {
return {
route: storedRoute.route,
params: match,
result: storedRoute.result
};
}
return null;
};
};
var eagerMatcher = function eagerMatcher(routeList) {
return function (incomingUrl) {
// Discard query strings
var pathname = incomingUrl.split('?')[0];
// Find the route that matches the URL
for (var i = 0; i < routeList.length; i++) {
var storedRoute = routeList[i];
var match = storedRoute.pattern.match(pathname);
if (match) {
// Return the matched params and user-defined result object
return {
route: storedRoute.route,
params: match,
result: storedRoute.result
};
}
}
return null;
};
};
exports.default = function (routes) {
var wildcard = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var routeList = Object.keys(routes).sort().reverse().map(function (route) {
return {
route: route,
pattern: new _urlPattern2.default(
// Prepend with wildcards if requested
'' + route + (wildcard && '*' || '')),
result: routes[route]
};
});
return wildcard ? wildcardMatcher(routeList) : eagerMatcher(routeList);
};
/***/ },
/* 26 */
/***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// Generated by CoffeeScript 1.10.0
var slice = [].slice;
(function(root, factory) {
if (('function' === "function") && (__webpack_require__(27) != null)) {
return !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else if (typeof exports !== "undefined" && exports !== null) {
return module.exports = factory();
} else {
return root.UrlPattern = factory();
}
})(this, function() {
var P, UrlPattern, astNodeContainsSegmentsForProvidedParams, astNodeToNames, astNodeToRegexString, baseAstNodeToRegexString, concatMap, defaultOptions, escapeForRegex, getParam, keysAndValuesToObject, newParser, regexGroupCount, stringConcatMap, stringify;
escapeForRegex = function(string) {
return string.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
};
concatMap = function(array, f) {
var i, length, results;
results = [];
i = -1;
length = array.length;
while (++i < length) {
results = results.concat(f(array[i]));
}
return results;
};
stringConcatMap = function(array, f) {
var i, length, result;
result = '';
i = -1;
length = array.length;
while (++i < length) {
result += f(array[i]);
}
return result;
};
regexGroupCount = function(regex) {
return (new RegExp(regex.toString() + '|')).exec('').length - 1;
};
keysAndValuesToObject = function(keys, values) {
var i, key, length, object, value;
object = {};
i = -1;
length = keys.length;
while (++i < length) {
key = keys[i];
value = values[i];
if (value == null) {
continue;
}
if (object[key] != null) {
if (!Array.isArray(object[key])) {
object[key] = [object[key]];
}
object[key].push(value);
} else {
object[key] = value;
}
}
return object;
};
P = {};
P.Result = function(value, rest) {
this.value = value;
this.rest = rest;
};
P.Tagged = function(tag, value) {
this.tag = tag;
this.value = value;
};
P.tag = function(tag, parser) {
return function(input) {
var result, tagged;
result = parser(input);
if (result == null) {
return;
}
tagged = new P.Tagged(tag, result.value);
return new P.Result(tagged, result.rest);
};
};
P.regex = function(regex) {
return function(input) {
var matches, result;
matches = regex.exec(input);
if (matches == null) {
return;
}
result = matches[0];
return new P.Result(result, input.slice(result.length));
};
};
P.sequence = function() {
var parsers;
parsers = 1 <= arguments.length ? slice.call(arguments, 0) : [];
return function(input) {
var i, length, parser, rest, result, values;
i = -1;
length = parsers.length;
values = [];
rest = input;
while (++i < length) {
parser = parsers[i];
result = parser(rest);
if (result == null) {
return;
}
values.push(result.value);
rest = result.rest;
}
return new P.Result(values, rest);
};
};
P.pick = function() {
var indexes, parsers;
indexes = arguments[0], parsers = 2 <= arguments.length ? slice.call(arguments, 1) : [];
return function(input) {
var array, result;
result = P.sequence.apply(P, parsers)(input);
if (result == null) {
return;
}
array = result.value;
result.value = array[indexes];
return result;
};
};
P.string = function(string) {
var length;
length = string.length;
return function(input) {
if (input.slice(0, length) === string) {
return new P.Result(string, input.slice(length));
}
};
};
P.lazy = function(fn) {
var cached;
cached = null;
return function(input) {
if (cached == null) {
cached = fn();
}
return cached(input);
};
};
P.baseMany = function(parser, end, stringResult, atLeastOneResultRequired, input) {
var endResult, parserResult, rest, results;
rest = input;
results = stringResult ? '' : [];
while (true) {
if (end != null) {
endResult = end(rest);
if (endResult != null) {
break;
}
}
parserResult = parser(rest);
if (parserResult == null) {
break;
}
if (stringResult) {
results += parserResult.value;
} else {
results.push(parserResult.value);
}
rest = parserResult.rest;
}
if (atLeastOneResultRequired && results.length === 0) {
return;
}
return new P.Result(results, rest);
};
P.many1 = function(parser) {
return function(input) {
return P.baseMany(parser, null, false, true, input);
};
};
P.concatMany1Till = function(parser, end) {
return function(input) {
return P.baseMany(parser, end, true, true, input);
};
};
P.firstChoice = function() {
var parsers;
parsers = 1 <= arguments.length ? slice.call(arguments, 0) : [];
return function(input) {
var i, length, parser, result;
i = -1;
length = parsers.length;
while (++i < length) {
parser = parsers[i];
result = parser(input);
if (result != null) {
return result;
}
}
};
};
newParser = function(options) {
var U;
U = {};
U.wildcard = P.tag('wildcard', P.string(options.wildcardChar));
U.optional = P.tag('optional', P.pick(1, P.string(options.optionalSegmentStartChar), P.lazy(function() {
return U.pattern;
}), P.string(options.optionalSegmentEndChar)));
U.name = P.regex(new RegExp("^[" + options.segmentNameCharset + "]+"));
U.named = P.tag('named', P.pick(1, P.string(options.segmentNameStartChar), P.lazy(function() {
return U.name;
})));
U.escapedChar = P.pick(1, P.string(options.escapeChar), P.regex(/^./));
U["static"] = P.tag('static', P.concatMany1Till(P.firstChoice(P.lazy(function() {
return U.escapedChar;
}), P.regex(/^./)), P.firstChoice(P.string(options.segmentNameStartChar), P.string(options.optionalSegmentStartChar), P.string(options.optionalSegmentEndChar), U.wildcard)));
U.token = P.lazy(function() {
return P.firstChoice(U.wildcard, U.optional, U.named, U["static"]);
});
U.pattern = P.many1(P.lazy(function() {
return U.token;
}));
return U;
};
defaultOptions = {
escapeChar: '\\',
segmentNameStartChar: ':',
segmentValueCharset: 'a-zA-Z0-9-_~ %',
segmentNameCharset: 'a-zA-Z0-9',
optionalSegmentStartChar: '(',
optionalSegmentEndChar: ')',
wildcardChar: '*'
};
baseAstNodeToRegexString = function(astNode, segmentValueCharset) {
if (Array.isArray(astNode)) {
return stringConcatMap(astNode, function(node) {
return baseAstNodeToRegexString(node, segmentValueCharset);
});
}
switch (astNode.tag) {
case 'wildcard':
return '(.*?)';
case 'named':
return "([" + segmentValueCharset + "]+)";
case 'static':
return escapeForRegex(astNode.value);
case 'optional':
return '(?:' + baseAstNodeToRegexString(astNode.value, segmentValueCharset) + ')?';
}
};
astNodeToRegexString = function(astNode, segmentValueCharset) {
if (segmentValueCharset == null) {
segmentValueCharset = defaultOptions.segmentValueCharset;
}
return '^' + baseAstNodeToRegexString(astNode, segmentValueCharset) + '$';
};
astNodeToNames = function(astNode) {
if (Array.isArray(astNode)) {
return concatMap(astNode, astNodeToNames);
}
switch (astNode.tag) {
case 'wildcard':
return ['_'];
case 'named':
return [astNode.value];
case 'static':
return [];
case 'optional':
return astNodeToNames(astNode.value);
}
};
getParam = function(params, key, nextIndexes, sideEffects) {
var index, maxIndex, result, value;
if (sideEffects == null) {
sideEffects = false;
}
value = params[key];
if (value == null) {
if (sideEffects) {
throw new Error("no values provided for key `" + key + "`");
} else {
return;
}
}
index = nextIndexes[key] || 0;
maxIndex = Array.isArray(value) ? value.length - 1 : 0;
if (index > maxIndex) {
if (sideEffects) {
throw new Error("too few values provided for key `" + key + "`");
} else {
return;
}
}
result = Array.isArray(value) ? value[index] : value;
if (sideEffects) {
nextIndexes[key] = index + 1;
}
return result;
};
astNodeContainsSegmentsForProvidedParams = function(astNode, params, nextIndexes) {
var i, length;
if (Array.isArray(astNode)) {
i = -1;
length = astNode.length;
while (++i < length) {
if (astNodeContainsSegmentsForProvidedParams(astNode[i], params, nextIndexes)) {
return true;
}
}
return false;
}
switch (astNode.tag) {
case 'wildcard':
return getParam(params, '_', nextIndexes, false) != null;
case 'named':
return getParam(params, astNode.value, nextIndexes, false) != null;
case 'static':
return false;
case 'optional':
return astNodeContainsSegmentsForProvidedParams(astNode.value, params, nextIndexes);
}
};
stringify = function(astNode, params, nextIndexes) {
if (Array.isArray(astNode)) {
return stringConcatMap(astNode, function(node) {
return stringify(node, params, nextIndexes);
});
}
switch (astNode.tag) {
case 'wildcard':
return getParam(params, '_', nextIndexes, true);
case 'named':
return getParam(params, astNode.value, nextIndexes, true);
case 'static':
return astNode.value;
case 'optional':
if (astNodeContainsSegmentsForProvidedParams(astNode.value, params, nextIndexes)) {
return stringify(astNode.value, params, nextIndexes);
} else {
return '';
}
}
};
UrlPattern = function(arg1, arg2) {
var groupCount, options, parsed, parser, withoutWhitespace;
if (arg1 instanceof UrlPattern) {
this.isRegex = arg1.isRegex;
this.regex = arg1.regex;
this.ast = arg1.ast;
this.names = arg1.names;
return;
}
this.isRegex = arg1 instanceof RegExp;
if (!(('string' === typeof arg1) || this.isRegex)) {
throw new TypeError('argument must be a regex or a string');
}
if (this.isRegex) {
this.regex = arg1;
if (arg2 != null) {
if (!Array.isArray(arg2)) {
throw new Error('if first argument is a regex the second argument may be an array of group names but you provided something else');
}
groupCount = regexGroupCount(this.regex);
if (arg2.length !== groupCount) {
throw new Error("regex contains " + groupCount + " groups but array of group names contains " + arg2.length);
}
this.names = arg2;
}
return;
}
if (arg1 === '') {
throw new Error('argument must not be the empty string');
}
withoutWhitespace = arg1.replace(/\s+/g, '');
if (withoutWhitespace !== arg1) {
throw new Error('argument must not contain whitespace');
}
options = {
escapeChar: (arg2 != null ? arg2.escapeChar : void 0) || defaultOptions.escapeChar,
segmentNameStartChar: (arg2 != null ? arg2.segmentNameStartChar : void 0) || defaultOptions.segmentNameStartChar,
segmentNameCharset: (arg2 != null ? arg2.segmentNameCharset : void 0) || defaultOptions.segmentNameCharset,
segmentValueCharset: (arg2 != null ? arg2.segmentValueCharset : void 0) || defaultOptions.segmentValueCharset,
optionalSegmentStartChar: (arg2 != null ? arg2.optionalSegmentStartChar : void 0) || defaultOptions.optionalSegmentStartChar,
optionalSegmentEndChar: (arg2 != null ? arg2.optionalSegmentEndChar : void 0) || defaultOptions.optionalSegmentEndChar,
wildcardChar: (arg2 != null ? arg2.wildcardChar : void 0) || defaultOptions.wildcardChar
};
parser = newParser(options);
parsed = parser.pattern(arg1);
if (parsed == null) {
throw new Error("couldn't parse pattern");
}
if (parsed.rest !== '') {
throw new Error("could only partially parse pattern");
}
this.ast = parsed.value;
this.regex = new RegExp(astNodeToRegexString(this.ast, options.segmentValueCharset));
this.names = astNodeToNames(this.ast);
};
UrlPattern.prototype.match = function(url) {
var groups, match;
match = this.regex.exec(url);
if (match == null) {
return null;
}
groups = match.slice(1);
if (this.names) {
return keysAndValuesToObject(this.names, groups);
} else {
return groups;
}
};
UrlPattern.prototype.stringify = function(params) {
if (params == null) {
params = {};
}
if (this.isRegex) {
throw new Error("can't stringify patterns generated from a regex");
}
if (params !== Object(params)) {
throw new Error("argument must be an object or undefined");
}
return stringify(this.ast, params, {});
};
UrlPattern.escapeForRegex = escapeForRegex;
UrlPattern.concatMap = concatMap;
UrlPattern.stringConcatMap = stringConcatMap;
UrlPattern.regexGroupCount = regexGroupCount;
UrlPattern.keysAndValuesToObject = keysAndValuesToObject;
UrlPattern.P = P;
UrlPattern.newParser = newParser;
UrlPattern.defaultOptions = defaultOptions;
UrlPattern.astNodeToRegexString = astNodeToRegexString;
UrlPattern.astNodeToNames = astNodeToNames;
UrlPattern.getParam = getParam;
UrlPattern.astNodeContainsSegmentsForProvidedParams = astNodeContainsSegmentsForProvidedParams;
UrlPattern.stringify = stringify;
return UrlPattern;
});
/***/ },
/* 27 */
/***/ function(module, exports) {
/* WEBPACK VAR INJECTION */(function(__webpack_amd_options__) {module.exports = __webpack_amd_options__;
/* WEBPACK VAR INJECTION */}.call(exports, {}))
/***/ },
/* 28 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var README_MESSAGE = '\n See the README for more information:\n https://github.com/FormidableLabs/redux-little-router#wiring-up-the-boilerplate\n';
exports.default = function (routes) {
if (!routes) {
throw Error('\n Missing route configuration. You must define your routes as\n an object where the keys are routes and the values are any\n route-specific data.\n\n ' + README_MESSAGE + '\n ');
}
// eslint-disable-next-line no-magic-numbers
if (!Object.keys(routes).every(function (route) {
return route.indexOf('/') === 0;
})) {
throw Error('\n The route configuration you provided is malformed. Make sure\n that all of your routes start with a slash.\n\n ' + README_MESSAGE + '\n ');
}
};
/***/ },
/* 29 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _lodash = __webpack_require__(30);
var _lodash2 = _interopRequireDefault(_lodash);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var filterObject = function filterObject(target, predicate) {
return Object.keys(target).reduce(function (acc, key) {
return predicate(key) ? _extends({}, acc, _defineProperty({}, key, target[key])) : acc;
}, {});
};
var mapObject = function mapObject(target, transformKey, transformValue) {
return Object.keys(target).reduce(function (acc, key) {
var newKey = transformKey ? transformKey(key) : key;
var newValue = transformValue ? transformValue(target[key]) : target[key];
return _extends({}, acc, _defineProperty({}, newKey, newValue));
}, {});
};
var onlyRoutes = function onlyRoutes(routes) {
return filterObject(routes, function (key) {
return key.indexOf('/') === 0;
});
};
var withoutRoutes = function withoutRoutes(routes) {
return filterObject(routes, function (key) {
return key.indexOf('/') !== 0;
});
};
var flattenRoutes = function flattenRoutes(routes) {
var acc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
Object.keys(routes).forEach(function (key) {
var baseRoute = key === '/' ? '' : key;
flattenRoutes(mapObject(onlyRoutes(routes[key]), function (routeKey) {
return '' + baseRoute + routeKey;
}, function (routeValue) {
return _extends({}, routeValue, {
parent: _extends({}, withoutRoutes(routes[key]), {
route: key
})
});
}), acc);
});
(0, _lodash2.default)(acc, mapObject(routes, null, withoutRoutes));
return acc;
};
exports.default = flattenRoutes;
/***/ },
/* 30 */
/***/ function(module, exports) {
/**
* lodash (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="npm" -o ./`
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/
/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER = 9007199254740991;
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
funcTag = '[object Function]',
genTag = '[object GeneratorFunction]';
/** Used to detect unsigned integer values. */
var reIsUint = /^(?:0|[1-9]\d*)$/;
/**
* A faster alternative to `Function#apply`, this function invokes `func`
* with the `this` binding of `thisArg` and the arguments of `args`.
*
* @private
* @param {Function} func The function to invoke.
* @param {*} thisArg The `this` binding of `func`.
* @param {Array} args The arguments to invoke `func` with.
* @returns {*} Returns the result of `func`.
*/
function apply(func, thisArg, args) {
switch (args.length) {
case 0: return func.call(thisArg);
case 1: return func.call(thisArg, args[0]);
case 2: return func.call(thisArg, args[0], args[1]);
case 3: return func.call(thisArg, args[0], args[1], args[2]);
}
return func.apply(thisArg, args);
}
/**
* The base implementation of `_.times` without support for iteratee shorthands
* or max array length checks.
*
* @private
* @param {number} n The number of times to invoke `iteratee`.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the array of results.
*/
function baseTimes(n, iteratee) {
var index = -1,
result = Array(n);
while (++index < n) {
result[index] = iteratee(index);
}
return result;
}
/**
* Creates a unary function that invokes `func` with its argument transformed.
*
* @private
* @param {Function} func The function to wrap.
* @param {Function} transform The argument transform.
* @returns {Function} Returns the new function.
*/
function overArg(func, transform) {
return function(arg) {
return func(transform(arg));
};
}
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/** Built-in value references. */
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeKeys = overArg(Object.keys, Object),
nativeMax = Math.max;
/** Detect if properties shadowing those on `Object.prototype` are non-enumerable. */
var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf');
/**
* Creates an array of the enumerable property names of the array-like `value`.
*
* @private
* @param {*} value The value to query.
* @param {boolean} inherited Specify returning inherited property names.
* @returns {Array} Returns the array of property names.
*/
function arrayLikeKeys(value, inherited) {
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
// Safari 9 makes `arguments.length` enumerable in strict mode.
var result = (isArray(value) || isArguments(value))
? baseTimes(value.length, String)
: [];
var length = result.length,
skipIndexes = !!length;
for (var key in value) {
if ((inherited || hasOwnProperty.call(value, key)) &&
!(skipIndexes && (key == 'length' || isIndex(key, length)))) {
result.push(key);
}
}
return result;
}
/**
* Assigns `value` to `key` of `object` if the existing value is not equivalent
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons.
*
* @private
* @param {Object} object The object to modify.
* @param {string} key The key of the property to assign.
* @param {*} value The value to assign.
*/
function assignValue(object, key, value) {
var objValue = object[key];
if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
(value === undefined && !(key in object))) {
object[key] = value;
}
}
/**
* The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function baseKeys(object) {
if (!isPrototype(object)) {
return nativeKeys(object);
}
var result = [];
for (var key in Object(object)) {
if (hasOwnProperty.call(object, key) && key != 'constructor') {
result.push(key);
}
}
return result;
}
/**
* The base implementation of `_.rest` which doesn't validate or coerce arguments.
*
* @private
* @param {Function} func The function to apply a rest parameter to.
* @param {number} [start=func.length-1] The start position of the rest parameter.
* @returns {Function} Returns the new function.
*/
function baseRest(func, start) {
start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
return function() {
var args = arguments,
index = -1,
length = nativeMax(args.length - start, 0),
array = Array(length);
while (++index < length) {
array[index] = args[start + index];
}
index = -1;
var otherArgs = Array(start + 1);
while (++index < start) {
otherArgs[index] = args[index];
}
otherArgs[start] = array;
return apply(func, this, otherArgs);
};
}
/**
* Copies properties of `source` to `object`.
*
* @private
* @param {Object} source The object to copy properties from.
* @param {Array} props The property identifiers to copy.
* @param {Object} [object={}] The object to copy properties to.
* @param {Function} [customizer] The function to customize copied values.
* @returns {Object} Returns `object`.
*/
function copyObject(source, props, object, customizer) {
object || (object = {});
var index = -1,
length = props.length;
while (++index < length) {
var key = props[index];
var newValue = customizer
? customizer(object[key], source[key], key, object, source)
: undefined;
assignValue(object, key, newValue === undefined ? source[key] : newValue);
}
return object;
}
/**
* Creates a function like `_.assign`.
*
* @private
* @param {Function} assigner The function to assign values.
* @returns {Function} Returns the new assigner function.
*/
function createAssigner(assigner) {
return baseRest(function(object, sources) {
var index = -1,
length = sources.length,
customizer = length > 1 ? sources[length - 1] : undefined,
guard = length > 2 ? sources[2] : undefined;
customizer = (assigner.length > 3 && typeof customizer == 'function')
? (length--, customizer)
: undefined;
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
customizer = length < 3 ? undefined : customizer;
length = 1;
}
object = Object(object);
while (++index < length) {
var source = sources[index];
if (source) {
assigner(object, source, index, customizer);
}
}
return object;
});
}
/**
* Checks if `value` is a valid array-like index.
*
* @private
* @param {*} value The value to check.
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
*/
function isIndex(value, length) {
length = length == null ? MAX_SAFE_INTEGER : length;
return !!length &&
(typeof value == 'number' || reIsUint.test(value)) &&
(value > -1 && value % 1 == 0 && value < length);
}
/**
* Checks if the given arguments are from an iteratee call.
*
* @private
* @param {*} value The potential iteratee value argument.
* @param {*} index The potential iteratee index or key argument.
* @param {*} object The potential iteratee object argument.
* @returns {boolean} Returns `true` if the arguments are from an iteratee call,
* else `false`.
*/
function isIterateeCall(value, index, object) {
if (!isObject(object)) {
return false;
}
var type = typeof index;
if (type == 'number'
? (isArrayLike(object) && isIndex(index, object.length))
: (type == 'string' && index in object)
) {
return eq(object[index], value);
}
return false;
}
/**
* Checks if `value` is likely a prototype object.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
*/
function isPrototype(value) {
var Ctor = value && value.constructor,
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
return value === proto;
}
/**
* Performs a
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* comparison between two values to determine if they are equivalent.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* var object = { 'a': 1 };
* var other = { 'a': 1 };
*
* _.eq(object, object);
* // => true
*
* _.eq(object, other);
* // => false
*
* _.eq('a', 'a');
* // => true
*
* _.eq('a', Object('a'));
* // => false
*
* _.eq(NaN, NaN);
* // => true
*/
function eq(value, other) {
return value === other || (value !== value && other !== other);
}
/**
* Checks if `value` is likely an `arguments` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
* else `false`.
* @example
*
* _.isArguments(function() { return arguments; }());
* // => true
*
* _.isArguments([1, 2, 3]);
* // => false
*/
function isArguments(value) {
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
(!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
}
/**
* Checks if `value` is classified as an `Array` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
* @example
*
* _.isArray([1, 2, 3]);
* // => true
*
* _.isArray(document.body.children);
* // => false
*
* _.isArray('abc');
* // => false
*
* _.isArray(_.noop);
* // => false
*/
var isArray = Array.isArray;
/**
* Checks if `value` is array-like. A value is considered array-like if it's
* not a function and has a `value.length` that's an integer greater than or
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
* @example
*
* _.isArrayLike([1, 2, 3]);
* // => true
*
* _.isArrayLike(document.body.children);
* // => true
*
* _.isArrayLike('abc');
* // => true
*
* _.isArrayLike(_.noop);
* // => false
*/
function isArrayLike(value) {
return value != null && isLength(value.length) && !isFunction(value);
}
/**
* This method is like `_.isArrayLike` except that it also checks if `value`
* is an object.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array-like object,
* else `false`.
* @example
*
* _.isArrayLikeObject([1, 2, 3]);
* // => true
*
* _.isArrayLikeObject(document.body.children);
* // => true
*
* _.isArrayLikeObject('abc');
* // => false
*
* _.isArrayLikeObject(_.noop);
* // => false
*/
function isArrayLikeObject(value) {
return isObjectLike(value) && isArrayLike(value);
}
/**
* Checks if `value` is classified as a `Function` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
* @example
*
* _.isFunction(_);
* // => true
*
* _.isFunction(/abc/);
* // => false
*/
function isFunction(value) {
// The use of `Object#toString` avoids issues with the `typeof` operator
// in Safari 8-9 which returns 'object' for typed array and other constructors.
var tag = isObject(value) ? objectToString.call(value) : '';
return tag == funcTag || tag == genTag;
}
/**
* Checks if `value` is a valid array-like length.
*
* **Note:** This method is loosely based on
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
* @example
*
* _.isLength(3);
* // => true
*
* _.isLength(Number.MIN_VALUE);
* // => false
*
* _.isLength(Infinity);
* // => false
*
* _.isLength('3');
* // => false
*/
function isLength(value) {
return typeof value == 'number' &&
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}
/**
* Checks if `value` is the
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(_.noop);
* // => true
*
* _.isObject(null);
* // => false
*/
function isObject(value) {
var type = typeof value;
return !!value && (type == 'object' || type == 'function');
}
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike(value) {
return !!value && typeof value == 'object';
}
/**
* Assigns own enumerable string keyed properties of source objects to the
* destination object. Source objects are applied from left to right.
* Subsequent sources overwrite property assignments of previous sources.
*
* **Note:** This method mutates `object` and is loosely based on
* [`Object.assign`](https://mdn.io/Object/assign).
*
* @static
* @memberOf _
* @since 0.10.0
* @category Object
* @param {Object} object The destination object.
* @param {...Object} [sources] The source objects.
* @returns {Object} Returns `object`.
* @see _.assignIn
* @example
*
* function Foo() {
* this.a = 1;
* }
*
* function Bar() {
* this.c = 3;
* }
*
* Foo.prototype.b = 2;
* Bar.prototype.d = 4;
*
* _.assign({ 'a': 0 }, new Foo, new Bar);
* // => { 'a': 1, 'c': 3 }
*/
var assign = createAssigner(function(object, source) {
if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) {
copyObject(source, keys(source), object);
return;
}
for (var key in source) {
if (hasOwnProperty.call(source, key)) {
assignValue(object, key, source[key]);
}
}
});
/**
* Creates an array of the own enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects. See the
* [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
* for more details.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.keys(new Foo);
* // => ['a', 'b'] (iteration order is not guaranteed)
*
* _.keys('hi');
* // => ['0', '1']
*/
function keys(object) {
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
}
module.exports = assign;
/***/ },
/* 31 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createMemoryHistory = __webpack_require__(32);
var _createMemoryHistory2 = _interopRequireDefault(_createMemoryHistory);
var _normalizeHref = __webpack_require__(3);
var _normalizeHref2 = _interopRequireDefault(_normalizeHref);
var _install = __webpack_require__(20);
var _install2 = _interopRequireDefault(_install);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var locationForRequest = function locationForRequest(request) {
var pathname = request.path,
basename = request.baseUrl,
query = request.query;
var descriptor = basename ? { pathname: pathname, basename: basename, query: query } : { pathname: pathname, query: query };
return (0, _normalizeHref2.default)(descriptor);
};
exports.default = function (_ref) {
var routes = _ref.routes,
request = _ref.request;
var history = (0, _createMemoryHistory2.default)();
var location = locationForRequest(request);
return (0, _install2.default)({ routes: routes, history: history, location: location });
};
/***/ },
/* 32 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {'use strict';
exports.__esModule = true;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _warning = __webpack_require__(11);
var _warning2 = _interopRequireDefault(_warning);
var _PathUtils = __webpack_require__(16);
var _LocationUtils = __webpack_require__(13);
var _createTransitionManager = __webpack_require__(17);
var _createTransitionManager2 = _interopRequireDefault(_createTransitionManager);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var clamp = function clamp(n, lowerBound, upperBound) {
return Math.min(Math.max(n, lowerBound), upperBound);
};
/**
* Creates a history object that stores locations in memory.
*/
var createMemoryHistory = function createMemoryHistory() {
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var getUserConfirmation = props.getUserConfirmation,
_props$initialEntries = props.initialEntries,
initialEntries = _props$initialEntries === undefined ? ['/'] : _props$initialEntries,
_props$initialIndex = props.initialIndex,
initialIndex = _props$initialIndex === undefined ? 0 : _props$initialIndex,
_props$keyLength = props.keyLength,
keyLength = _props$keyLength === undefined ? 6 : _props$keyLength;
var transitionManager = (0, _createTransitionManager2.default)();
var setState = function setState(nextState) {
_extends(history, nextState);
history.length = history.entries.length;
transitionManager.notifyListeners(history.location, history.action);
};
var createKey = function createKey() {
return Math.random().toString(36).substr(2, keyLength);
};
var index = clamp(initialIndex, 0, initialEntries.length - 1);
var entries = initialEntries.map(function (entry, index) {
return typeof entry === 'string' ? (0, _LocationUtils.createLocation)(entry, undefined, index ? createKey() : undefined) : (0, _LocationUtils.createLocation)(entry, undefined, index ? entry.key || createKey() : undefined);
});
// Public interface
var createHref = _PathUtils.createPath;
var push = function push(path, state) {
process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(!((typeof path === 'undefined' ? 'undefined' : _typeof(path)) === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to push when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : void 0;
var action = 'PUSH';
var location = (0, _LocationUtils.createLocation)(path, state, createKey(), history.location);
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
if (!ok) return;
var prevIndex = history.index;
var nextIndex = prevIndex + 1;
var nextEntries = history.entries.slice(0);
if (nextEntries.length > nextIndex) {
nextEntries.splice(nextIndex, nextEntries.length - nextIndex, location);
} else {
nextEntries.push(location);
}
setState({
action: action,
location: location,
index: nextIndex,
entries: nextEntries
});
});
};
var replace = function replace(path, state) {
process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(!((typeof path === 'undefined' ? 'undefined' : _typeof(path)) === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to replace when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : void 0;
var action = 'REPLACE';
var location = (0, _LocationUtils.createLocation)(path, state, createKey(), history.location);
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
if (!ok) return;
history.entries[history.index] = location;
setState({ action: action, location: location });
});
};
var go = function go(n) {
var nextIndex = clamp(history.index + n, 0, history.entries.length - 1);
var action = 'POP';
var location = history.entries[nextIndex];
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
if (ok) {
setState({
action: action,
location: location,
index: nextIndex
});
} else {
// Mimic the behavior of DOM histories by
// causing a render after a cancelled POP.
setState();
}
});
};
var goBack = function goBack() {
return go(-1);
};
var goForward = function goForward() {
return go(1);
};
var canGo = function canGo(n) {
var nextIndex = history.index + n;
return nextIndex >= 0 && nextIndex < history.entries.length;
};
var block = function block() {
var prompt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
return transitionManager.setPrompt(prompt);
};
var listen = function listen(listener) {
return transitionManager.appendListener(listener);
};
var history = {
length: entries.length,
action: 'POP',
location: entries[index],
index: index,
entries: entries,
createHref: createHref,
push: push,
replace: replace,
go: go,
goBack: goBack,
goForward: goForward,
canGo: canGo,
block: block,
listen: listen
};
return history;
};
exports.default = createMemoryHistory;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10)))
/***/ },
/* 33 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createMemoryHistory = __webpack_require__(32);
var _createMemoryHistory2 = _interopRequireDefault(_createMemoryHistory);
var _normalizeHref = __webpack_require__(3);
var _normalizeHref2 = _interopRequireDefault(_normalizeHref);
var _install = __webpack_require__(20);
var _install2 = _interopRequireDefault(_install);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = function (_ref) {
var routes = _ref.routes,
request = _ref.request;
var history = (0, _createMemoryHistory2.default)();
var location = (0, _normalizeHref2.default)({
pathname: request.path,
query: request.query
});
return (0, _install2.default)({ routes: routes, history: history, location: location });
};
/***/ },
/* 34 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.RouterProvider = undefined;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _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 _react = __webpack_require__(35);
var _react2 = _interopRequireDefault(_react);
var _reactRedux = __webpack_require__(36);
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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var RouterProviderImpl = function (_Component) {
_inherits(RouterProviderImpl, _Component);
function RouterProviderImpl(props) {
_classCallCheck(this, RouterProviderImpl);
var _this = _possibleConstructorReturn(this, (RouterProviderImpl.__proto__ || Object.getPrototypeOf(RouterProviderImpl)).call(this, props));
_this.router = {
store: props.store
};
return _this;
}
_createClass(RouterProviderImpl, [{
key: 'getChildContext',
value: function getChildContext() {
return {
router: this.router
};
}
}, {
key: 'render',
value: function render() {
var store = this.router.store;
var routerState = store.getState().router;
// Ensure that the router props from connect()
// actually get to the child component(s)
return (0, _react.cloneElement)(this.props.children, {
router: _extends({}, routerState, {
// This is a hack to allow routes to define
// unserializable things like components
result: store.routes[routerState.route]
})
});
}
}]);
return RouterProviderImpl;
}(_react.Component);
RouterProviderImpl.childContextTypes = {
router: _react.PropTypes.object
};
var RouterProvider = exports.RouterProvider = (0, _reactRedux.connect)(function (state) {
return {
router: state.router
};
})(RouterProviderImpl);
exports.default = function (_ref) {
var store = _ref.store;
return function (ComposedComponent) {
return function (props) {
return _react2.default.createElement(
RouterProvider,
{ store: store },
_react2.default.createElement(ComposedComponent, props)
);
};
};
};
/***/ },
/* 35 */
/***/ function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_35__;
/***/ },
/* 36 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports.connect = exports.Provider = undefined;
var _Provider = __webpack_require__(37);
var _Provider2 = _interopRequireDefault(_Provider);
var _connect = __webpack_require__(40);
var _connect2 = _interopRequireDefault(_connect);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
exports.Provider = _Provider2["default"];
exports.connect = _connect2["default"];
/***/ },
/* 37 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {'use strict';
exports.__esModule = true;
exports["default"] = undefined;
var _react = __webpack_require__(35);
var _storeShape = __webpack_require__(38);
var _storeShape2 = _interopRequireDefault(_storeShape);
var _warning = __webpack_require__(39);
var _warning2 = _interopRequireDefault(_warning);
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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var didWarnAboutReceivingStore = false;
function warnAboutReceivingStore() {
if (didWarnAboutReceivingStore) {
return;
}
didWarnAboutReceivingStore = true;
(0, _warning2["default"])('<Provider> does not support changing `store` on the fly. ' + 'It is most likely that you see this error because you updated to ' + 'Redux 2.x and React Redux 2.x which no longer hot reload reducers ' + 'automatically. See https://github.com/reactjs/react-redux/releases/' + 'tag/v2.0.0 for the migration instructions.');
}
var Provider = function (_Component) {
_inherits(Provider, _Component);
Provider.prototype.getChildContext = function getChildContext() {
return { store: this.store };
};
function Provider(props, context) {
_classCallCheck(this, Provider);
var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
_this.store = props.store;
return _this;
}
Provider.prototype.render = function render() {
return _react.Children.only(this.props.children);
};
return Provider;
}(_react.Component);
exports["default"] = Provider;
if (process.env.NODE_ENV !== 'production') {
Provider.prototype.componentWillReceiveProps = function (nextProps) {
var store = this.store;
var nextStore = nextProps.store;
if (store !== nextStore) {
warnAboutReceivingStore();
}
};
}
Provider.propTypes = {
store: _storeShape2["default"].isRequired,
children: _react.PropTypes.element.isRequired
};
Provider.childContextTypes = {
store: _storeShape2["default"].isRequired
};
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10)))
/***/ },
/* 38 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _react = __webpack_require__(35);
exports["default"] = _react.PropTypes.shape({
subscribe: _react.PropTypes.func.isRequired,
dispatch: _react.PropTypes.func.isRequired,
getState: _react.PropTypes.func.isRequired
});
/***/ },
/* 39 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
exports["default"] = warning;
/**
* Prints a warning in the console if it exists.
*
* @param {String} message The warning message.
* @returns {void}
*/
function warning(message) {
/* eslint-disable no-console */
if (typeof console !== 'undefined' && typeof console.error === 'function') {
console.error(message);
}
/* eslint-enable no-console */
try {
// This error was thrown as a convenience so that if you enable
// "break on all exceptions" in your console,
// it would pause the execution at this line.
throw new Error(message);
/* eslint-disable no-empty */
} catch (e) {}
/* eslint-enable no-empty */
}
/***/ },
/* 40 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
exports["default"] = connect;
var _react = __webpack_require__(35);
var _storeShape = __webpack_require__(38);
var _storeShape2 = _interopRequireDefault(_storeShape);
var _shallowEqual = __webpack_require__(41);
var _shallowEqual2 = _interopRequireDefault(_shallowEqual);
var _wrapActionCreators = __webpack_require__(42);
var _wrapActionCreators2 = _interopRequireDefault(_wrapActionCreators);
var _warning = __webpack_require__(39);
var _warning2 = _interopRequireDefault(_warning);
var _isPlainObject = __webpack_require__(45);
var _isPlainObject2 = _interopRequireDefault(_isPlainObject);
var _hoistNonReactStatics = __webpack_require__(64);
var _hoistNonReactStatics2 = _interopRequireDefault(_hoistNonReactStatics);
var _invariant = __webpack_require__(12);
var _invariant2 = _interopRequireDefault(_invariant);
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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var defaultMapStateToProps = function defaultMapStateToProps(state) {
return {};
}; // eslint-disable-line no-unused-vars
var defaultMapDispatchToProps = function defaultMapDispatchToProps(dispatch) {
return { dispatch: dispatch };
};
var defaultMergeProps = function defaultMergeProps(stateProps, dispatchProps, parentProps) {
return _extends({}, parentProps, stateProps, dispatchProps);
};
function getDisplayName(WrappedComponent) {
return WrappedComponent.displayName || WrappedComponent.name || 'Component';
}
var errorObject = { value: null };
function tryCatch(fn, ctx) {
try {
return fn.apply(ctx);
} catch (e) {
errorObject.value = e;
return errorObject;
}
}
// Helps track hot reloading.
var nextVersion = 0;
function connect(mapStateToProps, mapDispatchToProps, mergeProps) {
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
var shouldSubscribe = Boolean(mapStateToProps);
var mapState = mapStateToProps || defaultMapStateToProps;
var mapDispatch = void 0;
if (typeof mapDispatchToProps === 'function') {
mapDispatch = mapDispatchToProps;
} else if (!mapDispatchToProps) {
mapDispatch = defaultMapDispatchToProps;
} else {
mapDispatch = (0, _wrapActionCreators2["default"])(mapDispatchToProps);
}
var finalMergeProps = mergeProps || defaultMergeProps;
var _options$pure = options.pure,
pure = _options$pure === undefined ? true : _options$pure,
_options$withRef = options.withRef,
withRef = _options$withRef === undefined ? false : _options$withRef;
var checkMergedEquals = pure && finalMergeProps !== defaultMergeProps;
// Helps track hot reloading.
var version = nextVersion++;
return function wrapWithConnect(WrappedComponent) {
var connectDisplayName = 'Connect(' + getDisplayName(WrappedComponent) + ')';
function checkStateShape(props, methodName) {
if (!(0, _isPlainObject2["default"])(props)) {
(0, _warning2["default"])(methodName + '() in ' + connectDisplayName + ' must return a plain object. ' + ('Instead received ' + props + '.'));
}
}
function computeMergedProps(stateProps, dispatchProps, parentProps) {
var mergedProps = finalMergeProps(stateProps, dispatchProps, parentProps);
if (process.env.NODE_ENV !== 'production') {
checkStateShape(mergedProps, 'mergeProps');
}
return mergedProps;
}
var Connect = function (_Component) {
_inherits(Connect, _Component);
Connect.prototype.shouldComponentUpdate = function shouldComponentUpdate() {
return !pure || this.haveOwnPropsChanged || this.hasStoreStateChanged;
};
function Connect(props, context) {
_classCallCheck(this, Connect);
var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
_this.version = version;
_this.store = props.store || context.store;
(0, _invariant2["default"])(_this.store, 'Could not find "store" in either the context or ' + ('props of "' + connectDisplayName + '". ') + 'Either wrap the root component in a <Provider>, ' + ('or explicitly pass "store" as a prop to "' + connectDisplayName + '".'));
var storeState = _this.store.getState();
_this.state = { storeState: storeState };
_this.clearCache();
return _this;
}
Connect.prototype.computeStateProps = function computeStateProps(store, props) {
if (!this.finalMapStateToProps) {
return this.configureFinalMapState(store, props);
}
var state = store.getState();
var stateProps = this.doStatePropsDependOnOwnProps ? this.finalMapStateToProps(state, props) : this.finalMapStateToProps(state);
if (process.env.NODE_ENV !== 'production') {
checkStateShape(stateProps, 'mapStateToProps');
}
return stateProps;
};
Connect.prototype.configureFinalMapState = function configureFinalMapState(store, props) {
var mappedState = mapState(store.getState(), props);
var isFactory = typeof mappedState === 'function';
this.finalMapStateToProps = isFactory ? mappedState : mapState;
this.doStatePropsDependOnOwnProps = this.finalMapStateToProps.length !== 1;
if (isFactory) {
return this.computeStateProps(store, props);
}
if (process.env.NODE_ENV !== 'production') {
checkStateShape(mappedState, 'mapStateToProps');
}
return mappedState;
};
Connect.prototype.computeDispatchProps = function computeDispatchProps(store, props) {
if (!this.finalMapDispatchToProps) {
return this.configureFinalMapDispatch(store, props);
}
var dispatch = store.dispatch;
var dispatchProps = this.doDispatchPropsDependOnOwnProps ? this.finalMapDispatchToProps(dispatch, props) : this.finalMapDispatchToProps(dispatch);
if (process.env.NODE_ENV !== 'production') {
checkStateShape(dispatchProps, 'mapDispatchToProps');
}
return dispatchProps;
};
Connect.prototype.configureFinalMapDispatch = function configureFinalMapDispatch(store, props) {
var mappedDispatch = mapDispatch(store.dispatch, props);
var isFactory = typeof mappedDispatch === 'function';
this.finalMapDispatchToProps = isFactory ? mappedDispatch : mapDispatch;
this.doDispatchPropsDependOnOwnProps = this.finalMapDispatchToProps.length !== 1;
if (isFactory) {
return this.computeDispatchProps(store, props);
}
if (process.env.NODE_ENV !== 'production') {
checkStateShape(mappedDispatch, 'mapDispatchToProps');
}
return mappedDispatch;
};
Connect.prototype.updateStatePropsIfNeeded = function updateStatePropsIfNeeded() {
var nextStateProps = this.computeStateProps(this.store, this.props);
if (this.stateProps && (0, _shallowEqual2["default"])(nextStateProps, this.stateProps)) {
return false;
}
this.stateProps = nextStateProps;
return true;
};
Connect.prototype.updateDispatchPropsIfNeeded = function updateDispatchPropsIfNeeded() {
var nextDispatchProps = this.computeDispatchProps(this.store, this.props);
if (this.dispatchProps && (0, _shallowEqual2["default"])(nextDispatchProps, this.dispatchProps)) {
return false;
}
this.dispatchProps = nextDispatchProps;
return true;
};
Connect.prototype.updateMergedPropsIfNeeded = function updateMergedPropsIfNeeded() {
var nextMergedProps = computeMergedProps(this.stateProps, this.dispatchProps, this.props);
if (this.mergedProps && checkMergedEquals && (0, _shallowEqual2["default"])(nextMergedProps, this.mergedProps)) {
return false;
}
this.mergedProps = nextMergedProps;
return true;
};
Connect.prototype.isSubscribed = function isSubscribed() {
return typeof this.unsubscribe === 'function';
};
Connect.prototype.trySubscribe = function trySubscribe() {
if (shouldSubscribe && !this.unsubscribe) {
this.unsubscribe = this.store.subscribe(this.handleChange.bind(this));
this.handleChange();
}
};
Connect.prototype.tryUnsubscribe = function tryUnsubscribe() {
if (this.unsubscribe) {
this.unsubscribe();
this.unsubscribe = null;
}
};
Connect.prototype.componentDidMount = function componentDidMount() {
this.trySubscribe();
};
Connect.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
if (!pure || !(0, _shallowEqual2["default"])(nextProps, this.props)) {
this.haveOwnPropsChanged = true;
}
};
Connect.prototype.componentWillUnmount = function componentWillUnmount() {
this.tryUnsubscribe();
this.clearCache();
};
Connect.prototype.clearCache = function clearCache() {
this.dispatchProps = null;
this.stateProps = null;
this.mergedProps = null;
this.haveOwnPropsChanged = true;
this.hasStoreStateChanged = true;
this.haveStatePropsBeenPrecalculated = false;
this.statePropsPrecalculationError = null;
this.renderedElement = null;
this.finalMapDispatchToProps = null;
this.finalMapStateToProps = null;
};
Connect.prototype.handleChange = function handleChange() {
if (!this.unsubscribe) {
return;
}
var storeState = this.store.getState();
var prevStoreState = this.state.storeState;
if (pure && prevStoreState === storeState) {
return;
}
if (pure && !this.doStatePropsDependOnOwnProps) {
var haveStatePropsChanged = tryCatch(this.updateStatePropsIfNeeded, this);
if (!haveStatePropsChanged) {
return;
}
if (haveStatePropsChanged === errorObject) {
this.statePropsPrecalculationError = errorObject.value;
}
this.haveStatePropsBeenPrecalculated = true;
}
this.hasStoreStateChanged = true;
this.setState({ storeState: storeState });
};
Connect.prototype.getWrappedInstance = function getWrappedInstance() {
(0, _invariant2["default"])(withRef, 'To access the wrapped instance, you need to specify ' + '{ withRef: true } as the fourth argument of the connect() call.');
return this.refs.wrappedInstance;
};
Connect.prototype.render = function render() {
var haveOwnPropsChanged = this.haveOwnPropsChanged,
hasStoreStateChanged = this.hasStoreStateChanged,
haveStatePropsBeenPrecalculated = this.haveStatePropsBeenPrecalculated,
statePropsPrecalculationError = this.statePropsPrecalculationError,
renderedElement = this.renderedElement;
this.haveOwnPropsChanged = false;
this.hasStoreStateChanged = false;
this.haveStatePropsBeenPrecalculated = false;
this.statePropsPrecalculationError = null;
if (statePropsPrecalculationError) {
throw statePropsPrecalculationError;
}
var shouldUpdateStateProps = true;
var shouldUpdateDispatchProps = true;
if (pure && renderedElement) {
shouldUpdateStateProps = hasStoreStateChanged || haveOwnPropsChanged && this.doStatePropsDependOnOwnProps;
shouldUpdateDispatchProps = haveOwnPropsChanged && this.doDispatchPropsDependOnOwnProps;
}
var haveStatePropsChanged = false;
var haveDispatchPropsChanged = false;
if (haveStatePropsBeenPrecalculated) {
haveStatePropsChanged = true;
} else if (shouldUpdateStateProps) {
haveStatePropsChanged = this.updateStatePropsIfNeeded();
}
if (shouldUpdateDispatchProps) {
haveDispatchPropsChanged = this.updateDispatchPropsIfNeeded();
}
var haveMergedPropsChanged = true;
if (haveStatePropsChanged || haveDispatchPropsChanged || haveOwnPropsChanged) {
haveMergedPropsChanged = this.updateMergedPropsIfNeeded();
} else {
haveMergedPropsChanged = false;
}
if (!haveMergedPropsChanged && renderedElement) {
return renderedElement;
}
if (withRef) {
this.renderedElement = (0, _react.createElement)(WrappedComponent, _extends({}, this.mergedProps, {
ref: 'wrappedInstance'
}));
} else {
this.renderedElement = (0, _react.createElement)(WrappedComponent, this.mergedProps);
}
return this.renderedElement;
};
return Connect;
}(_react.Component);
Connect.displayName = connectDisplayName;
Connect.WrappedComponent = WrappedComponent;
Connect.contextTypes = {
store: _storeShape2["default"]
};
Connect.propTypes = {
store: _storeShape2["default"]
};
if (process.env.NODE_ENV !== 'production') {
Connect.prototype.componentWillUpdate = function componentWillUpdate() {
if (this.version === version) {
return;
}
// We are hot reloading!
this.version = version;
this.trySubscribe();
this.clearCache();
};
}
return (0, _hoistNonReactStatics2["default"])(Connect, WrappedComponent);
};
}
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10)))
/***/ },
/* 41 */
/***/ function(module, exports) {
"use strict";
exports.__esModule = true;
exports["default"] = shallowEqual;
function shallowEqual(objA, objB) {
if (objA === objB) {
return true;
}
var keysA = Object.keys(objA);
var keysB = Object.keys(objB);
if (keysA.length !== keysB.length) {
return false;
}
// Test for A's keys different from B.
var hasOwn = Object.prototype.hasOwnProperty;
for (var i = 0; i < keysA.length; i++) {
if (!hasOwn.call(objB, keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
return false;
}
}
return true;
}
/***/ },
/* 42 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports["default"] = wrapActionCreators;
var _redux = __webpack_require__(43);
function wrapActionCreators(actionCreators) {
return function (dispatch) {
return (0, _redux.bindActionCreators)(actionCreators, dispatch);
};
}
/***/ },
/* 43 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {'use strict';
exports.__esModule = true;
exports.compose = exports.applyMiddleware = exports.bindActionCreators = exports.combineReducers = exports.createStore = undefined;
var _createStore = __webpack_require__(44);
var _createStore2 = _interopRequireDefault(_createStore);
var _combineReducers = __webpack_require__(59);
var _combineReducers2 = _interopRequireDefault(_combineReducers);
var _bindActionCreators = __webpack_require__(61);
var _bindActionCreators2 = _interopRequireDefault(_bindActionCreators);
var _applyMiddleware = __webpack_require__(62);
var _applyMiddleware2 = _interopRequireDefault(_applyMiddleware);
var _compose = __webpack_require__(63);
var _compose2 = _interopRequireDefault(_compose);
var _warning = __webpack_require__(60);
var _warning2 = _interopRequireDefault(_warning);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
/*
* This is a dummy function to check if the function name has been altered by minification.
* If the function has been minified and NODE_ENV !== 'production', warn the user.
*/
function isCrushed() {}
if (process.env.NODE_ENV !== 'production' && typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') {
(0, _warning2['default'])('You are currently using minified code outside of NODE_ENV === \'production\'. ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) ' + 'to ensure you have the correct code for your production build.');
}
exports.createStore = _createStore2['default'];
exports.combineReducers = _combineReducers2['default'];
exports.bindActionCreators = _bindActionCreators2['default'];
exports.applyMiddleware = _applyMiddleware2['default'];
exports.compose = _compose2['default'];
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10)))
/***/ },
/* 44 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports.ActionTypes = undefined;
exports['default'] = createStore;
var _isPlainObject = __webpack_require__(45);
var _isPlainObject2 = _interopRequireDefault(_isPlainObject);
var _symbolObservable = __webpack_require__(55);
var _symbolObservable2 = _interopRequireDefault(_symbolObservable);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
/**
* These are private action types reserved by Redux.
* For any unknown actions, you must return the current state.
* If the current state is undefined, you must return the initial state.
* Do not reference these action types directly in your code.
*/
var ActionTypes = exports.ActionTypes = {
INIT: '@@redux/INIT'
};
/**
* Creates a Redux store that holds the state tree.
* The only way to change the data in the store is to call `dispatch()` on it.
*
* There should only be a single store in your app. To specify how different
* parts of the state tree respond to actions, you may combine several reducers
* into a single reducer function by using `combineReducers`.
*
* @param {Function} reducer A function that returns the next state tree, given
* the current state tree and the action to handle.
*
* @param {any} [preloadedState] The initial state. You may optionally specify it
* to hydrate the state from the server in universal apps, or to restore a
* previously serialized user session.
* If you use `combineReducers` to produce the root reducer function, this must be
* an object with the same shape as `combineReducers` keys.
*
* @param {Function} enhancer The store enhancer. You may optionally specify it
* to enhance the store with third-party capabilities such as middleware,
* time travel, persistence, etc. The only store enhancer that ships with Redux
* is `applyMiddleware()`.
*
* @returns {Store} A Redux store that lets you read the state, dispatch actions
* and subscribe to changes.
*/
function createStore(reducer, preloadedState, enhancer) {
var _ref2;
if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {
enhancer = preloadedState;
preloadedState = undefined;
}
if (typeof enhancer !== 'undefined') {
if (typeof enhancer !== 'function') {
throw new Error('Expected the enhancer to be a function.');
}
return enhancer(createStore)(reducer, preloadedState);
}
if (typeof reducer !== 'function') {
throw new Error('Expected the reducer to be a function.');
}
var currentReducer = reducer;
var currentState = preloadedState;
var currentListeners = [];
var nextListeners = currentListeners;
var isDispatching = false;
function ensureCanMutateNextListeners() {
if (nextListeners === currentListeners) {
nextListeners = currentListeners.slice();
}
}
/**
* Reads the state tree managed by the store.
*
* @returns {any} The current state tree of your application.
*/
function getState() {
return currentState;
}
/**
* Adds a change listener. It will be called any time an action is dispatched,
* and some part of the state tree may potentially have changed. You may then
* call `getState()` to read the current state tree inside the callback.
*
* You may call `dispatch()` from a change listener, with the following
* caveats:
*
* 1. The subscriptions are snapshotted just before every `dispatch()` call.
* If you subscribe or unsubscribe while the listeners are being invoked, this
* will not have any effect on the `dispatch()` that is currently in progress.
* However, the next `dispatch()` call, whether nested or not, will use a more
* recent snapshot of the subscription list.
*
* 2. The listener should not expect to see all state changes, as the state
* might have been updated multiple times during a nested `dispatch()` before
* the listener is called. It is, however, guaranteed that all subscribers
* registered before the `dispatch()` started will be called with the latest
* state by the time it exits.
*
* @param {Function} listener A callback to be invoked on every dispatch.
* @returns {Function} A function to remove this change listener.
*/
function subscribe(listener) {
if (typeof listener !== 'function') {
throw new Error('Expected listener to be a function.');
}
var isSubscribed = true;
ensureCanMutateNextListeners();
nextListeners.push(listener);
return function unsubscribe() {
if (!isSubscribed) {
return;
}
isSubscribed = false;
ensureCanMutateNextListeners();
var index = nextListeners.indexOf(listener);
nextListeners.splice(index, 1);
};
}
/**
* Dispatches an action. It is the only way to trigger a state change.
*
* The `reducer` function, used to create the store, will be called with the
* current state tree and the given `action`. Its return value will
* be considered the **next** state of the tree, and the change listeners
* will be notified.
*
* The base implementation only supports plain object actions. If you want to
* dispatch a Promise, an Observable, a thunk, or something else, you need to
* wrap your store creating function into the corresponding middleware. For
* example, see the documentation for the `redux-thunk` package. Even the
* middleware will eventually dispatch plain object actions using this method.
*
* @param {Object} action A plain object representing “what changed”. It is
* a good idea to keep actions serializable so you can record and replay user
* sessions, or use the time travelling `redux-devtools`. An action must have
* a `type` property which may not be `undefined`. It is a good idea to use
* string constants for action types.
*
* @returns {Object} For convenience, the same action object you dispatched.
*
* Note that, if you use a custom middleware, it may wrap `dispatch()` to
* return something else (for example, a Promise you can await).
*/
function dispatch(action) {
if (!(0, _isPlainObject2['default'])(action)) {
throw new Error('Actions must be plain objects. ' + 'Use custom middleware for async actions.');
}
if (typeof action.type === 'undefined') {
throw new Error('Actions may not have an undefined "type" property. ' + 'Have you misspelled a constant?');
}
if (isDispatching) {
throw new Error('Reducers may not dispatch actions.');
}
try {
isDispatching = true;
currentState = currentReducer(currentState, action);
} finally {
isDispatching = false;
}
var listeners = currentListeners = nextListeners;
for (var i = 0; i < listeners.length; i++) {
listeners[i]();
}
return action;
}
/**
* Replaces the reducer currently used by the store to calculate the state.
*
* You might need this if your app implements code splitting and you want to
* load some of the reducers dynamically. You might also need this if you
* implement a hot reloading mechanism for Redux.
*
* @param {Function} nextReducer The reducer for the store to use instead.
* @returns {void}
*/
function replaceReducer(nextReducer) {
if (typeof nextReducer !== 'function') {
throw new Error('Expected the nextReducer to be a function.');
}
currentReducer = nextReducer;
dispatch({ type: ActionTypes.INIT });
}
/**
* Interoperability point for observable/reactive libraries.
* @returns {observable} A minimal observable of state changes.
* For more information, see the observable proposal:
* https://github.com/zenparsing/es-observable
*/
function observable() {
var _ref;
var outerSubscribe = subscribe;
return _ref = {
/**
* The minimal observable subscription method.
* @param {Object} observer Any object that can be used as an observer.
* The observer object should have a `next` method.
* @returns {subscription} An object with an `unsubscribe` method that can
* be used to unsubscribe the observable from the store, and prevent further
* emission of values from the observable.
*/
subscribe: function subscribe(observer) {
if (typeof observer !== 'object') {
throw new TypeError('Expected the observer to be an object.');
}
function observeState() {
if (observer.next) {
observer.next(getState());
}
}
observeState();
var unsubscribe = outerSubscribe(observeState);
return { unsubscribe: unsubscribe };
}
}, _ref[_symbolObservable2['default']] = function () {
return this;
}, _ref;
}
// When a store is created, an "INIT" action is dispatched so that every
// reducer returns their initial state. This effectively populates
// the initial state tree.
dispatch({ type: ActionTypes.INIT });
return _ref2 = {
dispatch: dispatch,
subscribe: subscribe,
getState: getState,
replaceReducer: replaceReducer
}, _ref2[_symbolObservable2['default']] = observable, _ref2;
}
/***/ },
/* 45 */
/***/ function(module, exports, __webpack_require__) {
var baseGetTag = __webpack_require__(46),
getPrototype = __webpack_require__(52),
isObjectLike = __webpack_require__(54);
/** `Object#toString` result references. */
var objectTag = '[object Object]';
/** Used for built-in method references. */
var funcProto = Function.prototype,
objectProto = Object.prototype;
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/** Used to infer the `Object` constructor. */
var objectCtorString = funcToString.call(Object);
/**
* Checks if `value` is a plain object, that is, an object created by the
* `Object` constructor or one with a `[[Prototype]]` of `null`.
*
* @static
* @memberOf _
* @since 0.8.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
* @example
*
* function Foo() {
* this.a = 1;
* }
*
* _.isPlainObject(new Foo);
* // => false
*
* _.isPlainObject([1, 2, 3]);
* // => false
*
* _.isPlainObject({ 'x': 0, 'y': 0 });
* // => true
*
* _.isPlainObject(Object.create(null));
* // => true
*/
function isPlainObject(value) {
if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
return false;
}
var proto = getPrototype(value);
if (proto === null) {
return true;
}
var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
return typeof Ctor == 'function' && Ctor instanceof Ctor &&
funcToString.call(Ctor) == objectCtorString;
}
module.exports = isPlainObject;
/***/ },
/* 46 */
/***/ function(module, exports, __webpack_require__) {
var Symbol = __webpack_require__(47),
getRawTag = __webpack_require__(50),
objectToString = __webpack_require__(51);
/** `Object#toString` result references. */
var nullTag = '[object Null]',
undefinedTag = '[object Undefined]';
/** Built-in value references. */
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
/**
* The base implementation of `getTag` without fallbacks for buggy environments.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
function baseGetTag(value) {
if (value == null) {
return value === undefined ? undefinedTag : nullTag;
}
return (symToStringTag && symToStringTag in Object(value))
? getRawTag(value)
: objectToString(value);
}
module.exports = baseGetTag;
/***/ },
/* 47 */
/***/ function(module, exports, __webpack_require__) {
var root = __webpack_require__(48);
/** Built-in value references. */
var Symbol = root.Symbol;
module.exports = Symbol;
/***/ },
/* 48 */
/***/ function(module, exports, __webpack_require__) {
var freeGlobal = __webpack_require__(49);
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root = freeGlobal || freeSelf || Function('return this')();
module.exports = root;
/***/ },
/* 49 */
/***/ function(module, exports) {
/* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
module.exports = freeGlobal;
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
/***/ },
/* 50 */
/***/ function(module, exports, __webpack_require__) {
var Symbol = __webpack_require__(47);
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString = objectProto.toString;
/** Built-in value references. */
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
/**
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the raw `toStringTag`.
*/
function getRawTag(value) {
var isOwn = hasOwnProperty.call(value, symToStringTag),
tag = value[symToStringTag];
try {
value[symToStringTag] = undefined;
var unmasked = true;
} catch (e) {}
var result = nativeObjectToString.call(value);
if (unmasked) {
if (isOwn) {
value[symToStringTag] = tag;
} else {
delete value[symToStringTag];
}
}
return result;
}
module.exports = getRawTag;
/***/ },
/* 51 */
/***/ function(module, exports) {
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString = objectProto.toString;
/**
* Converts `value` to a string using `Object.prototype.toString`.
*
* @private
* @param {*} value The value to convert.
* @returns {string} Returns the converted string.
*/
function objectToString(value) {
return nativeObjectToString.call(value);
}
module.exports = objectToString;
/***/ },
/* 52 */
/***/ function(module, exports, __webpack_require__) {
var overArg = __webpack_require__(53);
/** Built-in value references. */
var getPrototype = overArg(Object.getPrototypeOf, Object);
module.exports = getPrototype;
/***/ },
/* 53 */
/***/ function(module, exports) {
/**
* Creates a unary function that invokes `func` with its argument transformed.
*
* @private
* @param {Function} func The function to wrap.
* @param {Function} transform The argument transform.
* @returns {Function} Returns the new function.
*/
function overArg(func, transform) {
return function(arg) {
return func(transform(arg));
};
}
module.exports = overArg;
/***/ },
/* 54 */
/***/ function(module, exports) {
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike(value) {
return value != null && typeof value == 'object';
}
module.exports = isObjectLike;
/***/ },
/* 55 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(56);
/***/ },
/* 56 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global, module) {'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _ponyfill = __webpack_require__(58);
var _ponyfill2 = _interopRequireDefault(_ponyfill);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var root; /* global window */
if (typeof self !== 'undefined') {
root = self;
} else if (typeof window !== 'undefined') {
root = window;
} else if (typeof global !== 'undefined') {
root = global;
} else if (true) {
root = module;
} else {
root = Function('return this')();
}
var result = (0, _ponyfill2['default'])(root);
exports['default'] = result;
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()), __webpack_require__(57)(module)))
/***/ },
/* 57 */
/***/ function(module, exports) {
module.exports = function(module) {
if(!module.webpackPolyfill) {
module.deprecate = function() {};
module.paths = [];
// module.parent = undefined by default
module.children = [];
module.webpackPolyfill = 1;
}
return module;
}
/***/ },
/* 58 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = symbolObservablePonyfill;
function symbolObservablePonyfill(root) {
var result;
var _Symbol = root.Symbol;
if (typeof _Symbol === 'function') {
if (_Symbol.observable) {
result = _Symbol.observable;
} else {
result = _Symbol('observable');
_Symbol.observable = result;
}
} else {
result = '@@observable';
}
return result;
};
/***/ },
/* 59 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {'use strict';
exports.__esModule = true;
exports['default'] = combineReducers;
var _createStore = __webpack_require__(44);
var _isPlainObject = __webpack_require__(45);
var _isPlainObject2 = _interopRequireDefault(_isPlainObject);
var _warning = __webpack_require__(60);
var _warning2 = _interopRequireDefault(_warning);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function getUndefinedStateErrorMessage(key, action) {
var actionType = action && action.type;
var actionName = actionType && '"' + actionType.toString() + '"' || 'an action';
return 'Given action ' + actionName + ', reducer "' + key + '" returned undefined. ' + 'To ignore an action, you must explicitly return the previous state.';
}
function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
var reducerKeys = Object.keys(reducers);
var argumentName = action && action.type === _createStore.ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';
if (reducerKeys.length === 0) {
return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';
}
if (!(0, _isPlainObject2['default'])(inputState)) {
return 'The ' + argumentName + ' has unexpected type of "' + {}.toString.call(inputState).match(/\s([a-z|A-Z]+)/)[1] + '". Expected argument to be an object with the following ' + ('keys: "' + reducerKeys.join('", "') + '"');
}
var unexpectedKeys = Object.keys(inputState).filter(function (key) {
return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];
});
unexpectedKeys.forEach(function (key) {
unexpectedKeyCache[key] = true;
});
if (unexpectedKeys.length > 0) {
return 'Unexpected ' + (unexpectedKeys.length > 1 ? 'keys' : 'key') + ' ' + ('"' + unexpectedKeys.join('", "') + '" found in ' + argumentName + '. ') + 'Expected to find one of the known reducer keys instead: ' + ('"' + reducerKeys.join('", "') + '". Unexpected keys will be ignored.');
}
}
function assertReducerSanity(reducers) {
Object.keys(reducers).forEach(function (key) {
var reducer = reducers[key];
var initialState = reducer(undefined, { type: _createStore.ActionTypes.INIT });
if (typeof initialState === 'undefined') {
throw new Error('Reducer "' + key + '" returned undefined during initialization. ' + 'If the state passed to the reducer is undefined, you must ' + 'explicitly return the initial state. The initial state may ' + 'not be undefined.');
}
var type = '@@redux/PROBE_UNKNOWN_ACTION_' + Math.random().toString(36).substring(7).split('').join('.');
if (typeof reducer(undefined, { type: type }) === 'undefined') {
throw new Error('Reducer "' + key + '" returned undefined when probed with a random type. ' + ('Don\'t try to handle ' + _createStore.ActionTypes.INIT + ' or other actions in "redux/*" ') + 'namespace. They are considered private. Instead, you must return the ' + 'current state for any unknown actions, unless it is undefined, ' + 'in which case you must return the initial state, regardless of the ' + 'action type. The initial state may not be undefined.');
}
});
}
/**
* Turns an object whose values are different reducer functions, into a single
* reducer function. It will call every child reducer, and gather their results
* into a single state object, whose keys correspond to the keys of the passed
* reducer functions.
*
* @param {Object} reducers An object whose values correspond to different
* reducer functions that need to be combined into one. One handy way to obtain
* it is to use ES6 `import * as reducers` syntax. The reducers may never return
* undefined for any action. Instead, they should return their initial state
* if the state passed to them was undefined, and the current state for any
* unrecognized action.
*
* @returns {Function} A reducer function that invokes every reducer inside the
* passed object, and builds a state object with the same shape.
*/
function combineReducers(reducers) {
var reducerKeys = Object.keys(reducers);
var finalReducers = {};
for (var i = 0; i < reducerKeys.length; i++) {
var key = reducerKeys[i];
if (process.env.NODE_ENV !== 'production') {
if (typeof reducers[key] === 'undefined') {
(0, _warning2['default'])('No reducer provided for key "' + key + '"');
}
}
if (typeof reducers[key] === 'function') {
finalReducers[key] = reducers[key];
}
}
var finalReducerKeys = Object.keys(finalReducers);
if (process.env.NODE_ENV !== 'production') {
var unexpectedKeyCache = {};
}
var sanityError;
try {
assertReducerSanity(finalReducers);
} catch (e) {
sanityError = e;
}
return function combination() {
var state = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var action = arguments[1];
if (sanityError) {
throw sanityError;
}
if (process.env.NODE_ENV !== 'production') {
var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
if (warningMessage) {
(0, _warning2['default'])(warningMessage);
}
}
var hasChanged = false;
var nextState = {};
for (var i = 0; i < finalReducerKeys.length; i++) {
var key = finalReducerKeys[i];
var reducer = finalReducers[key];
var previousStateForKey = state[key];
var nextStateForKey = reducer(previousStateForKey, action);
if (typeof nextStateForKey === 'undefined') {
var errorMessage = getUndefinedStateErrorMessage(key, action);
throw new Error(errorMessage);
}
nextState[key] = nextStateForKey;
hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
}
return hasChanged ? nextState : state;
};
}
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10)))
/***/ },
/* 60 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
exports['default'] = warning;
/**
* Prints a warning in the console if it exists.
*
* @param {String} message The warning message.
* @returns {void}
*/
function warning(message) {
/* eslint-disable no-console */
if (typeof console !== 'undefined' && typeof console.error === 'function') {
console.error(message);
}
/* eslint-enable no-console */
try {
// This error was thrown as a convenience so that if you enable
// "break on all exceptions" in your console,
// it would pause the execution at this line.
throw new Error(message);
/* eslint-disable no-empty */
} catch (e) {}
/* eslint-enable no-empty */
}
/***/ },
/* 61 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
exports['default'] = bindActionCreators;
function bindActionCreator(actionCreator, dispatch) {
return function () {
return dispatch(actionCreator.apply(undefined, arguments));
};
}
/**
* Turns an object whose values are action creators, into an object with the
* same keys, but with every function wrapped into a `dispatch` call so they
* may be invoked directly. This is just a convenience method, as you can call
* `store.dispatch(MyActionCreators.doSomething())` yourself just fine.
*
* For convenience, you can also pass a single function as the first argument,
* and get a function in return.
*
* @param {Function|Object} actionCreators An object whose values are action
* creator functions. One handy way to obtain it is to use ES6 `import * as`
* syntax. You may also pass a single function.
*
* @param {Function} dispatch The `dispatch` function available on your Redux
* store.
*
* @returns {Function|Object} The object mimicking the original object, but with
* every action creator wrapped into the `dispatch` call. If you passed a
* function as `actionCreators`, the return value will also be a single
* function.
*/
function bindActionCreators(actionCreators, dispatch) {
if (typeof actionCreators === 'function') {
return bindActionCreator(actionCreators, dispatch);
}
if (typeof actionCreators !== 'object' || actionCreators === null) {
throw new Error('bindActionCreators expected an object or a function, instead received ' + (actionCreators === null ? 'null' : typeof actionCreators) + '. ' + 'Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');
}
var keys = Object.keys(actionCreators);
var boundActionCreators = {};
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
var actionCreator = actionCreators[key];
if (typeof actionCreator === 'function') {
boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);
}
}
return boundActionCreators;
}
/***/ },
/* 62 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
exports['default'] = applyMiddleware;
var _compose = __webpack_require__(63);
var _compose2 = _interopRequireDefault(_compose);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
/**
* Creates a store enhancer that applies middleware to the dispatch method
* of the Redux store. This is handy for a variety of tasks, such as expressing
* asynchronous actions in a concise manner, or logging every action payload.
*
* See `redux-thunk` package as an example of the Redux middleware.
*
* Because middleware is potentially asynchronous, this should be the first
* store enhancer in the composition chain.
*
* Note that each middleware will be given the `dispatch` and `getState` functions
* as named arguments.
*
* @param {...Function} middlewares The middleware chain to be applied.
* @returns {Function} A store enhancer applying the middleware.
*/
function applyMiddleware() {
for (var _len = arguments.length, middlewares = Array(_len), _key = 0; _key < _len; _key++) {
middlewares[_key] = arguments[_key];
}
return function (createStore) {
return function (reducer, preloadedState, enhancer) {
var store = createStore(reducer, preloadedState, enhancer);
var _dispatch = store.dispatch;
var chain = [];
var middlewareAPI = {
getState: store.getState,
dispatch: function dispatch(action) {
return _dispatch(action);
}
};
chain = middlewares.map(function (middleware) {
return middleware(middlewareAPI);
});
_dispatch = _compose2['default'].apply(undefined, chain)(store.dispatch);
return _extends({}, store, {
dispatch: _dispatch
});
};
};
}
/***/ },
/* 63 */
/***/ function(module, exports) {
"use strict";
exports.__esModule = true;
exports["default"] = compose;
/**
* Composes single-argument functions from right to left. The rightmost
* function can take multiple arguments as it provides the signature for
* the resulting composite function.
*
* @param {...Function} funcs The functions to compose.
* @returns {Function} A function obtained by composing the argument functions
* from right to left. For example, compose(f, g, h) is identical to doing
* (...args) => f(g(h(...args))).
*/
function compose() {
for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) {
funcs[_key] = arguments[_key];
}
if (funcs.length === 0) {
return function (arg) {
return arg;
};
}
if (funcs.length === 1) {
return funcs[0];
}
var last = funcs[funcs.length - 1];
var rest = funcs.slice(0, -1);
return function () {
return rest.reduceRight(function (composed, f) {
return f(composed);
}, last.apply(undefined, arguments));
};
}
/***/ },
/* 64 */
/***/ function(module, exports) {
/**
* Copyright 2015, Yahoo! Inc.
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
'use strict';
var REACT_STATICS = {
childContextTypes: true,
contextTypes: true,
defaultProps: true,
displayName: true,
getDefaultProps: true,
mixins: true,
propTypes: true,
type: true
};
var KNOWN_STATICS = {
name: true,
length: true,
prototype: true,
caller: true,
arguments: true,
arity: true
};
var isGetOwnPropertySymbolsAvailable = typeof Object.getOwnPropertySymbols === 'function';
module.exports = function hoistNonReactStatics(targetComponent, sourceComponent, customStatics) {
if (typeof sourceComponent !== 'string') { // don't hoist over string (html) components
var keys = Object.getOwnPropertyNames(sourceComponent);
/* istanbul ignore else */
if (isGetOwnPropertySymbolsAvailable) {
keys = keys.concat(Object.getOwnPropertySymbols(sourceComponent));
}
for (var i = 0; i < keys.length; ++i) {
if (!REACT_STATICS[keys[i]] && !KNOWN_STATICS[keys[i]] && (!customStatics || !customStatics[keys[i]])) {
try {
targetComponent[keys[i]] = sourceComponent[keys[i]];
} catch (error) {
}
}
}
}
return targetComponent;
};
/***/ },
/* 65 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.PersistentQueryLink = exports.Link = undefined;
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 _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _react = __webpack_require__(35);
var _react2 = _interopRequireDefault(_react);
var _actions = __webpack_require__(2);
var _normalizeHref = __webpack_require__(3);
var _normalizeHref2 = _interopRequireDefault(_normalizeHref);
var _stringifyHref = __webpack_require__(66);
var _stringifyHref2 = _interopRequireDefault(_stringifyHref);
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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
var LEFT_MOUSE_BUTTON = 0;
var isNotLeftClick = function isNotLeftClick(e) {
return e.button && e.button !== LEFT_MOUSE_BUTTON;
};
var hasModifier = function hasModifier(e) {
return Boolean(e.shiftKey || e.altKey || e.metaKey || e.ctrlKey);
};
var shouldIgnoreClick = function shouldIgnoreClick(_ref) {
var e = _ref.e,
target = _ref.target;
return hasModifier(e) || isNotLeftClick(e) || e.defaultPrevented || target;
}; // let browser handle target="_blank"
var handleClick = function handleClick(_ref2) {
var e = _ref2.e,
target = _ref2.target,
href = _ref2.href,
onClick = _ref2.onClick,
replaceState = _ref2.replaceState,
persistQuery = _ref2.persistQuery,
store = _ref2.store;
if (onClick) {
onClick(e);
}
if (shouldIgnoreClick({ e: e, target: target })) {
return;
}
e.preventDefault();
var navigate = replaceState ? _actions.replace : _actions.push;
store.dispatch(navigate(href, { persistQuery: persistQuery }));
};
var Link = function Link(props, context) {
var rawHref = props.href,
children = props.children,
onClick = props.onClick,
target = props.target,
replaceState = props.replaceState,
persistQuery = props.persistQuery,
rest = _objectWithoutProperties(props, ['href', 'children', 'onClick', 'target', 'replaceState', 'persistQuery']);
var store = context.router.store;
var _store$getState = store.getState(),
basename = _store$getState.router.basename;
// Ensure the href has both a search and a query when needed
var href = (0, _normalizeHref2.default)(rawHref);
var clickHandler = function clickHandler(e) {
return handleClick({
e: e,
target: target,
href: href,
onClick: onClick,
replaceState: replaceState,
persistQuery: persistQuery,
store: store
});
};
return _react2.default.createElement(
'a',
_extends({
href: (0, _stringifyHref2.default)(href, basename),
onClick: clickHandler
}, rest),
children
);
};
Link.contextTypes = {
router: _react.PropTypes.object
};
var PersistentQueryLink = function (_Component) {
_inherits(PersistentQueryLink, _Component);
function PersistentQueryLink() {
_classCallCheck(this, PersistentQueryLink);
return _possibleConstructorReturn(this, (PersistentQueryLink.__proto__ || Object.getPrototypeOf(PersistentQueryLink)).apply(this, arguments));
}
_createClass(PersistentQueryLink, [{
key: 'render',
value: function render() {
var _props = this.props,
children = _props.children,
rest = _objectWithoutProperties(_props, ['children']);
return _react2.default.createElement(
Link,
_extends({}, rest, { persistQuery: true }),
children
);
}
}]);
return PersistentQueryLink;
}(_react.Component);
PersistentQueryLink.propTypes = {
children: _react.PropTypes.node
};
PersistentQueryLink.contextTypes = {
router: _react.PropTypes.object
};
exports.Link = Link;
exports.PersistentQueryLink = PersistentQueryLink;
/***/ },
/* 66 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = function (href, basename) {
if (typeof href === 'string') {
return '' + (basename || '') + href;
}
var pathname = href.pathname,
search = href.search;
return '' + (basename || '') + pathname + (search || '');
};
/***/ },
/* 67 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _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 _react = __webpack_require__(35);
var _react2 = _interopRequireDefault(_react);
var _matchCache = __webpack_require__(24);
var _matchCache2 = _interopRequireDefault(_matchCache);
var _generateId = __webpack_require__(68);
var _generateId2 = _interopRequireDefault(_generateId);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var relativePaths = function relativePaths(ComposedComponent) {
var RelativeFragment = function (_Component) {
_inherits(RelativeFragment, _Component);
function RelativeFragment() {
_classCallCheck(this, RelativeFragment);
var _this = _possibleConstructorReturn(this, (RelativeFragment.__proto__ || Object.getPrototypeOf(RelativeFragment)).call(this));
_this.id = (0, _generateId2.default)();
return _this;
}
_createClass(RelativeFragment, [{
key: 'getChildContext',
value: function getChildContext() {
var parentRoute = this.context.parentRoute;
var forRoute = this.props.forRoute;
return {
// Append the parent route if this isn't the first
// RelativeFragment in the hierarchy.
parentRoute: parentRoute && parentRoute !== '/' && parentRoute !== forRoute ? '' + parentRoute + (forRoute || '') : forRoute,
parentId: this.id
};
}
}, {
key: 'render',
value: function render() {
var _props = this.props,
children = _props.children,
forRoute = _props.forRoute,
rest = _objectWithoutProperties(_props, ['children', 'forRoute']);
var _context = this.context,
router = _context.router,
parentRoute = _context.parentRoute,
parentId = _context.parentId;
var store = router.store;
var location = store.getState().router;
var routePrefix = parentRoute && parentRoute !== '/' ? parentRoute : '';
return _react2.default.createElement(ComposedComponent, _extends({
parentId: parentId,
location: location,
matchRoute: store.matchWildcardRoute,
forRoute: forRoute && '' + routePrefix + forRoute,
children: children
}, rest));
}
}]);
return RelativeFragment;
}(_react.Component);
// Consumes this context...
RelativeFragment.contextTypes = {
router: _react.PropTypes.object,
parentRoute: _react.PropTypes.string,
parentId: _react.PropTypes.string
};
// ...and provides this context.
RelativeFragment.childContextTypes = {
parentRoute: _react.PropTypes.string,
parentId: _react.PropTypes.string
};
return RelativeFragment;
};
var Fragment = function Fragment(props) {
var location = props.location,
matchRoute = props.matchRoute,
forRoute = props.forRoute,
withConditions = props.withConditions,
children = props.children,
parentId = props.parentId;
var matchResult = matchRoute(location.pathname, forRoute);
if (!matchResult || withConditions && !withConditions(location) || forRoute && matchResult.route !== forRoute) {
return null;
}
if (parentId) {
var previousMatch = _matchCache2.default.get(parentId);
if (previousMatch && previousMatch !== forRoute) {
return null;
} else {
_matchCache2.default.add(parentId, forRoute);
}
}
return _react2.default.createElement(
'div',
null,
children
);
};
exports.default = relativePaths(Fragment);
/***/ },
/* 68 */
/***/ function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
/**
* Returns a psuedo-unique identifier used by fragments
* to track match status within MatchCache.
* @returns {String} id
*
*/
exports.default = function () {
var radix = 16;
var length = 8;
return (Math.random() * Date.now()).toString(radix).slice(0, length);
};
/***/ }
/******/ ])
});
;
//# sourceMappingURL=redux-little-router.js.map
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.